]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
linux(4): Uniformly dev_t arguments translation
authorDmitry Chagin <dchagin@FreeBSD.org>
Fri, 28 Apr 2023 08:55:05 +0000 (11:55 +0300)
committerDmitry Chagin <dchagin@FreeBSD.org>
Fri, 28 Apr 2023 08:55:05 +0000 (11:55 +0300)
commit166e2e5a9e87d32dbfc7838903904673873f1e71
tree96518baa348361ea9c3f1f9fd78536cb86b70d19
parent994ed958ae0545faa86dd43b6e64bf7b64b9220b
linux(4): Uniformly dev_t arguments translation

The two main uses of dev_t are in struct stat and as a parameter of the
mknod system calls.
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity
with 12 bits set asaid for the major number and 20 for the minor number.
The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the
major number and m is a hex digit of the minor number.
The user-space dev_t encoded as mmmM MMmm, where M and m is the major
and minor numbers accordingly. This is downward compatible with legacy
systems where dev_t is 16 bits wide, encoded as MMmm.
In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers,
encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux
kernel and with legacy systems where dev_t is 16 bits wide.
In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers
are encoded as MMMmmmMm, therefore conversion of the device numbers between
Linux user-space and FreeBSD kernel required.
sys/compat/linux/linux.h
sys/compat/linux/linux_misc.c
sys/compat/linux/linux_stats.c
sys/compat/linux/linux_util.c