summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-10-11 04:44:44 +0000
committerNeil Brown <neilb@suse.de>2005-10-11 04:44:44 +0000
commitdcec9ee54779586f287f5db98ab1be3f0f02dd3f (patch)
tree053ff57337183f7b975433ad45f74a8cb245cdf9 /bitmap.c
parent5a6d7f456ad67779321d8aa81203f70bcc56a0a5 (diff)
downloadmdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.tar.gz
mdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.tar.xz
mdadm-dcec9ee54779586f287f5db98ab1be3f0f02dd3f.zip
Create version-4 bitmaps if kernel supports it.
Version-3 bitmaps are host-endian. Version-4 are little-endian and so more portable. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bitmap.c b/bitmap.c
index 82da00a..bc29768 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -243,7 +243,8 @@ int ExamineBitmap(char *filename, int brief, struct supertype *st)
fprintf(stderr, Name ": invalid bitmap magic 0x%x, the bitmap file appears to be corrupted\n", sb->magic);
}
printf(" Version : %d\n", sb->version);
- if (sb->version != BITMAP_MAJOR) {
+ if (sb->version < BITMAP_MAJOR_LO ||
+ sb->version > BITMAP_MAJOR_HI) {
fprintf(stderr, Name ": unknown bitmap version %d, either the bitmap file is corrupted or you need to upgrade your tools\n", sb->version);
goto free_info;
}
@@ -287,7 +288,8 @@ free_info:
int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long chunksize, unsigned long daemon_sleep,
unsigned long write_behind,
- unsigned long long array_size /* sectors */)
+ unsigned long long array_size /* sectors */,
+ int major)
{
/*
* Create a bitmap file with a superblock and (optionally) a full bitmap
@@ -313,7 +315,7 @@ int CreateBitmap(char *filename, int force, char uuid[16],
memset(&sb, 0, sizeof(sb));
sb.magic = BITMAP_MAGIC;
- sb.version = BITMAP_MAJOR;
+ sb.version = major;
if (uuid != NULL)
memcpy(sb.uuid, uuid, 16);
sb.chunksize = chunksize;