]> 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>
Thu, 29 Jun 2023 08:15:49 +0000 (11:15 +0300)
commit5e424fec72aafe1154ae23cd0674193e757a4d2a
tree71e9a04f94564d53463fb2872bf8d5f84dbd926c
parentb971d6aec11597dfdad36a53680c869062b7ba64
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.

(cherry picked from commit 166e2e5a9e87d32dbfc7838903904673873f1e71)
sys/compat/linux/linux.h
sys/compat/linux/linux_misc.c
sys/compat/linux/linux_stats.c
sys/compat/linux/linux_util.c