+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
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);