diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-09-22 17:12:29 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-22 17:12:29 +0200 |
commit | 792d551747e83601121afce033a66f357c9fc439 (patch) | |
tree | 768ad2fd76eb87f3661929a3aa27188ad586a5eb /os/os.h | |
parent | 783500ad13ededece6c8912af1c937f990880e1f (diff) | |
download | fio-792d551747e83601121afce033a66f357c9fc439.tar.gz fio-792d551747e83601121afce033a66f357c9fc439.tar.bz2 |
Add generic bdev_size function
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'os/os.h')
-rw-r--r-- | os/os.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -106,4 +106,17 @@ static inline int os_cache_line_size(void) #endif } +#ifdef FIO_USE_GENERIC_BDEV_SIZE +static inline int blockdev_size(int fd, unsigned long long *bytes) +{ + off_t end = lseek(fd, 0, SEEK_END); + + if (end < 0) + return errno; + + *bytes = end; + return 0; +} +#endif + #endif |