From 564e49f329dd526842a29f4086fff727bc4d0ba0 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 8 Jul 2011 21:10:30 +0200 Subject: [PATCH] Add block device size detection for HP-UX Signed-off-by: Jens Axboe --- os/os-hpux.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/os/os-hpux.h b/os/os-hpux.h index a36cb704..3c908410 100644 --- a/os/os-hpux.h +++ b/os/os-hpux.h @@ -8,6 +8,7 @@ #include #include #include +#include #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) { -#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; } + *bytes = 0; return errno; -#else - return 0; -#endif } static inline unsigned long long os_phys_mem(void) -- 2.25.1