Re: [RFC][5/11][MANUX] Kernel compatibility : major/minor numbers

From: One Thousand Gnomes
Date: Tue Apr 15 2014 - 11:40:53 EST


> Why is it? I mean, as far as userspace is concerned, they do have a
> unique identifier : their name. How would it be problematic that the

No - a name is never a unique identifier in a Unix system. The
fundamental object is the file handle. If I want to be able to answer the
question

"are these two file handles pointing to the same device"

I need the major/minor to do so. Even if I know the name I don't know if
two opens of the same name produced references to the same object,
because another process may have changed it under me.

Most code doesn't care. You can happily replace /dev/null with something
else (or accidentally make it a file and then a year later wonder why
your disk is full).

Names are very much second class citizens. An object can have a file
handle without a name, or with many names

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