Skip to content

Commit

Permalink
Add makedev, major, minor fn's
Browse files Browse the repository at this point in the history
  • Loading branch information
flba-eb committed Jun 14, 2023
1 parent 28673d6 commit c0683f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/unix/nto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,14 @@ f! {
};
::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
}

pub fn major(dev: ::dev_t) -> ::c_uint {
((dev as ::c_uint) >> 10) & 0x3f
}

pub fn minor(dev: ::dev_t) -> ::c_uint {
(dev as ::c_uint) & 0x3ff
}
}

safe_f! {
Expand Down Expand Up @@ -2847,6 +2855,10 @@ safe_f! {
pub {const} fn IPTOS_ECN(x: u8) -> u8 {
x & ::IPTOS_ECN_MASK
}

pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
((major << 10) | (minor)) as ::dev_t
}
}

// Network related functions are provided by libsocket and regex
Expand Down

0 comments on commit c0683f0

Please sign in to comment.