]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Add new mode: --incremental
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index ffb113c3c9d5179a872e0e55ed39b7f8f7ef0043..58449d52ff449ab5fcaf9e33d6b6a732446dfb52 100644 (file)
--- a/util.c
+++ b/util.c
@@ -246,6 +246,25 @@ int same_uuid(int a[4], int b[4], int swapuuid)
                return 0;
        }
 }
+void copy_uuid(void *a, int b[4], int swapuuid)
+{
+       if (swapuuid) {
+               /* parse uuids are hostendian.
+                * uuid's from some superblocks are big-ending
+                * if there is a difference, we need to swap..
+                */
+               unsigned char *ac = (unsigned char *)a;
+               unsigned char *bc = (unsigned char *)b;
+               int i;
+               for (i=0; i<16; i+= 4) {
+                       ac[i+0] = bc[i+3];
+                       ac[i+1] = bc[i+2];
+                       ac[i+2] = bc[i+1];
+                       ac[i+3] = bc[i+0];
+               }
+       } else
+               memcpy(a, b, 16);
+}
 
 #ifndef MDASSEMBLE
 int check_ext2(int fd, char *name)
@@ -796,6 +815,14 @@ int get_dev_size(int fd, char *dname, unsigned long long *sizep)
        return 1;
 }
 
+void get_one_disk(int mdfd, mdu_array_info_t *ainf, mdu_disk_info_t *disk)
+{
+       int d;
+       ioctl(mdfd, GET_ARRAY_INFO, ainf);
+       for (d = 0 ; d < ainf->raid_disks + ainf->nr_disks ; d++)
+               if (ioctl(mdfd, GET_DISK_INFO, disk) == 0)
+                       return;
+}
 #ifdef __TINYC__
 /* tinyc doesn't optimize this check in ioctl.h out ... */
 unsigned int __invalid_size_argument_for_IOC = 0;