Re: PROPOSAL: /proc/dev

James Mastros (root@jennifer-unix.dyn.ml.org)
Thu, 8 Jan 1998 19:05:02 -0500 (EST)


On Wed, 7 Jan 1998, Stephen Harris wrote:
> Robert Bihlmeyer (robbe@orcus.priv.at) wrote:
> : Perhaps there is a real use for scanning the /dev directory, and I
> : just can't think of one...
>
> Just off the top of my head...
>
> # get a list of the first sector of all the hard disks on my machine...
> # ignore device errors, since we don't have that device!
> # Many known bugs here, but none that affect the point I'm making!!!
> cd /dev
modprobe -t block -a
> for a in hd* sd* xd*
> do
> dd if=$a of=/tmp/$a bs=1 count=512 2>/dev/null
> done
>
> Now, I may have a SCSI disk that is not normally mounted (it could have
> a different OS on it), and so the sd.o module isn't loaded, and so sda
> doesn't exist under your scheme and so I will miss some data.
There. Your scheme now works.

> This is a specific example of a general case: *searching* the system for
> devices that are available, but not in use.
Right... In this special case, you need to manually load the drivers. If
you can think of a scheme where ls /dev gives useful results, and that
script works... Yeha, thats what I thought.

-=- James Mastros

-- 
  Agent K: A person is smart; people are dumb, panicky animals and you know
   it. Fifteen hundred years ago, everybody knew that the Earth was the
   center of the Universe.  Five hundred years ago, everybody knew that the
   Earth was flat.  Fifteen minutes ago, you knew that humans were alone on
   this planet.  Just think what you'll know tomorrow.

-=- Men In Black (1997, Paramount)