[Libguestfs] [PATCH V2] NEW API: add new api xfs_info

Richard W.M. Jones rjones at redhat.com
Thu Jul 12 11:37:40 UTC 2012


On Thu, Jul 12, 2012 at 04:37:59PM +0800, Wanlong Gao wrote:
> Yes, it's defined like this.
> 
> 	printf(_(
> 	    "meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
> 	    "         =%-22s sectsz=%-5u attr=%u\n"
> 	    "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
> 	    "         =%-22s sunit=%-6u swidth=%u blks\n"
> 	    "naming   =version %-14u bsize=%-6u ascii-ci=%d\n"
> 	    "log      =%-22s bsize=%-6u blocks=%u, version=%u\n"
> 	    "         =%-22s sectsz=%-5u sunit=%u blks, lazy-count=%u\n"
> 	    "realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"),

It really is the most bizarre output format imaginable!

What do you think about using a struct then?  It's probably easier
than returning a hash table, but there is no room for changing the API
later if, eg., extra fields are added.

An example of an API that added a new struct type:

https://github.com/libguestfs/libguestfs/commit/a43f35f5bb7c40b000083cd8be5cb1f28595a3f1

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list