Add block device size detection for HP-UX
authorJens Axboe <jaxboe@fusionio.com>
Fri, 8 Jul 2011 19:10:30 +0000 (21:10 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Fri, 8 Jul 2011 19:10:30 +0000 (21:10 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
os/os-hpux.h

index a36cb70424d255b8fc73c79820a82fb4b4603af3..3c90841022575c75706b558fad627615db3e72a3 100644 (file)
@@ -8,6 +8,7 @@
 #include <sys/fadvise.h>
 #include <sys/mman.h>
 #include <sys/mpctl.h>
 #include <sys/fadvise.h>
 #include <sys/mman.h>
 #include <sys/mpctl.h>
+#include <sys/scsi.h>
 
 #include "../file.h"
 
 
 #include "../file.h"
 
@@ -33,19 +34,15 @@ static inline int blockdev_invalidate_cache(struct fio_file *f)
 
 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
 {
 
 static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes)
 {
-#if 0
-       struct devinfo info;
+       struct capacity cap;
 
 
-       if (!ioctl(f->fd, IOCINFO, &info)) {
-               *bytes = (unsigned long long)info.un.scdk.numblks *
-                               info.un.scdk.blksize;
+       if (!ioctl(f->fd, SIOC_CAPACITY, &cap) == -1) {
+               *bytes = cap.lba * cap.blksz;
                return 0;
        }
 
                return 0;
        }
 
+       *bytes = 0;
        return errno;
        return errno;
-#else
-       return 0;
-#endif
 }
 
 static inline unsigned long long os_phys_mem(void)
 }
 
 static inline unsigned long long os_phys_mem(void)