Petros Koutoupis
2010-Jan-29 22:15 UTC
[zfs-discuss] Obtaining zpool volume size from a C coded application.
As I was navigating through the source code for the ZFS file system I saw that in zvol.c where the ioctls are defined, if a program sends a DKIOCGGEOM or DKIOCDVTOV, an ENOTSUP (Error Not Supported) is returned. You can view this here: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zvol.c My question is, what is an appropriate method to obtain the zpool''s volume size from a C coded application? -- This message posted from opensolaris.org
Petros Koutoupis
2010-Jan-29 22:15 UTC
[zfs-code] Obtaining zpool volume size from a C coded application.
As I was navigating through the source code for the ZFS file system I saw that in zvol.c where the ioctls are defined, if a program sends a DKIOCGGEOM or DKIOCDVTOV, an ENOTSUP (Error Not Supported) is returned. You can view this here: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zvol.c My question is, what is an appropriate method to obtain the zpool''s volume size from a C coded application? -- This message posted from opensolaris.org
Ian Collins
2010-Jan-30 22:11 UTC
[zfs-discuss] Obtaining zpool volume size from a C coded application.
[cross posting is probably better than muli-posts] Petros Koutoupis wrote:> As I was navigating through the source code for the ZFS file system I saw that in zvol.c where the ioctls are defined, if a program sends a DKIOCGGEOM or DKIOCDVTOV, an ENOTSUP (Error Not Supported) is returned. > > You can view this here: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zvol.c > > My question is, what is an appropriate method to obtain the zpool''s volume size from a C coded application? >I use zprop_get_list and zfs_prop_get form libzfs to read and parse zfs properties. There may be a more direct way, but zprop_get_list appears to be the generic solution. -- Ian.
Petros Koutoupis
2010-Feb-01 01:42 UTC
[zfs-discuss] Obtaining zpool volume size from a C coded application.
Ian, Thank you very much for your response. On Friday, as I was writing my post, I was navigating through the zpool user land binary''s source code and had observed that method. I was just hoping that there was some other and simpler way. I guess not. Unless the time was taken to patch ZFS with an additional supported ioctl() to return a total accessible "block" count of the zpool. That is the beauty of open source. Again, thank you very much for your reply. You have been very helpful. -- This message posted from opensolaris.org
Eric C. Taylor
2010-Feb-02 19:45 UTC
[zfs-discuss] Obtaining zpool volume size from a C coded application.
You can use the DKIOCGMEDIAINFO ioctl to get this information. - Eric -- This message posted from opensolaris.org