Re: difference between user space and kernel space dev_t structs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  that means that's what exported to user space in the file
> /usr/include/linux/kdev_t.h is the *old* format.  so what's the value
> of that?  what's the point of having macros in user space that don't
> match the actual structure of a kernel space device file identifier?

There is a little bit more involved in handling user space/kernel
space device identifiers. Indeed you have an kernel representation
where the bits are distributed as follows (M = major, m = minor, 1
letter represents 4 bits):

mmmmmMMM

And a "compatibility" interface that needs to expose the bits as

mmMM

Which is clearly not compatible with the internal representation, plus
you would lose bits anyway. However, look at the rest of the file,
especially the new_encode_dev and new_decode_dev inline functions.
Their job is to convert the internal representation into a third form
which is the one that is actually used in the user side and looks like
this:

mmMMMmmm

So legacy device files made of only the first 16 bits of dev_t still
fit into this representation, while newer device files that need more
than 256 minor numbers can also take advantage of the additional bits.

Alex.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux