summaryrefslogtreecommitdiff
path: root/core/fs/fs.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2011-12-08 14:34:57 +0000
committerMatt Fleming <matt.fleming@intel.com>2011-12-16 16:31:19 +0000
commit94903138ac9a9c35fbdb24bbd90d9c94213395f3 (patch)
treeb43a2f90978019d127a085bb0b79ac45007096e0 /core/fs/fs.c
parentde65c9df7c0302d053c4a47f60b31c641cce97a7 (diff)
downloadsyslinux-94903138ac9a9c35fbdb24bbd90d9c94213395f3.tar.gz
disk: Add .disk_init() to firmware struct
Each firmware has its own method of initialising a disk so allow each firmware backend to implement a separate disk_init() function. Make all the assembly callers of fs_init() jump through pm_fs_init(), which allows us to restrict the com32sys_t arguments to only those callers that really need it, e.g. the .asm files. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'core/fs/fs.c')
-rw-r--r--core/fs/fs.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c
index a4fb4f77..c2d17dc2 100644
--- a/core/fs/fs.c
+++ b/core/fs/fs.c
@@ -428,22 +428,16 @@ void pm_close_file(com32sys_t *regs)
* invoke the fs-specific init function;
* initialize the cache if we need one;
* finally, get the current inode for relative path looking.
+ *
+ * ops is a ptr list for several fs_ops
*/
__bss16 uint16_t SectorSize, SectorShift;
-void fs_init(com32sys_t *regs)
+void fs_init(const struct fs_ops **ops, void *args)
{
static struct fs_info fs; /* The actual filesystem buffer */
- uint8_t disk_devno = regs->edx.b[0];
- uint8_t disk_cdrom = regs->edx.b[1];
- sector_t disk_offset = regs->ecx.l | ((sector_t)regs->ebx.l << 32);
- uint16_t disk_heads = regs->esi.w[0];
- uint16_t disk_sectors = regs->edi.w[0];
- uint32_t maxtransfer = regs->ebp.l;
int blk_shift = -1;
struct device *dev = NULL;
- /* ops is a ptr list for several fs_ops */
- const struct fs_ops **ops = (const struct fs_ops **)regs->eax.l;
/* Initialize malloc() */
mem_init();
@@ -463,8 +457,7 @@ void fs_init(com32sys_t *regs)
fs.fs_dev = NULL;
} else {
if (!dev)
- dev = device_init(disk_devno, disk_cdrom, disk_offset,
- disk_heads, disk_sectors, maxtransfer);
+ dev = device_init(args);
fs.fs_dev = dev;
}
/* invoke the fs-specific init code */
@@ -496,3 +489,8 @@ void fs_init(com32sys_t *regs)
SectorShift = fs.sector_shift;
SectorSize = fs.sector_size;
}
+
+void pm_fs_init(com32sys_t *regs)
+{
+ fs_init(regs->eax.l, regs);
+}