aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-26 12:12:12 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-26 12:12:12 -0800
commit1a59dd9ed50ac9b853cbcbf005be6759dcd7f066 (patch)
tree361de095704fa85d41f8f51a332ed21f8a28c0f3
parentf3e92c92c0a9e16bec3aa3b1c546a01054056861 (diff)
downloadsyslinux.git-1a59dd9ed50ac9b853cbcbf005be6759dcd7f066.tar.gz
syslinux.git-1a59dd9ed50ac9b853cbcbf005be6759dcd7f066.tar.xz
syslinux.git-1a59dd9ed50ac9b853cbcbf005be6759dcd7f066.zip
iso9660: use generic_getfssec()
Use generic_getfssec() for iso9660. This is a particularly simple case, since all iso9660 files (that we support) are contiguous. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/fs/iso9660/iso9660.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/core/fs/iso9660/iso9660.c b/core/fs/iso9660/iso9660.c
index cd2abba1..c32c3a0b 100644
--- a/core/fs/iso9660/iso9660.c
+++ b/core/fs/iso9660/iso9660.c
@@ -141,35 +141,6 @@ static inline int cdrom_read_blocks(struct disk *disk, void *buf,
}
/*
- * Get multiple clusters from a file, given the file pointer.
- */
-static uint32_t iso_getfssec(struct file *file, char *buf,
- int blocks, bool *have_more)
-{
- struct fs_info *fs = file->fs;
- struct disk *disk = fs->fs_dev->disk;
- uint32_t bytes_read = blocks << fs->block_shift;
- uint32_t bytes_left = file->inode->size - file->offset;
- uint32_t blocks_left = (bytes_left + BLOCK_SIZE(file->fs) - 1)
- >> file->fs->block_shift;
- block_t block = PVT(file->inode)->lba + (file->offset >> fs->block_shift);
-
- if (blocks > blocks_left)
- blocks = blocks_left;
- cdrom_read_blocks(disk, buf, block, blocks);
-
- if (bytes_read >= bytes_left) {
- bytes_read = bytes_left;
- *have_more = 0;
- } else {
- *have_more = 1;
- }
-
- file->offset += bytes_read;
- return bytes_read;
-}
-
-/*
* Find a entry in the specified dir with name _dname_.
*/
static const struct iso_dir_entry *
@@ -231,6 +202,8 @@ static struct inode *iso_get_inode(struct fs_info *fs,
const struct iso_dir_entry *de)
{
struct inode *inode = new_iso_inode(fs);
+ int blktosec = BLOCK_SHIFT(fs) - SECTOR_SHIFT(fs);
+
if (!inode)
return NULL;
@@ -241,6 +214,10 @@ static struct inode *iso_get_inode(struct fs_info *fs,
PVT(inode)->lba = de->extent_le;
inode->blocks = (inode->size + BLOCK_SIZE(fs) - 1) >> BLOCK_SHIFT(fs);
+ /* We have a single extent for all data */
+ inode->prev_extent.pstart = de->extent_le << blktosec;
+ inode->prev_extent.len = inode->blocks << blktosec;
+
return inode;
}
@@ -369,7 +346,7 @@ const struct fs_ops iso_fs_ops = {
.fs_flags = FS_USEMEM | FS_THISIND,
.fs_init = iso_fs_init,
.searchdir = NULL,
- .getfssec = iso_getfssec,
+ .getfssec = generic_getfssec,
.close_file = generic_close_file,
.mangle_name = iso_mangle_name,
.unmangle_name = generic_unmangle_name,