Mercurial > hvf > hvf-old
changeset 521:c6c44f91db83
cp: keep a reference to the system fs
This will let us do file I/O later on for NSS loading, etc.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 25 Apr 2011 14:54:22 -0400 |
parents | 31b67316e418 |
children | 0dd4471a7c44 |
files | cp/include/config.h cp/include/nucleus.h cp/nucleus/config.c cp/nucleus/init.c |
diffstat | 4 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/cp/include/config.h Mon Apr 25 14:53:17 2011 -0400 +++ b/cp/include/config.h Mon Apr 25 14:54:22 2011 -0400 @@ -9,6 +9,7 @@ #define __CONFIG_H #include <list.h> +#include <edf.h> /* * Base address within a guest's address space; used as the base address for @@ -29,9 +30,11 @@ struct list_head logos; }; +extern struct fs *sysfs; + /* the actual config */ extern struct sysconf sysconf; -extern int load_config(); +extern struct fs *load_config(); #endif
--- a/cp/include/nucleus.h Mon Apr 25 14:53:17 2011 -0400 +++ b/cp/include/nucleus.h Mon Apr 25 14:54:22 2011 -0400 @@ -8,7 +8,6 @@ #ifndef __NUCLEUS_H #define __NUCLEUS_H -#include <config.h> #include <compiler.h> #include <errno.h> #include <string.h> @@ -48,6 +47,8 @@ BUG(); \ } while(0) +#include <config.h> + /* * This should be as simple as a cast, but unfortunately, the BUG_ON check * is there to make sure we never submit a truncated address to the channels
--- a/cp/nucleus/config.c Mon Apr 25 14:53:17 2011 -0400 +++ b/cp/nucleus/config.c Mon Apr 25 14:54:22 2011 -0400 @@ -147,7 +147,7 @@ s[i+1] = '\0'; } -int load_config(u32 iplsch) +struct fs *load_config(u32 iplsch) { struct device *dev; struct fs *fs; @@ -163,23 +163,23 @@ /* find the real device */ dev = find_device_by_sch(iplsch); if (IS_ERR(dev)) - return PTR_ERR(dev); + return ERR_CAST(dev); /* mount the fs */ fs = edf_mount(dev); if (IS_ERR(fs)) - return PTR_ERR(fs); + return fs; /* look up the config file */ file = edf_lookup(fs, CONFIG_FILE_NAME, CONFIG_FILE_TYPE); if (IS_ERR(file)) - return PTR_ERR(file); + return ERR_CAST(file); /* parse each record in the config file */ for(i=0; i<file->FST.AIC; i++) { ret = edf_read_rec(file, buf, i); if (ret) - return ret; + return ERR_PTR(ret); ebcdic2ascii((u8 *) buf, CONFIG_LRECL); @@ -189,10 +189,10 @@ ret = parse_config_stmnt(buf); if (ret) - return ret; + return ERR_PTR(ret); } /* FIXME: load all the logo files */ - return 0; + return fs; }
--- a/cp/nucleus/init.c Mon Apr 25 14:53:17 2011 -0400 +++ b/cp/nucleus/init.c Mon Apr 25 14:54:22 2011 -0400 @@ -48,6 +48,8 @@ u8 *int_stack_ptr; +struct fs *sysfs; + /* the time HVF got IPLd */ struct datetime ipltime; @@ -88,7 +90,8 @@ /* * Load the config file */ - if (load_config(iplsch)) + sysfs = load_config(iplsch); + if (IS_ERR(sysfs)) BUG(); /*