2008-06-16 Bean <bean123ch@gmail.com>
* fs/ext2.c (grub_ext2_blockgroup): Revert to pre journal state. (grub_ext2_read_block): Likewise. (grub_ext2_read_inode): Likewise. (grub_ext2_mount): Likewise. (grub_ext2_close): Likewise. (grub_ext3_get_journal): Removed. * fs/reiserfs.c (grub_reiserfs_get_item): Revert to pre journal state. (grub_reiserfs_read_symlink): Likewise. (grub_reiserfs_mount): Likewise. (grub_reiserfs_open): Likewise. (grub_reiserfs_read): Likewise. (grub_reiserfs_close): Likewise. (grub_reiserfs_get_journal): Removed. * fs/fshelp.c (grub_fshelp_read): Removed. (grub_fshelp_map_block): Likewise. * include/grub/fshelp.h (grub_fshelp_journal_type): Removed. (grub_fshelp_journal): Likewise. (grub_fshelp_read): Likewise. (grub_fshelp_map_block): Likewise.
This commit is contained in:
parent
3540a760ea
commit
d31a32a14c
5 changed files with 67 additions and 443 deletions
67
fs/fshelp.c
67
fs/fshelp.c
|
@ -214,46 +214,6 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes from the block BLOCK on disk DISK into the buffer BUF,
|
||||
beginning with the block POS. Apply mappings from LOG. The blocks
|
||||
have a size of LOG2BLOCKSIZE (in log2). */
|
||||
grub_err_t grub_fshelp_read (grub_disk_t disk, grub_fshelp_journal_t log,
|
||||
grub_disk_addr_t block, grub_off_t pos,
|
||||
grub_size_t len, char *buf, int log2blocksize)
|
||||
{
|
||||
grub_off_t relblk;
|
||||
|
||||
relblk = pos >> (log2blocksize + GRUB_DISK_SECTOR_BITS);
|
||||
block += relblk;
|
||||
pos -= relblk << (log2blocksize + GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
grub_err_t ret;
|
||||
grub_size_t size;
|
||||
|
||||
size = (GRUB_DISK_SECTOR_SIZE << log2blocksize) - pos;
|
||||
if (size > len)
|
||||
size = len;
|
||||
|
||||
ret = grub_disk_read (disk,
|
||||
grub_fshelp_map_block (log, block) << log2blocksize,
|
||||
pos, size, buf);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
block++;
|
||||
pos = 0;
|
||||
buf += size;
|
||||
len -= size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Read LEN bytes from the file NODE on disk DISK into the buffer BUF,
|
||||
beginning with the block POS. READ_HOOK should be set before
|
||||
reading a block from the file. GET_BLOCK is used to translate file
|
||||
|
@ -350,30 +310,3 @@ grub_fshelp_log2blksize (unsigned int blksize, unsigned int *pow)
|
|||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_disk_addr_t
|
||||
grub_fshelp_map_block (grub_fshelp_journal_t log, grub_disk_addr_t block)
|
||||
{
|
||||
int map_block;
|
||||
|
||||
if ((! log) || (! block))
|
||||
return block;
|
||||
|
||||
for (map_block = log->num_mappings - 1; map_block >= 0; map_block--)
|
||||
{
|
||||
if (log->mapping[map_block] == block)
|
||||
break;
|
||||
}
|
||||
|
||||
if (map_block < 0)
|
||||
return block;
|
||||
|
||||
map_block += log->start_block;
|
||||
if (map_block >= log->last_block)
|
||||
map_block -= log->last_block - log->first_block;
|
||||
|
||||
if (log->type == GRUB_FSHELP_JOURNAL_TYPE_BLOCK)
|
||||
return log->blkno + map_block;
|
||||
else
|
||||
return log->get_block (log->node, map_block);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue