]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fall back to BLKGETSIZE if BLKGETSIZE64 isn't defined
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 19 Jul 2007 16:30:57 +0000 (16:30 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 19 Jul 2007 16:30:57 +0000 (16:30 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1528 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/ebofs/BlockDevice.cc

index bf431e6a37f37ab4a254e001e3de55599d0e7eb5..d7ffc906701b7039b510fef1a5c28945d2079399 100644 (file)
@@ -269,8 +269,14 @@ block_t BlockDevice::get_num_blocks()
     assert(fd > 0);
 
 #ifdef BLKGETSIZE64
-    // ioctl block device?
+    // ioctl block device
     ioctl(fd, BLKGETSIZE64, &num_blocks);
+#else
+    // hrm, try the 32 bit ioctl?
+    dout(0) << "hrm, no BLKGETSIZE64, falling back to BLKGETSIZE" << endl;
+    long sectors = 0;
+    ioctl(fd, BLKGETSIZE, &sectors);
+    num_blocks = 512*sectors;
 #endif
 
     if (!num_blocks) {