]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Merge of xfs-cmds-2.4.18:slinx:111281a by nathans.
authorEric Sandeen <sandeen@sgi.com>
Mon, 25 Feb 2002 22:25:25 +0000 (22:25 +0000)
committerEric Sandeen <sandeen@sgi.com>
Mon, 25 Feb 2002 22:25:25 +0000 (22:25 +0000)
  Use BLKGETSIZE64 instead of BLKGETSIZE ioctl to find device size
  glibc might not have this yet, so define it if we need it

libxfs/init.c

index 68a758d1239ced8561c09f674b016ea9d28cc766..0a388d82b16e79aeb03a3aeb4eac2ad982955f18 100644 (file)
 #include <sys/ioctl.h>
 #include <sys/mount.h>
 
+/* Until glibc catches up... */
+#ifndef BLKGETSIZE64
+#define BLKGETSIZE64 _IOR(0x12,114,sizeof(__uint64_t))
+#endif
+
 #define findrawpath(x) x
 #define findblockpath(x) x
 
@@ -128,7 +133,7 @@ findsize(char *path)
 {
        int     fd;
        int     error;
-       unsigned long   size;
+       __uint64_t      size;
        struct stat64   st;
 
        /* Test to see if we are dealing with a regular file rather than a
@@ -150,7 +155,9 @@ findsize(char *path)
                        progname, path, strerror(errno));
                exit(1);
        }
-       error = ioctl(fd, BLKGETSIZE, &size);
+       error = ioctl(fd, BLKGETSIZE64, &size);
+       /* BLKGETSIZE64 returns size in bytes */
+       size = size >> 9;
        if (error < 0) {
                fprintf(stderr, "%s: can't determine device size\n", progname);
                exit(1);