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
79 * ino_key_init - initialize inode key.
81 * @key: key to initialize
85 union ubifs_key *key, ino_t inum) in ino_key_init() argument
87 key->u32[0] = inum; in ino_key_init()
88 key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS; in ino_key_init()
92 * ino_key_init_flash - initialize on-flash inode key.
94 * @k: key to initialize
100 union ubifs_key *key = k; in ino_key_init_flash() local
102 key->j32[0] = cpu_to_le32(inum); in ino_key_init_flash()
103 key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS); in ino_key_init_flash()
108 * lowest_ino_key - get the lowest possible inode key.
110 * @key: key to initialize
114 union ubifs_key *key, ino_t inum) in lowest_ino_key() argument
116 key->u32[0] = inum; in lowest_ino_key()
117 key->u32[1] = 0; in lowest_ino_key()
121 * highest_ino_key - get the highest possible inode key.
123 * @key: key to initialize
127 union ubifs_key *key, ino_t inum) in highest_ino_key() argument
129 key->u32[0] = inum; in highest_ino_key()
130 key->u32[1] = 0xffffffff; in highest_ino_key()
134 * dent_key_init - initialize directory entry key.
136 * @key: key to initialize
141 union ubifs_key *key, ino_t inum, in dent_key_init() argument
147 key->u32[0] = inum; in dent_key_init()
148 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init()
152 * dent_key_init_hash - initialize directory entry key without re-calculating
155 * @key: key to initialize
160 union ubifs_key *key, ino_t inum, in dent_key_init_hash() argument
164 key->u32[0] = inum; in dent_key_init_hash()
165 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init_hash()
169 * dent_key_init_flash - initialize on-flash directory entry key.
171 * @k: key to initialize
178 union ubifs_key *key = k; in dent_key_init_flash() local
182 key->j32[0] = cpu_to_le32(inum); in dent_key_init_flash()
183 key->j32[1] = cpu_to_le32(hash | in dent_key_init_flash()
189 * lowest_dent_key - get the lowest possible directory entry key.
191 * @key: where to store the lowest key
195 union ubifs_key *key, ino_t inum) in lowest_dent_key() argument
197 key->u32[0] = inum; in lowest_dent_key()
198 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_dent_key()
202 * xent_key_init - initialize extended attribute entry key.
204 * @key: key to initialize
209 union ubifs_key *key, ino_t inum, in xent_key_init() argument
215 key->u32[0] = inum; in xent_key_init()
216 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS); in xent_key_init()
220 * xent_key_init_flash - initialize on-flash extended attribute entry key.
222 * @k: key to initialize
229 union ubifs_key *key = k; in xent_key_init_flash() local
233 key->j32[0] = cpu_to_le32(inum); in xent_key_init_flash()
234 key->j32[1] = cpu_to_le32(hash | in xent_key_init_flash()
240 * lowest_xent_key - get the lowest possible extended attribute entry key.
242 * @key: where to store the lowest key
246 union ubifs_key *key, ino_t inum) in lowest_xent_key() argument
248 key->u32[0] = inum; in lowest_xent_key()
249 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_xent_key()
253 * data_key_init - initialize data key.
255 * @key: key to initialize
260 union ubifs_key *key, ino_t inum, in data_key_init() argument
264 key->u32[0] = inum; in data_key_init()
265 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS); in data_key_init()
269 * highest_data_key - get the highest possible data key for an inode.
271 * @key: key to initialize
275 union ubifs_key *key, ino_t inum) in highest_data_key() argument
277 data_key_init(c, key, inum, UBIFS_S_KEY_BLOCK_MASK); in highest_data_key()
281 * trun_key_init - initialize truncation node key.
283 * @key: key to initialize
290 union ubifs_key *key, ino_t inum) in trun_key_init() argument
292 key->u32[0] = inum; in trun_key_init()
293 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS; in trun_key_init()
297 * invalid_key_init - initialize invalid node key.
299 * @key: key to initialize
301 * This is a helper function which marks a @key object as invalid.
304 union ubifs_key *key) in invalid_key_init() argument
306 key->u32[0] = 0xDEADBEAF; in invalid_key_init()
307 key->u32[1] = UBIFS_INVALID_KEY; in invalid_key_init()
311 * key_type - get key type.
313 * @key: key to get type of
316 const union ubifs_key *key) in key_type() argument
318 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; in key_type()
322 * key_type_flash - get type of a on-flash formatted key.
324 * @k: key to get type of
328 const union ubifs_key *key = k; in key_type_flash() local
330 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS; in key_type_flash()
334 * key_inum - fetch inode number from key.
336 * @k: key to fetch inode number from
340 const union ubifs_key *key = k; in key_inum() local
342 return key->u32[0]; in key_inum()
346 * key_inum_flash - fetch inode number from an on-flash formatted key.
348 * @k: key to fetch inode number from
352 const union ubifs_key *key = k; in key_inum_flash() local
354 return le32_to_cpu(key->j32[0]); in key_inum_flash()
360 * @key: the key to get hash from
363 const union ubifs_key *key) in key_hash() argument
365 return key->u32[1] & UBIFS_S_KEY_HASH_MASK; in key_hash()
369 * key_hash_flash - get directory entry hash from an on-flash formatted key.
371 * @k: the key to get hash from
375 const union ubifs_key *key = k; in key_hash_flash() local
377 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK; in key_hash_flash()
383 * @key: the key to get the block number from
386 const union ubifs_key *key) in key_block() argument
388 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK; in key_block()
392 * key_block_flash - get data block number from an on-flash formatted key.
394 * @k: the key to get the block number from
399 const union ubifs_key *key = k; in key_block_flash() local
401 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK; in key_block_flash()
405 * key_read - transform a key to in-memory format.
407 * @from: the key to transform
408 * @to: the key to store the result
420 * key_write - transform a key from in-memory format.
422 * @from: the key to transform
423 * @to: the key to store the result
436 * key_write_idx - transform a key from in-memory format for the index.
438 * @from: the key to transform
439 * @to: the key to store the result
451 * key_copy - copy a key.
453 * @from: the key to copy from
454 * @to: the key to copy to
465 * @key1: the first key to compare
466 * @key2: the second key to compare
490 * @key1: the first key to compare
491 * @key2: the second key to compare
508 * is_hash_key - is a key vulnerable to hash collisions.
510 * @key: key
512 * This function returns %1 if @key is a hashed key or %0 otherwise.
515 const union ubifs_key *key) in is_hash_key() argument
517 int type = key_type(c, key); in is_hash_key()
523 * key_max_inode_size - get maximum file size allowed by current key format.