On 07/06/2013 06:12, Chris Stankevitz wrote:
> Hello,
> 
> A USB serial device is identified by the characters "/dev/ttyUSB0".
> One might call this string a "device on your filesystem" and it can be
> opened/closed just like any other entry in the filesystem.
> 
> An ethernet device is sometimes represented by the string "eth0".
> Regarding this string "eth0":
> 
> 1. What does this string represent?  Is it a file on a filesystem?
> (no!)  Is it okay for me to call it an "ethernet *device*"

It's just a name. Your name is Chris, mine is Alan and it's is eth0.

We usually just call it an interface
> 
> 2. Assuming udev is not running, who/what comes up with the name
> "eth0"?  How does that person/thing know how many ethernet devices
> there are and in what order to enumerate them?  What happens if
> ethernet devices are dynamically added (e.g. a USB ethernet device or
> a driver being loaded/unloaded)?

The kernel driver gives it that name based on what it finds when it
probes your hardware. Kernel drivers strives for some form of
consistency in picking names, but the order they are found in is
somewhat random-ish. This means you cannot guarantee that the number on
the end is always going to be the same every boot - hardware just does
not work that way

When you hotplug a device, the driver does what it's coded to do -
usually assign the next available number. There is no guarantee all
drivers will always do this always - it's by convention
> 
> 3. How does (2) change when udev is running?

Depends.

If you like the kernel naming scheme and want to keep it, just tell udev
to not fiddle with names and keep them as they are.

If you like the way udev does things and want to go with it's scheme,
follow recent recommendations on this list. udev will rename the
interfaces to it's own scheme based on the rules you set up.

What you CANNOT do with udev is eg switch the names eth0 and eth1 around
after the kernel has named them. That was tried for years, it doesn't
work. So now udev never interferes with kernel namespace, it create it's
own namespace

For more info, research this list going back about 4 months. The whole
topic was discussed at length. Search for "udev persistent names". A
word of warning - it wasn't pretty at the time and nothing changed just
becuase those mails are now archived :-)



-- 
Alan McKinnon
alan.mckin...@gmail.com


Reply via email to