diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-06-19 20:32:35 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-06-19 20:32:35 +0000 |
commit | c5592df6100fa71a0e942bddaca502bb0dd1bd83 (patch) | |
tree | 3a38dbf98ae40925e06ef78a4cff1935fdade2a5 /lib/blkdev.c | |
parent | 505e274639684fba6f275da6b4cbffc2088d66b8 (diff) | |
download | util-linux-old-c5592df6100fa71a0e942bddaca502bb0dd1bd83.tar.gz |
blkdev_get_size() on Solaris
Diffstat (limited to 'lib/blkdev.c')
-rw-r--r-- | lib/blkdev.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/blkdev.c b/lib/blkdev.c index 67c4a1ac..5514f867 100644 --- a/lib/blkdev.c +++ b/lib/blkdev.c @@ -13,6 +13,10 @@ #include <sys/disklabel.h> #endif +#ifdef HAVE_SYS_DKIO_H +#include <sys/dkio.h> +#endif + #ifdef HAVE_SYS_DISK_H #ifdef HAVE_SYS_QUEUE_H #include <sys/queue.h> /* for LIST_HEAD */ @@ -148,7 +152,17 @@ blkdev_get_size(int fd, unsigned long long *bytes) } } #endif /* HAVE_SYS_DISKLABEL_H */ - +#ifdef DKIOCG_PHYGEOM + /* sunos (illumos/solaris) */ + { + struct dk_geom geom; + if (ioctl(fd, DKIOCG_PHYGEOM, &geom) >= 0) { + *bytes = geom.dkg_ncyl * geom.dkg_nhead * geom.dkg_nsect; + *bytes <<= 9; /* x 512 */ + return 0; + } + } +#endif /* DKIOCG_PHYGEOM */ { struct stat st; |