Lines Matching +full:block +full:- +full:fetch
4 * Copyright (C) 2006-2008 Nokia Corporation.
17 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 * This header contains various key-related definitions and helper function.
31 * Keys are 64-bits long. First 32-bits are inode number (parent inode number
40 * different c->key_format. But right now, there is only one key type, UBIFS_SIMPLE_KEY_FMT.
47 * key_mask_hash - mask a valid hash value.
63 * key_r5_hash - R5 hash function (borrowed from reiserfs).
72 while (len--) { in key_r5_hash()
83 * key_test_hash - testing hash function.
97 * ino_key_init - initialize inode key.
98 * @c: UBIFS file-system description object
105 key->u32[0] = inum; in ino_key_init()
106 key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS; in ino_key_init()
110 * ino_key_init_flash - initialize on-flash inode key.
111 * @c: UBIFS file-system description object
120 key->j32[0] = cpu_to_le32(inum); in ino_key_init_flash()
121 key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS); in ino_key_init_flash()
122 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in ino_key_init_flash()
126 * lowest_ino_key - get the lowest possible inode key.
127 * @c: UBIFS file-system description object
134 key->u32[0] = inum; in lowest_ino_key()
135 key->u32[1] = 0; in lowest_ino_key()
139 * highest_ino_key - get the highest possible inode key.
140 * @c: UBIFS file-system description object
147 key->u32[0] = inum; in highest_ino_key()
148 key->u32[1] = 0xffffffff; in highest_ino_key()
152 * dent_key_init - initialize directory entry key.
153 * @c: UBIFS file-system description object
162 uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm)); in dent_key_init()
165 ubifs_assert(c, !nm->hash && !nm->minor_hash); in dent_key_init()
166 key->u32[0] = inum; in dent_key_init()
167 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init()
171 * dent_key_init_hash - initialize directory entry key without re-calculating
173 * @c: UBIFS file-system description object
183 key->u32[0] = inum; in dent_key_init_hash()
184 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init_hash()
188 * dent_key_init_flash - initialize on-flash directory entry key.
189 * @c: UBIFS file-system description object
199 uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm)); in dent_key_init_flash()
202 key->j32[0] = cpu_to_le32(inum); in dent_key_init_flash()
203 key->j32[1] = cpu_to_le32(hash | in dent_key_init_flash()
205 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in dent_key_init_flash()
209 * lowest_dent_key - get the lowest possible directory entry key.
210 * @c: UBIFS file-system description object
217 key->u32[0] = inum; in lowest_dent_key()
218 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_dent_key()
222 * xent_key_init - initialize extended attribute entry key.
223 * @c: UBIFS file-system description object
232 uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm)); in xent_key_init()
235 key->u32[0] = inum; in xent_key_init()
236 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS); in xent_key_init()
240 * xent_key_init_flash - initialize on-flash extended attribute entry key.
241 * @c: UBIFS file-system description object
250 uint32_t hash = c->key_hash(fname_name(nm), fname_len(nm)); in xent_key_init_flash()
253 key->j32[0] = cpu_to_le32(inum); in xent_key_init_flash()
254 key->j32[1] = cpu_to_le32(hash | in xent_key_init_flash()
256 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in xent_key_init_flash()
260 * lowest_xent_key - get the lowest possible extended attribute entry key.
261 * @c: UBIFS file-system description object
268 key->u32[0] = inum; in lowest_xent_key()
269 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_xent_key()
273 * data_key_init - initialize data key.
274 * @c: UBIFS file-system description object
277 * @block: block number
281 unsigned int block) in data_key_init() argument
283 ubifs_assert(c, !(block & ~UBIFS_S_KEY_BLOCK_MASK)); in data_key_init()
284 key->u32[0] = inum; in data_key_init()
285 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS); in data_key_init()
289 * highest_data_key - get the highest possible data key for an inode.
290 * @c: UBIFS file-system description object
301 * trun_key_init - initialize truncation node key.
302 * @c: UBIFS file-system description object
312 key->u32[0] = inum; in trun_key_init()
313 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS; in trun_key_init()
317 * invalid_key_init - initialize invalid node key.
318 * @c: UBIFS file-system description object
326 key->u32[0] = 0xDEADBEAF; in invalid_key_init()
327 key->u32[1] = UBIFS_INVALID_KEY; in invalid_key_init()
331 * key_type - get key type.
332 * @c: UBIFS file-system description object
338 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; in key_type()
342 * key_type_flash - get type of a on-flash formatted key.
343 * @c: UBIFS file-system description object
350 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS; in key_type_flash()
354 * key_inum - fetch inode number from key.
355 * @c: UBIFS file-system description object
356 * @k: key to fetch inode number from
362 return key->u32[0]; in key_inum()
366 * key_inum_flash - fetch inode number from an on-flash formatted key.
367 * @c: UBIFS file-system description object
368 * @k: key to fetch inode number from
374 return le32_to_cpu(key->j32[0]); in key_inum_flash()
378 * key_hash - get directory entry hash.
379 * @c: UBIFS file-system description object
385 return key->u32[1] & UBIFS_S_KEY_HASH_MASK; in key_hash()
389 * key_hash_flash - get directory entry hash from an on-flash formatted key.
390 * @c: UBIFS file-system description object
397 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK; in key_hash_flash()
401 * key_block - get data block number.
402 * @c: UBIFS file-system description object
403 * @key: the key to get the block number from
408 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK; in key_block()
412 * key_block_flash - get data block number from an on-flash formatted key.
413 * @c: UBIFS file-system description object
414 * @k: the key to get the block number from
421 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK; in key_block_flash()
425 * key_read - transform a key to in-memory format.
426 * @c: UBIFS file-system description object
435 to->u32[0] = le32_to_cpu(f->j32[0]); in key_read()
436 to->u32[1] = le32_to_cpu(f->j32[1]); in key_read()
440 * key_write - transform a key from in-memory format.
441 * @c: UBIFS file-system description object
450 t->j32[0] = cpu_to_le32(from->u32[0]); in key_write()
451 t->j32[1] = cpu_to_le32(from->u32[1]); in key_write()
452 memset(to + 8, 0, UBIFS_MAX_KEY_LEN - 8); in key_write()
456 * key_write_idx - transform a key from in-memory format for the index.
457 * @c: UBIFS file-system description object
466 t->j32[0] = cpu_to_le32(from->u32[0]); in key_write_idx()
467 t->j32[1] = cpu_to_le32(from->u32[1]); in key_write_idx()
471 * key_copy - copy a key.
472 * @c: UBIFS file-system description object
479 to->u64[0] = from->u64[0]; in key_copy()
483 * keys_cmp - compare keys.
484 * @c: UBIFS file-system description object
488 * This function compares 2 keys and returns %-1 if @key1 is less than
495 if (key1->u32[0] < key2->u32[0]) in keys_cmp()
496 return -1; in keys_cmp()
497 if (key1->u32[0] > key2->u32[0]) in keys_cmp()
499 if (key1->u32[1] < key2->u32[1]) in keys_cmp()
500 return -1; in keys_cmp()
501 if (key1->u32[1] > key2->u32[1]) in keys_cmp()
508 * keys_eq - determine if keys are equivalent.
509 * @c: UBIFS file-system description object
520 if (key1->u32[0] != key2->u32[0]) in keys_eq()
522 if (key1->u32[1] != key2->u32[1]) in keys_eq()
528 * is_hash_key - is a key vulnerable to hash collisions.
529 * @c: UBIFS file-system description object
543 * key_max_inode_size - get maximum file size allowed by current key format.
544 * @c: UBIFS file-system description object
548 switch (c->key_fmt) { in key_max_inode_size()