Move the separate ISO9660 handler into a new /packages/iso9660-files package in preparation for some future work. Based heavily

on Laurent's original patch posted to the list.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@809 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-07-03 14:39:49 +00:00
committed by Mark Cave-Ayland
parent 6e3c34c7b5
commit 5ed6ff34fc
10 changed files with 248 additions and 153 deletions

View File

@@ -16,6 +16,7 @@
#include "config.h"
#include "libopenbios/bindings.h"
#include "libopenbios/load.h"
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "packages.h"
@@ -68,6 +69,8 @@ dlabel_open( dlabel_info_t *di )
DPRINTF("dlabel-open '%s'\n", path );
di->part_ih = 0;
/* Find parent methods */
di->parent_seek_xt = find_parent_method("seek");
di->parent_tell_xt = find_parent_method("tell");
@@ -111,9 +114,16 @@ dlabel_open( dlabel_info_t *di )
selfword("find-filesystem");
ph = POP_ph();
if( ph ) {
push_str( path );
PUSH_ph( ph );
fword("interpose");
/* If we have been asked to open a particular file, interpose the filesystem package with the passed filename as an argument */
DPRINTF("path: %s length: %d\n", path, strlen(path));
if (strlen(path)) {
DPRINTF("INTERPOSE!\n");
push_str( path );
PUSH_ph( ph );
fword("interpose");
}
} else if (*path && strcmp(path, "%BOOT") != 0) {
goto out;
}
@@ -175,14 +185,24 @@ dlabel_load( __attribute__((unused)) dlabel_info_t *di )
DPRINTF("load invoked with address %p\n", buf);
xt = find_ih_method("load", di->part_ih);
if (!xt) {
forth_printf("load currently not implemented for ihandle " FMT_ucellx "\n", di->part_ih);
PUSH(0);
return;
}
/* If we have a partition handle, invoke the load word on it */
if (di->part_ih) {
xt = find_ih_method("load", di->part_ih);
if (!xt) {
forth_printf("load currently not implemented for ihandle " FMT_ucellx "\n", di->part_ih);
PUSH(0);
return;
}
DPRINTF("calling load on ihandle " FMT_ucellx "\n", di->part_ih);
call_package(xt, di->part_ih);
call_package(xt, di->part_ih);
} else {
/* Otherwise attempt load directly on the raw disk */
DPRINTF("calling load on raw disk ihandle " FMT_ucellx "\n", my_self());
load(my_self());
}
}
NODE_METHODS( dlabel ) = {

View File

@@ -30,6 +30,9 @@ modules_init( void )
#ifdef CONFIG_DISK_LABEL
disklabel_init();
#endif
#ifdef CONFIG_ISO9660
iso9660_init();
#endif
#ifdef CONFIG_FS
files_init();
#endif

View File

@@ -36,6 +36,7 @@ typedef struct {
ucell offs_hi, offs_lo;
ucell size_hi, size_lo;
uint blocksize;
phandle_t filesystem_ph;
} macparts_info_t;
DECLARE_NODE( macparts, INSTALL_OPEN, sizeof(macparts_info_t), "+/packages/mac-parts" );
@@ -111,6 +112,7 @@ macparts_open( macparts_info_t *di )
DPRINTF("want_bootcode %d\n", want_bootcode);
DPRINTF("macparts_open %d\n", parnum);
di->filesystem_ph = 0;
di->read_xt = find_parent_method("read");
di->seek_xt = find_parent_method("seek");
@@ -244,10 +246,16 @@ found:
ph = POP_ph();
if( ph ) {
DPRINTF("mac-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, str);
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
DPRINTF("mac-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, argstr);
di->filesystem_ph = ph;
/* If we have been asked to open a particular file, interpose the filesystem package with
the passed filename as an argument */
if (strlen(argstr)) {
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
}
} else {
DPRINTF("mac-parts: no filesystem found; bypassing misc-files interpose\n");
}

View File

@@ -65,11 +65,6 @@ do_open( ihandle_t ih )
DPRINTF("--- HFS returned %d\n", err);
}
if( err ) {
err = fs_iso9660_open(fd, fs);
DPRINTF("--- ISO9660 returned %d\n", err);
}
if( err ) {
err = fs_ext2_open(fd, fs);
DPRINTF("--- ext2 returned %d\n", err);
@@ -360,11 +355,6 @@ files_probe( files_info_t *mi )
DPRINTF("--- HFS returned %d\n", err);
}
if( err ) {
err = fs_iso9660_probe(fd, offs);
DPRINTF("--- ISO9660 returned %d\n", err);
}
if( err ) {
err = fs_ext2_probe(fd, offs);
DPRINTF("--- ext2 returned %d\n", err);

View File

@@ -20,6 +20,7 @@
extern void deblocker_init( void );
extern void disklabel_init( void );
extern void files_init( void );
extern void iso9660_init( void );
extern void macparts_init( void );
extern void pcparts_init( void );
extern void sunparts_init( void );

View File

@@ -32,6 +32,7 @@ typedef struct {
xt_t seek_xt, read_xt;
ucell offs_hi, offs_lo;
ucell size_hi, size_lo;
phandle_t filesystem_ph;
} pcparts_info_t;
DECLARE_NODE( pcparts, INSTALL_OPEN, sizeof(pcparts_info_t), "+/packages/pc-parts" );
@@ -134,6 +135,7 @@ pcparts_open( pcparts_info_t *di )
if( parnum < 0 )
parnum = 0;
di->filesystem_ph = 0;
di->read_xt = find_parent_method("read");
di->seek_xt = find_parent_method("seek");
@@ -264,10 +266,16 @@ pcparts_open( pcparts_info_t *di )
ph = POP_ph();
if( ph ) {
DPRINTF("pc-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, str);
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
DPRINTF("pc-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, argstr);
di->filesystem_ph = ph;
/* If we have been asked to open a particular file, interpose the filesystem package with
the passed filename as an argument */
if (strlen(argstr)) {
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
}
} else {
DPRINTF("pc-parts: no filesystem found; bypassing misc-files interpose\n");
}

View File

@@ -33,6 +33,7 @@ typedef struct {
ucell offs_hi, offs_lo;
ucell size_hi, size_lo;
int type;
phandle_t filesystem_ph;
} sunparts_info_t;
DECLARE_NODE( sunparts, INSTALL_OPEN, sizeof(sunparts_info_t), "+/packages/sun-parts" );
@@ -152,6 +153,7 @@ sunparts_open( sunparts_info_t *di )
DPRINTF("parstr: %s argstr: %s parnum: %d\n", parstr, argstr, parnum);
di->filesystem_ph = 0;
di->read_xt = find_parent_method("read");
di->seek_xt = find_parent_method("seek");
@@ -205,10 +207,16 @@ sunparts_open( sunparts_info_t *di )
ph = POP_ph();
if( ph ) {
DPRINTF("sun-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, str);
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
DPRINTF("sun-parts: filesystem found with ph " FMT_ucellx " and args %s\n", ph, argstr);
di->filesystem_ph = ph;
/* If we have been asked to open a particular file, interpose the filesystem package with
the passed filename as an argument */
if (strlen(argstr)) {
push_str( argstr );
PUSH_ph( ph );
fword("interpose");
}
} else {
DPRINTF("sun-parts: no filesystem found; bypassing misc-files interpose\n");
}