Lines Matching refs: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)
93 key->u32[0] = inum;
94 key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS;
98 * ino_key_init_flash - initialize on-flash inode key.
100 * @k: key to initialize
106 union ubifs_key *key = k;
108 key->j32[0] = cpu_to_le32(inum);
109 key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS);
114 * lowest_ino_key - get the lowest possible inode key.
116 * @key: key to initialize
120 union ubifs_key *key, ino_t inum)
122 key->u32[0] = inum;
123 key->u32[1] = 0;
127 * highest_ino_key - get the highest possible inode key.
129 * @key: key to initialize
133 union ubifs_key *key, ino_t inum)
135 key->u32[0] = inum;
136 key->u32[1] = 0xffffffff;
140 * dent_key_init - initialize directory entry key.
142 * @key: key to initialize
147 union ubifs_key *key, ino_t inum,
153 key->u32[0] = inum;
154 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS);
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,
170 key->u32[0] = inum;
171 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS);
175 * dent_key_init_flash - initialize on-flash directory entry key.
177 * @k: key to initialize
185 union ubifs_key *key = k;
189 key->j32[0] = cpu_to_le32(inum);
190 key->j32[1] = cpu_to_le32(hash |
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)
204 key->u32[0] = inum;
205 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS;
209 * xent_key_init - initialize extended attribute entry key.
211 * @key: key to initialize
216 union ubifs_key *key, ino_t inum,
222 key->u32[0] = inum;
223 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS);
227 * xent_key_init_flash - initialize on-flash extended attribute entry key.
229 * @k: key to initialize
236 union ubifs_key *key = k;
240 key->j32[0] = cpu_to_le32(inum);
241 key->j32[1] = cpu_to_le32(hash |
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)
255 key->u32[0] = inum;
256 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS;
260 * data_key_init - initialize data key.
262 * @key: key to initialize
267 union ubifs_key *key, ino_t inum,
271 key->u32[0] = inum;
272 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS);
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)
284 data_key_init(c, key, inum, UBIFS_S_KEY_BLOCK_MASK);
288 * trun_key_init - initialize truncation node key.
290 * @key: key to initialize
297 union ubifs_key *key, ino_t inum)
299 key->u32[0] = inum;
300 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS;
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)
313 key->u32[0] = 0xDEADBEAF;
314 key->u32[1] = UBIFS_INVALID_KEY;
318 * key_type - get key type.
320 * @key: key to get type of
323 const union ubifs_key *key)
325 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS;
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;
337 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS;
341 * key_inum - fetch inode number from key.
343 * @k: key to fetch inode number from
347 const union ubifs_key *key = k;
349 return key->u32[0];
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;
361 return le32_to_cpu(key->j32[0]);
367 * @key: the key to get hash from
370 const union ubifs_key *key)
372 return key->u32[1] & UBIFS_S_KEY_HASH_MASK;
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;
384 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK;
390 * @key: the key to get the block number from
393 const union ubifs_key *key)
395 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK;
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;
408 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK;
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)
524 int type = key_type(c, key);
530 * key_max_inode_size - get maximum file size allowed by current key format.