~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/rust/kernel/alloc.rs

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /rust/kernel/alloc.rs (Version linux-6.12-rc7) and /rust/kernel/alloc.rs (Version linux-4.18.20)


  1 // SPDX-License-Identifier: GPL-2.0               
  2                                                   
  3 //! Extensions to the [`alloc`] crate.            
  4                                                   
  5 #[cfg(not(test))]                                 
  6 #[cfg(not(testlib))]                              
  7 mod allocator;                                    
  8 pub mod box_ext;                                  
  9 pub mod vec_ext;                                  
 10                                                   
 11 /// Indicates an allocation error.                
 12 #[derive(Copy, Clone, PartialEq, Eq, Debug)]      
 13 pub struct AllocError;                            
 14                                                   
 15 /// Flags to be used when allocating memory.      
 16 ///                                               
 17 /// They can be combined with the operators `|    
 18 ///                                               
 19 /// Values can be used from the [`flags`] modu    
 20 #[derive(Clone, Copy)]                            
 21 pub struct Flags(u32);                            
 22                                                   
 23 impl Flags {                                      
 24     /// Get the raw representation of this fla    
 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 /// Allocation flags.                             
 52 ///                                               
 53 /// These are meant to be used in functions th    
 54 pub mod flags {                                   
 55     use super::Flags;                             
 56                                                   
 57     /// Zeroes out the allocated memory.          
 58     ///                                           
 59     /// This is normally or'd with other flags    
 60     pub const __GFP_ZERO: Flags = Flags(bindin    
 61                                                   
 62     /// Allow the allocation to be in high mem    
 63     ///                                           
 64     /// Allocations in high memory may not be     
 65     /// be used with `kmalloc` and other simil    
 66     ///                                           
 67     /// This is normally or'd with other flags    
 68     pub const __GFP_HIGHMEM: Flags = Flags(bin    
 69                                                   
 70     /// Users can not sleep and need the alloc    
 71     ///                                           
 72     /// A lower watermark is applied to allow     
 73     /// implementation doesn't support NMI and    
 74     /// raw_spin_lock). The same applies to [`    
 75     pub const GFP_ATOMIC: Flags = Flags(bindin    
 76                                                   
 77     /// Typical for kernel-internal allocation    
 78     /// for direct access but can direct recla    
 79     pub const GFP_KERNEL: Flags = Flags(bindin    
 80                                                   
 81     /// The same as [`GFP_KERNEL`], except the    
 82     pub const GFP_KERNEL_ACCOUNT: Flags = Flag    
 83                                                   
 84     /// For kernel allocations that should not    
 85     /// use any filesystem callback.  It is ve    
 86     /// small allocations.                        
 87     pub const GFP_NOWAIT: Flags = Flags(bindin    
 88 }                                                 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php