Re: Suggested dual human/binary interface for proc/devfs

From: Mike Porter (mike@UDel.Edu)
Date: Tue Apr 11 2000 - 09:05:45 EST


On Tue, 11 Apr 2000, Ed Carp wrote:

> George Bonser (grep@shorelink.com) writes:
>
> > device{eth0{ip_address=192.168.201.116;netmask=255.255.255.0};eth1{ip_address=192.168.202.117;netmask=255.255.255.0};}
> >
> > or
> >
> > device {
> > eth0 {
> > ip_address=192.168.201.116
> > netmask=255.255.255.0
> > }
> > eth1 {
> > ip_address=192.168.202.117
> > netmask=255.255.255.0
> > }
> > }
> >
> > (same thing)
> >
> > nests better and is more readable and there is already a bunch of code
> > available to parse this format.
> >
> > The logic to parse this should be very easy.
>
> In a shell script? I don't think so. Not nearly as easy as one-device-per-line.
>
> Oh, and your way is inefficient - more lines to read, and a lot of wasted space.

I think you have some good arguments here, but efficiency and space
certainly isn't one of them. While I really like the more expanded
'brace style', some method of doing

grep $device | cut -f...

ie: shell scripts must still work. But, is

device=eth0;ip_address=....

really expressive enough? And what about if we add some option
to the proposed 'proc dump' utility, call it: -c for collapsed
output. Takes an argument that collapses all levels below the
argument to single lines.

Then we have:

pd -c 1 /proc/...

giving:

device {
eth0{ip_address=192.168.201.116 netmask=255.255.255.0}
eth1{ip_address=192.168.202.117 netmask=255.255.255.0}
}

All extraneous white space should be removed. This can be parsed
by a script.

It would seem that we also need some type of an api within the
kernel to create these types of files. It does not make sense for
every driver to have to know about these rules and dedicate the
amount of string space it takes to create them.

Mike

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:16 EST