From: Jens Axboe Date: Fri, 8 Jul 2011 19:10:30 +0000 (+0200) Subject: Add block device size detection for HP-UX X-Git-Tag: fio-1.56~21 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=564e49f329dd526842a29f4086fff727bc4d0ba0 Add block device size detection for HP-UX Signed-off-by: Jens Axboe --- 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)