Lines Matching full:key

12  * This header contains various key-related definitions and helper function.
13 * UBIFS allows several key schemes, so we access key fields only via these
14 * helpers. At the moment only one key scheme is supported.
16 * Simple key scheme
20 * in case of direntry key). Next 3 bits are node type. The last 29 bits are
26 * Lot's of the key helpers require a struct ubifs_info *c as the first parameter.
28 * different c->key_format. But right now, there is only one key type, UBIFS_SIMPLE_KEY_FMT.
85 * ino_key_init - initialize inode key.
87 * @key: key to initialize
91 union ubifs_key *key, ino_t inum) in ino_key_init() argument
93 key->u32[0] = inum; in ino_key_init()
94 key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS; in ino_key_init()
98 * ino_key_init_flash - initialize on-flash inode key.
100 * @k: key to initialize
106 union ubifs_key *key = k; in ino_key_init_flash() local
108 key->j32[0] = cpu_to_le32(inum); in ino_key_init_flash()
109 key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS); in ino_key_init_flash()
114 * lowest_ino_key - get the lowest possible inode key.
116 * @key: key to initialize
120 union ubifs_key *key, ino_t inum) in lowest_ino_key() argument
122 key->u32[0] = inum; in lowest_ino_key()
123 key->u32[1] = 0; in lowest_ino_key()
127 * highest_ino_key - get the highest possible inode key.
129 * @key: key to initialize
133 union ubifs_key *key, ino_t inum) in highest_ino_key() argument
135 key->u32[0] = inum; in highest_ino_key()
136 key->u32[1] = 0xffffffff; in highest_ino_key()
140 * dent_key_init - initialize directory entry key.
142 * @key: key to initialize
147 union ubifs_key *key, ino_t inum, in dent_key_init() argument
153 key->u32[0] = inum; in dent_key_init()
154 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init()
158 * dent_key_init_hash - initialize directory entry key without re-calculating
161 * @key: key to initialize
166 union ubifs_key *key, ino_t inum, in dent_key_init_hash() argument
170 key->u32[0] = inum; in dent_key_init_hash()
171 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init_hash()
175 * dent_key_init_flash - initialize on-flash directory entry key.
177 * @k: key to initialize
185 union ubifs_key *key = k; in dent_key_init_flash() local
189 key->j32[0] = cpu_to_le32(inum); in dent_key_init_flash()
190 key->j32[1] = cpu_to_le32(hash | in dent_key_init_flash()
196 * lowest_dent_key - get the lowest possible directory entry key.
198 * @key: where to store the lowest key
202 union ubifs_key *key, ino_t inum) in lowest_dent_key() argument
204 key->u32[0] = inum; in lowest_dent_key()
205 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_dent_key()
209 * xent_key_init - initialize extended attribute entry key.
211 * @key: key to initialize
216 union ubifs_key *key, ino_t inum, in xent_key_init() argument
222 key->u32[0] = inum; in xent_key_init()
223 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS); in xent_key_init()
227 * xent_key_init_flash - initialize on-flash extended attribute entry key.
229 * @k: key to initialize
236 union ubifs_key *key = k; in xent_key_init_flash() local
240 key->j32[0] = cpu_to_le32(inum); in xent_key_init_flash()
241 key->j32[1] = cpu_to_le32(hash | in xent_key_init_flash()
247 * lowest_xent_key - get the lowest possible extended attribute entry key.
249 * @key: where to store the lowest key
253 union ubifs_key *key, ino_t inum) in lowest_xent_key() argument
255 key->u32[0] = inum; in lowest_xent_key()
256 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_xent_key()
260 * data_key_init - initialize data key.
262 * @key: key to initialize
267 union ubifs_key *key, ino_t inum, in data_key_init() argument
271 key->u32[0] = inum; in data_key_init()
272 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS); in data_key_init()
276 * highest_data_key - get the highest possible data key for an inode.
278 * @key: key to initialize
282 union ubifs_key *key, ino_t inum) in highest_data_key() argument
284 data_key_init(c, key, inum, UBIFS_S_KEY_BLOCK_MASK); in highest_data_key()
288 * trun_key_init - initialize truncation node key.
290 * @key: key to initialize
297 union ubifs_key *key, ino_t inum) in trun_key_init() argument
299 key->u32[0] = inum; in trun_key_init()
300 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS; in trun_key_init()
304 * invalid_key_init - initialize invalid node key.
306 * @key: key to initialize
308 * This is a helper function which marks a @key object as invalid.
311 union ubifs_key *key) in invalid_key_init() argument
313 key->u32[0] = 0xDEADBEAF; in invalid_key_init()
314 key->u32[1] = UBIFS_INVALID_KEY; in invalid_key_init()
318 * key_type - get key type.
320 * @key: key to get type of
323 const union ubifs_key *key) in key_type() argument
325 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; in key_type()
329 * key_type_flash - get type of a on-flash formatted key.
331 * @k: key to get type of
335 const union ubifs_key *key = k; in key_type_flash() local
337 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS; in key_type_flash()
341 * key_inum - fetch inode number from key.
343 * @k: key to fetch inode number from
347 const union ubifs_key *key = k; in key_inum() local
349 return key->u32[0]; in key_inum()
353 * key_inum_flash - fetch inode number from an on-flash formatted key.
355 * @k: key to fetch inode number from
359 const union ubifs_key *key = k; in key_inum_flash() local
361 return le32_to_cpu(key->j32[0]); in key_inum_flash()
367 * @key: the key to get hash from
370 const union ubifs_key *key) in key_hash() argument
372 return key->u32[1] & UBIFS_S_KEY_HASH_MASK; in key_hash()
376 * key_hash_flash - get directory entry hash from an on-flash formatted key.
378 * @k: the key to get hash from
382 const union ubifs_key *key = k; in key_hash_flash() local
384 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK; in key_hash_flash()
390 * @key: the key to get the block number from
393 const union ubifs_key *key) in key_block() argument
395 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK; in key_block()
399 * key_block_flash - get data block number from an on-flash formatted key.
401 * @k: the key to get the block number from
406 const union ubifs_key *key = k; in key_block_flash() local
408 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK; in key_block_flash()
412 * key_read - transform a key to in-memory format.
414 * @from: the key to transform
415 * @to: the key to store the result
427 * key_write - transform a key from in-memory format.
429 * @from: the key to transform
430 * @to: the key to store the result
443 * key_write_idx - transform a key from in-memory format for the index.
445 * @from: the key to transform
446 * @to: the key to store the result
458 * key_copy - copy a key.
460 * @from: the key to copy from
461 * @to: the key to copy to
472 * @key1: the first key to compare
473 * @key2: the second key to compare
497 * @key1: the first key to compare
498 * @key2: the second key to compare
515 * is_hash_key - is a key vulnerable to hash collisions.
517 * @key: key
519 * This function returns %1 if @key is a hashed key or %0 otherwise.
522 const union ubifs_key *key) in is_hash_key() argument
524 int type = key_type(c, key); in is_hash_key()
530 * key_max_inode_size - get maximum file size allowed by current key format.