Lines Matching +full:block +full:- +full:fetch
4 * Copyright (C) 2006-2008 Nokia Corporation.
6 * SPDX-License-Identifier: GPL-2.0+
13 * This header contains various key-related definitions and helper function.
20 * Keys are 64-bits long. First 32-bits are inode number (parent inode number
30 * key_mask_hash - mask a valid hash value.
46 * key_r5_hash - R5 hash function (borrowed from reiserfs).
66 * key_test_hash - testing hash function.
80 * ino_key_init - initialize inode key.
81 * @c: UBIFS file-system description object
88 key->u32[0] = inum; in ino_key_init()
89 key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS; in ino_key_init()
93 * ino_key_init_flash - initialize on-flash inode key.
94 * @c: UBIFS file-system description object
103 key->j32[0] = cpu_to_le32(inum); in ino_key_init_flash()
104 key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS); in ino_key_init_flash()
105 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in ino_key_init_flash()
109 * lowest_ino_key - get the lowest possible inode key.
110 * @c: UBIFS file-system description object
117 key->u32[0] = inum; in lowest_ino_key()
118 key->u32[1] = 0; in lowest_ino_key()
122 * highest_ino_key - get the highest possible inode key.
123 * @c: UBIFS file-system description object
130 key->u32[0] = inum; in highest_ino_key()
131 key->u32[1] = 0xffffffff; in highest_ino_key()
135 * dent_key_init - initialize directory entry key.
136 * @c: UBIFS file-system description object
145 uint32_t hash = c->key_hash(nm->name, nm->len); in dent_key_init()
148 key->u32[0] = inum; in dent_key_init()
149 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init()
153 * dent_key_init_hash - initialize directory entry key without re-calculating
155 * @c: UBIFS file-system description object
165 key->u32[0] = inum; in dent_key_init_hash()
166 key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS); in dent_key_init_hash()
170 * dent_key_init_flash - initialize on-flash directory entry key.
171 * @c: UBIFS file-system description object
180 uint32_t hash = c->key_hash(nm->name, nm->len); in dent_key_init_flash()
183 key->j32[0] = cpu_to_le32(inum); in dent_key_init_flash()
184 key->j32[1] = cpu_to_le32(hash | in dent_key_init_flash()
186 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in dent_key_init_flash()
190 * lowest_dent_key - get the lowest possible directory entry key.
191 * @c: UBIFS file-system description object
198 key->u32[0] = inum; in lowest_dent_key()
199 key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_dent_key()
203 * xent_key_init - initialize extended attribute entry key.
204 * @c: UBIFS file-system description object
213 uint32_t hash = c->key_hash(nm->name, nm->len); in xent_key_init()
216 key->u32[0] = inum; in xent_key_init()
217 key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS); in xent_key_init()
221 * xent_key_init_flash - initialize on-flash extended attribute entry key.
222 * @c: UBIFS file-system description object
231 uint32_t hash = c->key_hash(nm->name, nm->len); in xent_key_init_flash()
234 key->j32[0] = cpu_to_le32(inum); in xent_key_init_flash()
235 key->j32[1] = cpu_to_le32(hash | in xent_key_init_flash()
237 memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8); in xent_key_init_flash()
241 * lowest_xent_key - get the lowest possible extended attribute entry key.
242 * @c: UBIFS file-system description object
249 key->u32[0] = inum; in lowest_xent_key()
250 key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS; in lowest_xent_key()
254 * data_key_init - initialize data key.
255 * @c: UBIFS file-system description object
258 * @block: block number
262 unsigned int block) in data_key_init() argument
264 ubifs_assert(!(block & ~UBIFS_S_KEY_BLOCK_MASK)); in data_key_init()
265 key->u32[0] = inum; in data_key_init()
266 key->u32[1] = block | (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS); in data_key_init()
270 * highest_data_key - get the highest possible data key for an inode.
271 * @c: UBIFS file-system description object
282 * trun_key_init - initialize truncation node key.
283 * @c: UBIFS file-system description object
293 key->u32[0] = inum; in trun_key_init()
294 key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS; in trun_key_init()
298 * invalid_key_init - initialize invalid node key.
299 * @c: UBIFS file-system description object
307 key->u32[0] = 0xDEADBEAF; in invalid_key_init()
308 key->u32[1] = UBIFS_INVALID_KEY; in invalid_key_init()
312 * key_type - get key type.
313 * @c: UBIFS file-system description object
319 return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS; in key_type()
323 * key_type_flash - get type of a on-flash formatted key.
324 * @c: UBIFS file-system description object
331 return le32_to_cpu(key->j32[1]) >> UBIFS_S_KEY_BLOCK_BITS; in key_type_flash()
335 * key_inum - fetch inode number from key.
336 * @c: UBIFS file-system description object
337 * @k: key to fetch inode number from
343 return key->u32[0]; in key_inum()
347 * key_inum_flash - fetch inode number from an on-flash formatted key.
348 * @c: UBIFS file-system description object
349 * @k: key to fetch inode number from
355 return le32_to_cpu(key->j32[0]); in key_inum_flash()
359 * key_hash - get directory entry hash.
360 * @c: UBIFS file-system description object
366 return key->u32[1] & UBIFS_S_KEY_HASH_MASK; in key_hash()
370 * key_hash_flash - get directory entry hash from an on-flash formatted key.
371 * @c: UBIFS file-system description object
378 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK; in key_hash_flash()
382 * key_block - get data block number.
383 * @c: UBIFS file-system description object
384 * @key: the key to get the block number from
389 return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK; in key_block()
393 * key_block_flash - get data block number from an on-flash formatted key.
394 * @c: UBIFS file-system description object
395 * @k: the key to get the block number from
402 return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_BLOCK_MASK; in key_block_flash()
406 * key_read - transform a key to in-memory format.
407 * @c: UBIFS file-system description object
416 to->u32[0] = le32_to_cpu(f->j32[0]); in key_read()
417 to->u32[1] = le32_to_cpu(f->j32[1]); in key_read()
421 * key_write - transform a key from in-memory format.
422 * @c: UBIFS file-system description object
431 t->j32[0] = cpu_to_le32(from->u32[0]); in key_write()
432 t->j32[1] = cpu_to_le32(from->u32[1]); in key_write()
433 memset(to + 8, 0, UBIFS_MAX_KEY_LEN - 8); in key_write()
437 * key_write_idx - transform a key from in-memory format for the index.
438 * @c: UBIFS file-system description object
447 t->j32[0] = cpu_to_le32(from->u32[0]); in key_write_idx()
448 t->j32[1] = cpu_to_le32(from->u32[1]); in key_write_idx()
452 * key_copy - copy a key.
453 * @c: UBIFS file-system description object
460 to->u64[0] = from->u64[0]; in key_copy()
464 * keys_cmp - compare keys.
465 * @c: UBIFS file-system description object
469 * This function compares 2 keys and returns %-1 if @key1 is less than
476 if (key1->u32[0] < key2->u32[0]) in keys_cmp()
477 return -1; in keys_cmp()
478 if (key1->u32[0] > key2->u32[0]) in keys_cmp()
480 if (key1->u32[1] < key2->u32[1]) in keys_cmp()
481 return -1; in keys_cmp()
482 if (key1->u32[1] > key2->u32[1]) in keys_cmp()
489 * keys_eq - determine if keys are equivalent.
490 * @c: UBIFS file-system description object
501 if (key1->u32[0] != key2->u32[0]) in keys_eq()
503 if (key1->u32[1] != key2->u32[1]) in keys_eq()
509 * is_hash_key - is a key vulnerable to hash collisions.
510 * @c: UBIFS file-system description object
524 * key_max_inode_size - get maximum file size allowed by current key format.
525 * @c: UBIFS file-system description object
529 switch (c->key_fmt) { in key_max_inode_size()