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.
This commit is contained in:
parent
f5db429174
commit
868967cfaf
2 changed files with 24 additions and 14 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,5 +1,17 @@
|
||||||
2008-01-06 Yoshinori K. Okuji <okuji@enbug.org>
|
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
|
* fs/reiserfs.c (grub_reiserfs_iterate_dir): ENTRY_ITEM must be
|
||||||
allocated from the heap, due to the fshelp implementation.
|
allocated from the heap, due to the fshelp implementation.
|
||||||
(grub_reiserfs_dir): Free NODE, due to the same reason.
|
(grub_reiserfs_dir): Free NODE, due to the same reason.
|
||||||
|
|
|
@ -20,16 +20,13 @@
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
implement journal handling (ram replay)
|
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
|
test tail packing & direct files
|
||||||
validate partition label position
|
validate partition label position
|
||||||
*/
|
*/
|
||||||
#warning "TODO : journal, tail packing (?)"
|
#warning "TODO : journal, tail packing (?)"
|
||||||
|
|
||||||
#define GRUB_REISERFS_KEYV2_BITFIELD 1
|
|
||||||
#if 0
|
#if 0
|
||||||
|
# define GRUB_REISERFS_KEYV2_BITFIELD 1
|
||||||
# define GRUB_REISERFS_DEBUG
|
# define GRUB_REISERFS_DEBUG
|
||||||
# define GRUB_REISERFS_JOURNALING
|
# define GRUB_REISERFS_JOURNALING
|
||||||
# define GRUB_HEXDUMP
|
# define GRUB_HEXDUMP
|
||||||
|
@ -263,7 +260,7 @@ grub_reiserfs_get_key_v2_type (const struct grub_reiserfs_key *key)
|
||||||
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
||||||
switch (key->u.v2.type)
|
switch (key->u.v2.type)
|
||||||
#else
|
#else
|
||||||
switch (key->u.v2.offset_type & 0xF)
|
switch (grub_le_to_cpu64 (key->u.v2.offset_type) >> 60)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -372,9 +369,7 @@ grub_reiserfs_get_key_offset (const struct grub_reiserfs_key *key)
|
||||||
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
||||||
return key->u.v2.offset;
|
return key->u.v2.offset;
|
||||||
#else
|
#else
|
||||||
grub_uint64_t temp = grub_le_to_cpu64 (key->u.v2.offset_type & ~0xF);
|
return grub_le_to_cpu64 (key->u.v2.offset_type) & (~0ULL >> 4);
|
||||||
return (((temp & 0xF000000000000000LLU) >> 4) \
|
|
||||||
| (temp & 0x00FFFFFFFFFFFFFFLLU));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,9 +386,8 @@ grub_reiserfs_set_key_offset (struct grub_reiserfs_key *key,
|
||||||
key->u.v2.offset = value;
|
key->u.v2.offset = value;
|
||||||
#else
|
#else
|
||||||
key->u.v2.offset_type \
|
key->u.v2.offset_type \
|
||||||
= ((key->u.v2.offset_type & 0xF) \
|
= ((key->u.v2.offset_type & grub_cpu_to_le64 (15ULL << 60))
|
||||||
| grub_cpu_to_le64 (((value & 0x0F00000000000000LLU) << 4) \
|
| grub_cpu_to_le64 (value & (~0ULL >> 4)));
|
||||||
| (value & 0x00FFFFFFFFFFFFFFLLU));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +437,9 @@ grub_reiserfs_set_key_type (struct grub_reiserfs_key *key,
|
||||||
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
#ifdef GRUB_REISERFS_KEYV2_BITFIELD
|
||||||
key->u.v2.type = type;
|
key->u.v2.type = type;
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
assert (grub_reiserfs_get_key_type (key) == grub_type);
|
assert (grub_reiserfs_get_key_type (key) == grub_type);
|
||||||
|
@ -752,6 +748,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
||||||
struct grub_reiserfs_block_header *block_header = 0;
|
struct grub_reiserfs_block_header *block_header = 0;
|
||||||
grub_uint16_t block_size, block_position;
|
grub_uint16_t block_size, block_position;
|
||||||
grub_uint32_t block_number;
|
grub_uint32_t block_number;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (item->type != GRUB_REISERFS_DIRECTORY)
|
if (item->type != GRUB_REISERFS_DIRECTORY)
|
||||||
{
|
{
|
||||||
|
@ -975,6 +972,7 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
||||||
{
|
{
|
||||||
grub_dprintf ("reiserfs", "Found : %s, type=%d\n",
|
grub_dprintf ("reiserfs", "Found : %s, type=%d\n",
|
||||||
entry_name, entry_type);
|
entry_name, entry_type);
|
||||||
|
ret = 1;
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,11 +997,11 @@ grub_reiserfs_iterate_dir (grub_fshelp_node_t item,
|
||||||
found:
|
found:
|
||||||
assert (grub_errno == GRUB_ERR_NONE);
|
assert (grub_errno == GRUB_ERR_NONE);
|
||||||
grub_free (block_header);
|
grub_free (block_header);
|
||||||
return grub_errno;
|
return ret;
|
||||||
fail:
|
fail:
|
||||||
assert (grub_errno != GRUB_ERR_NONE);
|
assert (grub_errno != GRUB_ERR_NONE);
|
||||||
grub_free (block_header);
|
grub_free (block_header);
|
||||||
return grub_errno;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue