1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Device-number packing shared by every backend that stores an `rdev`.
//!
//! Linux's "new" `dev_t` layout (what `makedev(3)` in glibc produces) is the
//! interchange form: ext stores it verbatim in `i_block[0]`, and tar, HFS+
//! and the in-memory ramfs adopt the same word so a device node survives a
//! round trip between any two backends unchanged.
/// Encode a (major, minor) into the Linux "new" device-number layout used
/// in inode `i_block[0]` for character and block devices.
///
/// Layout (matches `makedev(3)` in glibc):
/// bits 0..7 minor[0..8]
/// bits 8..19 major[0..12]
/// bits 20..31 minor[8..20]
/// Inverse of [`encode_devnum`]. Pulls `(major, minor)` out of an
/// ext-style devnum word stored in `inode.block[0]`.