From 515d18304324c2e11f40742c394c90799913fa67 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 4 Aug 2009 12:49:59 +0200 Subject: [PATCH] solaris: implement blockdev size getting Just use lseek(..., SEEK_END), we should actually be able to use that on all platforms. Signed-off-by: Jens Axboe --- os/os-solaris.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/os/os-solaris.h b/os/os-solaris.h index f00aae10..c49ce8d9 100644 --- a/os/os-solaris.h +++ b/os/os-solaris.h @@ -28,7 +28,13 @@ typedef struct solaris_rand_seed os_random_state_t; */ static inline int blockdev_size(int fd, unsigned long long *bytes) { - return EINVAL; + off_t end = lseek(fd, 0, SEEK_END); + + if (end < 0) + return errno; + + *bytes = end; + return 0; } static inline int blockdev_invalidate_cache(int fd) -- 2.25.1