Okay, so this just reached an annoyance point with me, so please forgive
me kvetching a bit.  BTW -- this is specific to RHEL 5, s390utils 1.8,
so all you more modern folks or SuSE users can just laugh at me.

The contents of /proc/dasd/devices is very complete, but a PITA to
parse.  You can't parse it based on character position, it has varying
length fields, and you can't parse it based on a simple fixed field
separator, either:

0.0.0391(ECKD) at ( 94:     0) is dasda       : active at blocksize:
4096, 22500 blocks, 87 MB
0.0.0392(ECKD) at ( 94:     4) is dasdb       : active at blocksize:
4096, 1802880 blocks, 7042 MB
0.0.0393(ECKD) at ( 94:     8) is dasdc       : active at blocksize:
4096, 1802880 blocks, 7042 MB
0.0.0394(ECKD) at ( 94:    12) is dasdd       : active at blocksize:
4096, 1802880 blocks, 7042 MB
0.0.07ff(FBA ) at ( 94:    16) is dasde       : active at blocksize:
512, 2097152 blocks, 1024 MB

Note that the blocksize. number of blocks, and size are all varying
length fields.  Note all that neither space, nor parents, nor colon make
a good choice for a field separator.

Now lsdasd produces output that would be easily parsable by either fixed
character position or by using space as a delimiter, that's great.
However, it doesn't include reliable size information, e.g. if I want to
make sure a source and dest device both have the same number of blocks
and blocksize:

Bus-ID     Status      Name      Device  Type  BlkSz  Size      Blocks
==============================================================================
0.0.0391   active      dasda     94:0    ECKD  ???    87MB      ???
0.0.0392   active      dasdb     94:4    ECKD  ???    7042MB    ???
0.0.0393   active      dasdc     94:8    ECKD  ???    7042MB    ???
0.0.0394   active      dasdd     94:12   ECKD  ???    7042MB    ???
0.0.07ff   active      dasde     94:16   FBA   ???    1024MB    ???

This leaves me writing complex and fragile regular expressions to parse
info from /proc/dasd/devices, leaving myself and my colleagues many
maintenance headaches to come.

To whoever wrote both of these tools, my apologies, but a wriggling wet
salmon be inflicted on your keyboard in the middle of an editing
session!  More seriously, though, please consider machine parsibility
when you write tools.

Grumbling,
-- Pat

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to