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

TOMOYO Linux Cross Reference
Linux/tools/include/linux/find.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/include/linux/find.h (Version linux-6.11.5) and /tools/include/linux/find.h (Version linux-4.20.17)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _TOOLS_LINUX_FIND_H_                      
  3 #define _TOOLS_LINUX_FIND_H_                      
  4                                                   
  5 #ifndef _TOOLS_LINUX_BITMAP_H                     
  6 #error tools: only <linux/bitmap.h> can be inc    
  7 #endif                                            
  8                                                   
  9 #include <linux/bitops.h>                         
 10                                                   
 11 unsigned long _find_next_bit(const unsigned lo    
 12                                 unsigned long     
 13 unsigned long _find_next_and_bit(const unsigne    
 14                                         unsign    
 15 unsigned long _find_next_zero_bit(const unsign    
 16                                          unsig    
 17 extern unsigned long _find_first_bit(const uns    
 18 extern unsigned long _find_first_and_bit(const    
 19                                          const    
 20 extern unsigned long _find_first_zero_bit(cons    
 21                                                   
 22 #ifndef find_next_bit                             
 23 /**                                               
 24  * find_next_bit - find the next set bit in a     
 25  * @addr: The address to base the search on       
 26  * @size: The bitmap size in bits                 
 27  * @offset: The bitnumber to start searching a    
 28  *                                                
 29  * Returns the bit number for the next set bit    
 30  * If no bits are set, returns @size.             
 31  */                                               
 32 static inline                                     
 33 unsigned long find_next_bit(const unsigned lon    
 34                             unsigned long offs    
 35 {                                                 
 36         if (small_const_nbits(size)) {            
 37                 unsigned long val;                
 38                                                   
 39                 if (unlikely(offset >= size))     
 40                         return size;              
 41                                                   
 42                 val = *addr & GENMASK(size - 1    
 43                 return val ? __ffs(val) : size    
 44         }                                         
 45                                                   
 46         return _find_next_bit(addr, size, offs    
 47 }                                                 
 48 #endif                                            
 49                                                   
 50 #ifndef find_next_and_bit                         
 51 /**                                               
 52  * find_next_and_bit - find the next set bit i    
 53  * @addr1: The first address to base the searc    
 54  * @addr2: The second address to base the sear    
 55  * @size: The bitmap size in bits                 
 56  * @offset: The bitnumber to start searching a    
 57  *                                                
 58  * Returns the bit number for the next set bit    
 59  * If no bits are set, returns @size.             
 60  */                                               
 61 static inline                                     
 62 unsigned long find_next_and_bit(const unsigned    
 63                 const unsigned long *addr2, un    
 64                 unsigned long offset)             
 65 {                                                 
 66         if (small_const_nbits(size)) {            
 67                 unsigned long val;                
 68                                                   
 69                 if (unlikely(offset >= size))     
 70                         return size;              
 71                                                   
 72                 val = *addr1 & *addr2 & GENMAS    
 73                 return val ? __ffs(val) : size    
 74         }                                         
 75                                                   
 76         return _find_next_and_bit(addr1, addr2    
 77 }                                                 
 78 #endif                                            
 79                                                   
 80 #ifndef find_next_zero_bit                        
 81 /**                                               
 82  * find_next_zero_bit - find the next cleared     
 83  * @addr: The address to base the search on       
 84  * @size: The bitmap size in bits                 
 85  * @offset: The bitnumber to start searching a    
 86  *                                                
 87  * Returns the bit number of the next zero bit    
 88  * If no bits are zero, returns @size.            
 89  */                                               
 90 static inline                                     
 91 unsigned long find_next_zero_bit(const unsigne    
 92                                  unsigned long    
 93 {                                                 
 94         if (small_const_nbits(size)) {            
 95                 unsigned long val;                
 96                                                   
 97                 if (unlikely(offset >= size))     
 98                         return size;              
 99                                                   
100                 val = *addr | ~GENMASK(size -     
101                 return val == ~0UL ? size : ff    
102         }                                         
103                                                   
104         return _find_next_zero_bit(addr, size,    
105 }                                                 
106 #endif                                            
107                                                   
108 #ifndef find_first_bit                            
109 /**                                               
110  * find_first_bit - find the first set bit in     
111  * @addr: The address to start the search at      
112  * @size: The maximum number of bits to search    
113  *                                                
114  * Returns the bit number of the first set bit    
115  * If no bits are set, returns @size.             
116  */                                               
117 static inline                                     
118 unsigned long find_first_bit(const unsigned lo    
119 {                                                 
120         if (small_const_nbits(size)) {            
121                 unsigned long val = *addr & GE    
122                                                   
123                 return val ? __ffs(val) : size    
124         }                                         
125                                                   
126         return _find_first_bit(addr, size);       
127 }                                                 
128 #endif                                            
129                                                   
130 #ifndef find_first_and_bit                        
131 /**                                               
132  * find_first_and_bit - find the first set bit    
133  * @addr1: The first address to base the searc    
134  * @addr2: The second address to base the sear    
135  * @size: The bitmap size in bits                 
136  *                                                
137  * Returns the bit number for the next set bit    
138  * If no bits are set, returns @size.             
139  */                                               
140 static inline                                     
141 unsigned long find_first_and_bit(const unsigne    
142                                  const unsigne    
143                                  unsigned long    
144 {                                                 
145         if (small_const_nbits(size)) {            
146                 unsigned long val = *addr1 & *    
147                                                   
148                 return val ? __ffs(val) : size    
149         }                                         
150                                                   
151         return _find_first_and_bit(addr1, addr    
152 }                                                 
153 #endif                                            
154                                                   
155 #ifndef find_first_zero_bit                       
156 /**                                               
157  * find_first_zero_bit - find the first cleare    
158  * @addr: The address to start the search at      
159  * @size: The maximum number of bits to search    
160  *                                                
161  * Returns the bit number of the first cleared    
162  * If no bits are zero, returns @size.            
163  */                                               
164 static inline                                     
165 unsigned long find_first_zero_bit(const unsign    
166 {                                                 
167         if (small_const_nbits(size)) {            
168                 unsigned long val = *addr | ~G    
169                                                   
170                 return val == ~0UL ? size : ff    
171         }                                         
172                                                   
173         return _find_first_zero_bit(addr, size    
174 }                                                 
175 #endif                                            
176                                                   
177 #endif /*__LINUX_FIND_H_ */                       
178                                                   

~ [ 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