summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-02-06 04:18:12 +0000
committerNeil Brown <neilb@suse.de>2006-02-06 04:18:12 +0000
commit1e0d770c0f2e78bb334cd75d3d71c8c7d3b8f621 (patch)
tree03546c5e2d7b63bc1b1c76954e5fea9b127f34bd /super1.c
parenta92f6acc43a37b7fcea9d968b6e62035ca73a100 (diff)
downloadmdadm-1e0d770c0f2e78bb334cd75d3d71c8c7d3b8f621.tar.gz
mdadm-1e0d770c0f2e78bb334cd75d3d71c8c7d3b8f621.tar.xz
mdadm-1e0d770c0f2e78bb334cd75d3d71c8c7d3b8f621.zip
Release some compile fixes.
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/super1.c b/super1.c
index b4af6cc..dd852e5 100644
--- a/super1.c
+++ b/super1.c
@@ -28,8 +28,6 @@
*/
#include "mdadm.h"
-#include <endian.h>
-#include "asm/byteorder.h"
/*
* The version-1 superblock :
* All numeric fields are little-endian.
@@ -198,7 +196,7 @@ static void examine_super1(void *sbv)
(long)__le32_to_cpu(sb->bitmap_offset));
}
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
- printf(" Reshape pos'n : %llu%s\n", __le64_to_cpu(sb->reshape_position)/2,
+ printf(" Reshape pos'n : %llu%s\n", (unsigned long long)__le64_to_cpu(sb->reshape_position)/2,
human_size(__le64_to_cpu(sb->reshape_position)<<9));
if (__le32_to_cpu(sb->delta_disks)) {
printf(" Delta Devices : %d", __le32_to_cpu(sb->delta_disks));
@@ -1019,17 +1017,19 @@ add_internal_bitmap1(struct supertype *st, void *sbv,
void locate_bitmap1(struct supertype *st, int fd, void *sbv)
{
unsigned long long offset;
- struct mdp_superblock_1 *sb = NULL;
+ struct mdp_superblock_1 *sb;
+ int mustfree = 0;
- if (sbv)
- sb = sbv;
- else
- if (st->ss->load_super(st, fd, (void **)&sb, NULL))
+ if (!sbv) {
+ if (st->ss->load_super(st, fd, &sbv, NULL))
return; /* no error I hope... */
+ mustfree = 1;
+ }
+ sb = sbv;
offset = __le64_to_cpu(sb->super_offset);
offset += (long) __le32_to_cpu(sb->bitmap_offset);
- if (!sbv)
+ if (mustfree)
free(sb);
lseek64(fd, offset<<9, 0);
}
@@ -1045,7 +1045,9 @@ int write_bitmap1(struct supertype *st, int fd, void *sbv)
locate_bitmap1(st, fd, sbv);
- write(fd, ((char*)sb)+1024, sizeof(bitmap_super_t));
+ if (write(fd, ((char*)sb)+1024, sizeof(bitmap_super_t)) !=
+ sizeof(bitmap_super_t))
+ return -2;
towrite = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9);
towrite = (towrite+7) >> 3; /* bits to bytes */
memset(buf, 0xff, sizeof(buf));