]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Document BLKGETSIZE64->BLKGETSIZE fallback
authorEric Sandeen <sandeen@sgi.com>
Thu, 28 Feb 2002 23:28:05 +0000 (23:28 +0000)
committerEric Sandeen <sandeen@sgi.com>
Thu, 28 Feb 2002 23:28:05 +0000 (23:28 +0000)
doc/CHANGES
libxfs/init.c

index 200f4795abd716a4fb5a212b0dd2384dede37241..6f563171eff4988f84d592a695ac866571206bce 100644 (file)
@@ -1,3 +1,6 @@
+cvs
+       - Fall back to BLKGETSIZE if BLKGETSIZE64 fails
+
 xfsprogs-2.0.0 (26 February 2002)
        - Major release to coincide with switch to new extended
          attributes system call interfaces
index 0a388d82b16e79aeb03a3aeb4eac2ad982955f18..bf3e0a4558ed3b22596511933a2da9dfbdf19719 100644 (file)
@@ -156,11 +156,19 @@ findsize(char *path)
                exit(1);
        }
        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);
+       if (error >= 0) {
+               /* BLKGETSIZE64 returns size in bytes not 512-byte blocks */
+               size = size >> 9;
+       } else {
+               /* If BLKGETSIZE64 fails, try BLKGETSIZE */
+               unsigned long tmpsize;
+               error = ioctl(fd, BLKGETSIZE, &tmpsize);
+               if (error < 0) {
+                       fprintf(stderr, "%s: can't determine device size\n",
+                               progname);
+                       exit(1);
+               }
+               size = (__uint64_t)tmpsize;
        }
 
        close(fd);