| 1 | |
| 2 |
|
| 3 | |
| 4 |
|
| 5 | #[cfg(not(test))]
|
| 6 | #[cfg(not(testlib))]
|
| 7 | mod allocator;
|
| 8 | pub mod box_ext;
|
| 9 | pub mod vec_ext;
|
| 10 |
|
| 11 | |
| 12 | #[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
| 13 | pub struct AllocError;
|
| 14 |
|
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | #[derive(Clone, Copy)]
|
| 21 | pub struct Flags(u32);
|
| 22 |
|
| 23 | impl Flags {
|
| 24 | |
| 25 | pub(crate) fn as_raw(self) -> u32 {
|
| 26 | self.0
|
| 27 | }
|
| 28 | }
|
| 29 |
|
| 30 | impl core::ops::BitOr for Flags {
|
| 31 | type Output = Self;
|
| 32 | fn bitor(self, rhs: Self) -> Self::Output {
|
| 33 | Self(self.0 | rhs.0)
|
| 34 | }
|
| 35 | }
|
| 36 |
|
| 37 | impl core::ops::BitAnd for Flags {
|
| 38 | type Output = Self;
|
| 39 | fn bitand(self, rhs: Self) -> Self::Output {
|
| 40 | Self(self.0 & rhs.0)
|
| 41 | }
|
| 42 | }
|
| 43 |
|
| 44 | impl core::ops::Not for Flags {
|
| 45 | type Output = Self;
|
| 46 | fn not(self) -> Self::Output {
|
| 47 | Self(!self.0)
|
| 48 | }
|
| 49 | }
|
| 50 |
|
| 51 | |
| 52 | |
| 53 | |
| 54 | pub mod flags {
|
| 55 | use super::Flags;
|
| 56 |
|
| 57 | |
| 58 | |
| 59 | |
| 60 | pub const __GFP_ZERO: Flags = Flags(bindings::__GFP_ZERO);
|
| 61 |
|
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | pub const __GFP_HIGHMEM: Flags = Flags(bindings::__GFP_HIGHMEM);
|
| 69 |
|
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | pub const GFP_ATOMIC: Flags = Flags(bindings::GFP_ATOMIC);
|
| 76 |
|
| 77 | |
| 78 | |
| 79 | pub const GFP_KERNEL: Flags = Flags(bindings::GFP_KERNEL);
|
| 80 |
|
| 81 | |
| 82 | pub const GFP_KERNEL_ACCOUNT: Flags = Flags(bindings::GFP_KERNEL_ACCOUNT);
|
| 83 |
|
| 84 | |
| 85 | |
| 86 | |
| 87 | pub const GFP_NOWAIT: Flags = Flags(bindings::GFP_NOWAIT);
|
| 88 | }
|