summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-16 06:05:27 +0000
committerNeil Brown <neilb@suse.de>2006-05-16 06:05:27 +0000
commit8131b493df02ad22c8600f4c99d97003a807e5a7 (patch)
tree36569355b1b93688767a229090c721763c652aa2 /bitmap.c
parent98b24a2afa11d56a9a93a72736cd080224aa1b50 (diff)
downloadmdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.tar.gz
mdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.tar.xz
mdadm-8131b493df02ad22c8600f4c99d97003a807e5a7.zip
When updating uuid, update the bitmap as well - external bitmaps
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/bitmap.c b/bitmap.c
index 75492f7..8210278 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -398,3 +398,17 @@ out:
unlink(filename); /* possibly corrupted, better get rid of it */
return rv;
}
+
+void bitmap_update_uuid(int fd, int *uuid)
+{
+ struct bitmap_super_s bm;
+ lseek(fd, 0, 0);
+ if (read(fd, &bm, sizeof(bm)) != sizeof(bm))
+ return;
+ if (bm.magic != __cpu_to_le32(BITMAP_MAGIC))
+ return;
+ memcpy(bm.uuid, uuid, 16);
+ lseek(fd, 0, 0);
+ write(fd, &bm, sizeof(bm));
+ lseek(fd, 0, 0);
+}