]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - bitmap.c
New flag --no-degraded
[thirdparty/mdadm.git] / bitmap.c
index 75492f759fe0c2ad2c8ee7464b556ed2163dc8ae..8210278f356910fda95c9ac741475d8afcd80c17 100644 (file)
--- 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);
+}