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
154 key->u32[0] = inum; in dent_key_init()
155 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init()
159 * dent_key_init_hash - initialize directory entry key without re-calculating
162 * @key: key to initialize
167 union ubifs_key *key, ino_t inum, in dent_key_init_hash() argument
171 key->u32[0] = inum; in dent_key_init_hash()
172 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init_hash()
176 * dent_key_init_flash - initialize on-flash directory entry key.
178 * @k: key to initialize
186 union ubifs_key *key = k; in dent_key_init_flash() local
190 key->j32[0] = cpu_to_le32(inum); in dent_key_init_flash()
191 key->j32[1] = cpu_to_le32(hash | in dent_key_init_flash()
197 * lowest_dent_key - get the lowest possible directory entry key.
199 * @key: where to store the lowest key
203 union ubifs_key *key, ino_t inum) in lowest_dent_key() argument
205 key->u32[0] = inum; in lowest_dent_key()
206 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_dent_key()
210 * xent_key_init - initialize extended attribute entry key.
212 * @key: key to initialize
217 union ubifs_key *key, ino_t inum, in xent_key_init() argument
223 key->u32[0] = inum; in xent_key_init()
224 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS); in xent_key_init()
228 * xent_key_init_flash - initialize on-flash extended attribute entry key.
230 * @k: key to initialize
237 union ubifs_key *key = k; in xent_key_init_flash() local
241 key->j32[0] = cpu_to_le32(inum); in xent_key_init_flash()
242 key->j32[1] = cpu_to_le32(hash | in xent_key_init_flash()
248 * lowest_xent_key - get the lowest possible extended attribute entry key.
250 * @key: where to store the lowest key
254 union ubifs_key *key, ino_t inum) in lowest_xent_key() argument
256 key->u32[0] = inum; in lowest_xent_key()
257 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_xent_key()
261 * data_key_init - initialize data key.
263 * @key: key to initialize
268 union ubifs_key *key, ino_t inum, in data_key_init() argument
272 key->u32[0] = inum; in data_key_init()
273 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS); in data_key_init()
277 * highest_data_key - get the highest possible data key for an inode.
279 * @key: key to initialize
283 union ubifs_key *key, ino_t inum) in highest_data_key() argument
285 data_key_init(c, key, inum, UBIFS_S_KEY_BLOCK_MASK); in highest_data_key()
289 * trun_key_init - initialize truncation node key.
291 * @key: key to initialize
298 union ubifs_key *key, ino_t inum) in trun_key_init() argument
300 key->u32[0] = inum; in trun_key_init()
301 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS; in trun_key_init()
305 * invalid_key_init - initialize invalid node key.
307 * @key: key to initialize
309 * This is a helper function which marks a @key object as invalid.
312 union ubifs_key *key) in invalid_key_init() argument
314 key->u32[0] = 0xDEADBEAF; in invalid_key_init()
315 key->u32[1] = UBIFS_INVALID_KEY; in invalid_key_init()
319 * key_type - get key type.
321 * @key: key to get type of
324 const union ubifs_key *key) in key_type() argument
326 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; in key_type()
330 * key_type_flash - get type of a on-flash formatted key.
332 * @k: key to get type of
336 const union ubifs_key *key = k; in key_type_flash() local
338 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS; in key_type_flash()
342 * key_inum - fetch inode number from key.
344 * @k: key to fetch inode number from
348 const union ubifs_key *key = k; in key_inum() local
350 return key->u32[0]; in key_inum()
354 * key_inum_flash - fetch inode number from an on-flash formatted key.
356 * @k: key to fetch inode number from
360 const union ubifs_key *key = k; in key_inum_flash() local
362 return le32_to_cpu(key->j32[0]); in key_inum_flash()
368 * @key: the key to get hash from
371 const union ubifs_key *key) in key_hash() argument
373 return key->u32[1] & UBIFS_S_KEY_HASH_MASK; in key_hash()
377 * key_hash_flash - get directory entry hash from an on-flash formatted key.
379 * @k: the key to get hash from
383 const union ubifs_key *key = k; in key_hash_flash() local
385 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK; in key_hash_flash()
391 * @key: the key to get the block number from
394 const union ubifs_key *key) in key_block() argument
396 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK; in key_block()
400 * key_block_flash - get data block number from an on-flash formatted key.
402 * @k: the key to get the block number from
407 const union ubifs_key *key = k; in key_block_flash() local
409 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK; in key_block_flash()
413 * key_read - transform a key to in-memory format.
415 * @from: the key to transform
416 * @to: the key to store the result
428 * key_write - transform a key from in-memory format.
430 * @from: the key to transform
431 * @to: the key to store the result
444 * key_write_idx - transform a key from in-memory format for the index.
446 * @from: the key to transform
447 * @to: the key to store the result
459 * key_copy - copy a key.
461 * @from: the key to copy from
462 * @to: the key to copy to
473 * @key1: the first key to compare
474 * @key2: the second key to compare
498 * @key1: the first key to compare
499 * @key2: the second key to compare
516 * is_hash_key - is a key vulnerable to hash collisions.
518 * @key: key
520 * This function returns %1 if @key is a hashed key or %0 otherwise.
523 const union ubifs_key *key) in is_hash_key() argument
525 int type = key_type(c, key); in is_hash_key()
531 * key_max_inode_size - get maximum file size allowed by current key format.