X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fos.h;h=1afb4b227521e3846b087d401b7297201d45cbbb;hp=10e796fbcbe3313d1faee845bc26d751645aa011;hb=792d551747e83601121afce033a66f357c9fc439;hpb=783500ad13ededece6c8912af1c937f990880e1f diff --git a/os/os.h b/os/os.h index 10e796fb..1afb4b22 100644 --- a/os/os.h +++ b/os/os.h @@ -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