2008-01-06 Yoshinori K. Okuji <okuji@enbug.org>
+ * fs/reiserfs.c (grub_reiserfs_get_key_v2_type): Handle endianness
+ correctly.
+ (grub_reiserfs_get_key_offset): Likewise.
+ (grub_reiserfs_set_key_offset): Likewise.
+ (grub_reiserfs_set_key_type): Likewise.
+ (grub_reiserfs_iterate_dir): Return 1 if found, otheriwise 0.
+
+ (GRUB_REISERFS_KEYV2_BITFIELD): Undefined. Probably it would be
+ better to remove the bitfield version completely.
+
+2008-01-06 Yoshinori K. Okuji <okuji@enbug.org>
+
* fs/reiserfs.c (grub_reiserfs_iterate_dir): ENTRY_ITEM must be
allocated from the heap, due to the fshelp implementation.
(grub_reiserfs_dir): Free NODE, due to the same reason.
/*
TODO:
implement journal handling (ram replay)
- implement symlinks support
- support items bigger than roughly (blocksize / 4) * blocksize
- !! that goes for directories aswell, size in such case is metadata size.
test tail packing & direct files
validate partition label position
*/
#warning "TODO : journal, tail packing (?)"
-#define GRUB_REISERFS_KEYV2_BITFIELD 1
#if 0
+# define GRUB_REISERFS_KEYV2_BITFIELD 1
# define GRUB_REISERFS_DEBUG
# define GRUB_REISERFS_JOURNALING
# define GRUB_HEXDUMP
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
switch (key->u.v2.type)
#else
- switch (key->u.v2.offset_type & 0xF)
+ switch (grub_le_to_cpu64 (key->u.v2.offset_type) >> 60)
#endif
{
case 0:
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
return key->u.v2.offset;
#else
- grub_uint64_t temp = grub_le_to_cpu64 (key->u.v2.offset_type & ~0xF);
- return (((temp & 0xF000000000000000LLU) >> 4) \
- | (temp & 0x00FFFFFFFFFFFFFFLLU));
+ return grub_le_to_cpu64 (key->u.v2.offset_type) & (~0ULL >> 4);
#endif
}
}
key->u.v2.offset = value;
#else
key->u.v2.offset_type \
- = ((key->u.v2.offset_type & 0xF) \
- | grub_cpu_to_le64 (((value & 0x0F00000000000000LLU) << 4) \
- | (value & 0x00FFFFFFFFFFFFFFLLU));
+ = ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60))
+ | grub_cpu_to_le64 (value & (~0ULL >> 4)));
#endif
}
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
key->u.v2.type = type;
#else
- key->u.v2.offset_type = (key->u.v2.offset_type & ~0xF) | (type & 0xF);
+ key->u.v2.offset_type
+ = ((key->u.v2.offset_type & grub_cpu_to_le64 (~0ULL >> 4))
+ | grub_cpu_to_le64 ((grub_uint64_t) type << 60));
#endif
}
assert (grub_reiserfs_get_key_type (key) == grub_type);
struct grub_reiserfs_block_header *block_header = 0;
grub_uint16_t block_size, block_position;
grub_uint32_t block_number;
+ int ret = 0;
if (item->type != GRUB_REISERFS_DIRECTORY)
{
{
grub_dprintf ("reiserfs", "Found : %s, type=%d\n",
entry_name, entry_type);
+ ret = 1;
goto found;
}
found:
assert (grub_errno == GRUB_ERR_NONE);
grub_free (block_header);
- return grub_errno;
+ return ret;
fail:
assert (grub_errno != GRUB_ERR_NONE);
grub_free (block_header);
- return grub_errno;
+ return 0;
}
/****************************************************************************/