summaryrefslogtreecommitdiff
path: root/core/fs/fs.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-23 18:14:12 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-23 18:14:12 -0800
commit3cda063b8e079ee6518d3425650d800db4227585 (patch)
tree5c31ff2924ad2d43e0174e1c7301e950543262d4 /core/fs/fs.c
parent2e236fea2b554b7b72f66d96ceae9e3fa4da675a (diff)
downloadsyslinux-3cda063b8e079ee6518d3425650d800db4227585.tar.gz
core: add a direct 32-bit API
Add a direct 32-bit API to some functions; initially read file only. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/fs/fs.c')
-rw-r--r--core/fs/fs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c
index d67a87ca..e0f469ba 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -137,6 +137,27 @@ void getfssec(com32sys_t *regs)
regs->ecx.l = bytes_read;
}
+size_t pmapi_read_file(uint16_t *handle, void *buf, size_t sectors)
+{
+ bool have_more;
+ size_t bytes_read;
+ struct file *file;
+
+ file = handle_to_file(*handle);
+ bytes_read = file->fs->fs_ops->getfssec(file, buf, sectors, &have_more);
+
+ /*
+ * If we reach EOF, the filesystem driver will have already closed
+ * the underlying file... this really should be cleaner.
+ */
+ if (!have_more) {
+ _close_file(file);
+ *handle = 0;
+ }
+
+ return bytes_read;
+}
+
void pm_searchdir(com32sys_t *regs)
{
char *name = MK_PTR(regs->ds, regs->edi.w[0]);