On 07/09/2012 05:28 PM, Richard W.M. Jones wrote:
On Mon, Jul 09, 2012 at 05:15:47PM +0800, Wanlong Gao wrote:
>> ><rescue> xfs_info /dev/vda1
>> meta-data=/dev/vda1 isize=256 agcount=4, agsize=655358 blks
>> = sectsz=512 attr=2
>> data = bsize=4096 blocks=2621432, imaxpct=25
>> = sunit=0 swidth=0 blks
>> naming =version 2 bsize=4096 ascii-ci=0
>> log =internal bsize=4096 blocks=2560, version=2
>> = sectsz=512 sunit=0 blks, lazy-count=1
>> realtime =none extsz=4096 blocks=0, rtextents=0
>>
>> It's weird output, but let's parse and return that instead of dumping
>> the problem onto every caller.
>
> Sorry, I can't understand what do you mean here, it's the original output of
> xfs_info.
Sure, but what's the caller going to do with this output
(assuming the caller is a program)?
If it wants to find, eg, the 'bsize' field then it has to
parse this, so we're pushing the problem of parsing the output
up to every program.
BTW we can use augeas to handle parsing, since these useful APIs were
added to augeas recently:
https://www.redhat.com/archives/augeas-devel/2012-May/msg00035.html
Got it, thank you for explanation. I'll try.
Wanlong Gao