From: Jens Axboe Date: Mon, 11 Jul 2011 08:48:51 +0000 (+0200) Subject: HP-UX disk query size X-Git-Tag: fio-1.56~8 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=0ec15d6ca9fee3c2b0f19b3520f5b77fb2378d51;hp=5c909c91a2f58848b485523920e2278f8d63ecd4 HP-UX disk query size Signed-off-by: Jens Axboe --- diff --git a/os/os-hpux.h b/os/os-hpux.h index c65fea69..1b1c9589 100644 --- a/os/os-hpux.h +++ b/os/os-hpux.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,6 +22,7 @@ #define FIO_HAVE_CLOCK_MONOTONIC #define FIO_HAVE_PSHARED_MUTEX #define FIO_HAVE_FADVISE +#define FIO_HAVE_CHARDEV_SIZE #define OS_MAP_ANON MAP_ANONYMOUS #define OS_MSG_DONTWAIT 0 @@ -46,10 +47,13 @@ static inline int blockdev_invalidate_cache(struct fio_file *f) static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) { - struct capacity cap; + disk_describe_type_ext_t dext; - if (!ioctl(f->fd, SIOC_CAPACITY, &cap) == -1) { - *bytes = cap.lba * cap.blksz; + if (!ioctl(f->fd, DIOC_DESCRIBE_EXT, &dext)) { + unsigned long long lba; + + lba = ((uint64_t) dext.maxsva_high << 32) | dext.maxsva_low; + *bytes = lba * dext.lgblksz; return 0; } @@ -57,6 +61,11 @@ static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) return errno; } +static inline int chardev_size(struct fio_file *f, unsigned long long *bytes) +{ + return blockdev_size(f, bytes); +} + static inline unsigned long long os_phys_mem(void) { unsigned long long ret;