]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - util.c
Put a 'canary' block in front of the backup
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index abc576ed3281f07519e97718382e23dfe363caae..0af433130bb723dcf4943a865cebda0f7f8e5553 100644 (file)
--- a/util.c
+++ b/util.c
@@ -229,7 +229,7 @@ int check_reiser(int fd, char *name)
         *
         */
        unsigned char sb[1024];
-       int size;
+       unsigned long size;
        if (lseek(fd, 64*1024, 0) != 64*1024)
                return 0;
        if (read(fd, sb, 1024) != 1024)
@@ -239,7 +239,7 @@ int check_reiser(int fd, char *name)
                return 0;
        fprintf(stderr, Name ": %s appears to contain a reiserfs file system\n",name);
        size = sb[0]|(sb[1]|(sb[2]|sb[3]<<8)<<8)<<8;
-       fprintf(stderr, "    size = %dK\n", size*4);
+       fprintf(stderr, "    size = %luK\n", size*4);
                
        return 1;
 }
@@ -676,34 +676,6 @@ struct supertype *guess_super(int fd)
        return NULL;
 }
 
-unsigned long long get_component_size(int fd)
-{
-       /* Find out the component size of the array.
-        * We cannot trust GET_ARRAY_INFO ioctl as it's
-        * size field is only 32bits.
-        * So look in /sys/block/mdXXX/md/component_size
-        */
-       struct stat stb;
-       char fname[50];
-       int n;
-       if (fstat(fd, &stb)) return 0;
-       if (major(stb.st_rdev) == 9)
-               sprintf(fname, "/sys/block/md%d/md/component_size",
-                       minor(stb.st_rdev));
-       else
-               sprintf(fname, "/sys/block/md_d%d/md/component_size",
-                       minor(stb.st_rdev)/16);
-       fd = open(fname, O_RDONLY);
-       if (fd < 0)
-               return 0;
-       n = read(fd, fname, sizeof(fname));
-       close(fd);
-       if (n == sizeof(fname))
-               return 0;
-       fname[n] = 0;
-       return strtoull(fname, NULL, 10);
-}
-
 
 #ifdef __TINYC__
 /* tinyc doesn't optimize this check in ioctl.h out ... */