Re: What /proc should contain [was: /proc/driver/microcode]

From: Douglas Gilbert (dgilbert@interlog.com)
Date: Wed Mar 01 2000 - 00:29:56 EST


"Mark H. Wood" <mwood@IUPUI.Edu> said:

[...]

> But now look at that first line. Those tags must be fixed text or we get
> all the same old respelling problems. So why didn't we just have
>
> $ cat /proc/something/rate
> 12
> $ cat /proc/something/limit
> 45
> $ cat /proc/something/average
> 8.4
> $ cat /proc/something/eventname
> Some String
>
> I had to know that rate, limit, and average are numbers, and average is a
> float, and eventname is a string, in order to use them, so now the formats
> are irrelevant.

Here is an example that you may wish to comment on...

It is from the scsi generic driver (lk >= 2.3.43). Its
newly introduced "procfs" directory looks like this:
$ ls /proc/scsi/sg
debug device_hdr devices host_strs version
def_reserved_size device_strs host_hdr hosts

The 2 major abstractions in the scsi subsystem are hosts and
devices. There are potentially several of each with both numerical
and character data associated with each element:

$ cd /proc/scsi/sg
$ cat host_strs
AdvanSys SCSI 3.2M: ISA PnP 16 CDB: BIOS C800, IO 120/F, IRQ 10, DMA 7
AdvanSys SCSI 3.2M: PCI Ultra-Wide: BIOS D8000/7FFF, IO E400/3F, IRQ 11
SCSI host adapter emulation for IDE ATAPI devices
Iomega VPI2 (imm) interface

$ cat host_hdr hosts
uid busy cpl scatg isa emul
0 0 0 50 1 0
0 0 0 255 0 0
0 0 5 256 0 1
0 0 1 255 0 0

The first "cat" shows the host strings obtained from the drivers where
the line number corresponds to scsi0, scsi1, etc (or in devfs: host0,
host1, etc). The second "cat" first outputs a column header (host_hdr)
mainly for human consumption while 'hosts' outputs a line of numerical
data for each host.

The device data follows a similar pattern:
$ cat device_strs
YAMAHA CRW4416S 1.0g
IBM DCHS04U 2727
IOMEGA ZIP 100 P.05

$ cat device_hdr devices
host chan id lun type discon qdepth tq
0 0 6 0 5 0 4 0
1 0 0 0 0 0 63 0
3 0 6 0 0 0 1 0

The row numbers of devices correspond to sg0, sg1, etc [which are
also the minor device numbers]. Alternatively devfs refers to the
first row as: /dev/scsi/host0/bus0/target6/lun0/generic .

Perhaps the only other interesting thing here is the representation
of the version to aid decoding:
$ cat version
30112 Version: 3.1.12 (20000222)

There is a compromise here between human and machine readable forms.
Also changes (e.g. devfs renaming scsi channels and ids to buses and
targets respectively) can be accommodated without too much pain to
scripts trying to decode numerical information.

Doug Gilbert

-
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 : Tue Mar 07 2000 - 21:00:09 EST