devfs
[Top] [All Lists]

devfs and device name persistance

To: devfs@xxxxxxxxxxx
Subject: devfs and device name persistance
From: Johannes Erdfelt <jerdfelt@xxxxxxxxxxx>
Date: Mon, 8 May 2000 22:19:45 -0700
Sender: owner-devfs@xxxxxxxxxxx
With more and more Hot Swap device busses becoming common, naming of devices
is starting to become a problem.

As an example, I'll use 2 USB floppy drives. Since they are floppy drives,
the media and thusly filesystems can change frequently.

This makes existing emerging userspace only solutions lacking in
functionality. The current favored scheme which falls into the previous
group is mounting filesystems based on UUID. ext2 and mount(8) supports
this.

When I plug the first USB floppy drive ("floppy A") in, I would like it to
always appear at one name in the filesystem. I will use the arbitrary
filename /dev/floppy0. The second USB floppy drive ("floppy B") I would
always like to appear at /dev/floppy1.

With the current implementation in Linux, floppy drives are numbered on
a first come first served basis. If floppy A is plugged in first, it
will be called /dev/fd0 (actually, most USB floppies are SCSI devices
and would thusly be called /dev/sda, but for simplicity we ignore this).
Then if floppy B is plugged after floppy A, it is called /dev/fd1.

However, if floppy B is plugged in first, it will be named /dev/fd0.

This causes problems with USB, and other hot swap busses, because the order
of devices being connected, is effectively random.

The first problem is being able to differentiate between similar devices.
USB has the notion of a serial number, however not all devices provide
one. Most storage devices do however, which is the reason I'm using
floppies as my example.

Now that we have a unique way of differentiating 2 seemingly identical
devices, our next problem is how to store this information. This is
where devfsd comes in. I'd like to use devfsd to track this information.
How it does this is not too important right now.

The last problem is name space conflict.

There may be a real device called /dev/floppy0. A possible solution that
has been discussed is to mount the devfs filesystem on /devices (completely
aribtrary name) and create symlinks between the virtual names on /dev
to the physical names on /devices.

What I'd like to get is some opinions on this. I have a reservation towards
putting so much into devfsd. I fear it may become too complicated.

There's obviously some unknowns and I'd like to pursue an implementation
to try it out and see if there are some unforseen problems, but I'd like
to see if anyone else has any better ideas or any problems.

Also, not all devices can be differentiated. However, we can do some
things. For instance, we can determine which port a device is plugged into
and create a topology tree. This way, we can differentiate 2 mice.
However, if the device is moved to another port, the mouse would be "new".

JE


<Prev in Thread] Current Thread [Next in Thread>