Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Now that the ufs module has been split out from ffs and ...
details: https://anonhg.NetBSD.org/src/rev/37f0361323a9
branches: trunk
changeset: 452256:37f0361323a9
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Mon Jun 24 13:58:24 2019 +0000
description:
Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.
Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.
Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.
Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.
diffstat:
sys/arch/i386/stand/lib/exec.c | 46 +++++++++++++++++++++++++++++++++++---
sys/arch/i386/stand/lib/libi386.h | 3 +-
sys/lib/libsa/ext2fs.c | 4 +-
sys/lib/libsa/ffsv1.c | 6 ++++-
sys/lib/libsa/ffsv2.c | 6 ++++-
5 files changed, 56 insertions(+), 9 deletions(-)
diffs (159 lines):
diff -r d46644132e29 -r 37f0361323a9 sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c Mon Jun 24 13:57:30 2019 +0000
+++ b/sys/arch/i386/stand/lib/exec.c Mon Jun 24 13:58:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.71 2019/06/24 02:48:51 pgoyette Exp $ */
+/* $NetBSD: exec.c,v 1.72 2019/06/24 13:58:24 pgoyette Exp $ */
/*
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -121,6 +121,8 @@
#define MODULE_WARNING_SEC 5
+#define MAXMODNAME 32 /* from <sys/module.h> */
+
extern struct btinfo_console btinfo_console;
boot_module_t *boot_modules;
@@ -190,6 +192,42 @@
return module_add_common(name, BM_TYPE_FS);
}
+/*
+ * Add a /-separated list of module names to the boot list
+ */
+void
+module_add_split(const char *name, uint8_t type)
+{
+ char mod_name[MAXMODNAME];
+ int i;
+ const char *mp = name;
+ char *ep;
+
+ while (*mp) { /* scan list of module names */
+ i = MAXMODNAME;
+ ep = mod_name;
+ while (--i) { /* scan for end of first name */
+ *ep = *mp;
+ if (*ep == '/') /* NUL-terminate the name */
+ *ep = '\0';
+
+ if (*ep == 0 ) { /* add non-empty name */
+ if (ep != mod_name)
+ module_add_common(mod_name, type);
+ break;
+ }
+ ep++; mp++;
+ }
+ if (*ep != 0) {
+ printf("module name too long\n");
+ return;
+ }
+ if (*mp == '/') { /* skip separator if more */
+ mp++;
+ }
+ }
+}
+
static void
module_add_common(const char *name, uint8_t type)
{
@@ -305,7 +343,7 @@
/* If the root fs type is unusual, load its module. */
if (fsmod != NULL)
- module_add_common(fsmod, BM_TYPE_KMOD);
+ module_add_split(fsmod, BM_TYPE_KMOD);
bi_prekern.kernpa_start = kernpa_start;
bi_prekern.kernpa_end = kernpa_end;
@@ -383,7 +421,7 @@
/* If the root fs type is unusual, load its module. */
if (fsmod != NULL)
- module_add_common(fsmod, BM_TYPE_KMOD);
+ module_add_split(fsmod, BM_TYPE_KMOD);
/*
* Gather some information for the kernel. Do this after the
@@ -572,7 +610,7 @@
/* If the root fs type is unusual, load its module. */
if (fsmod != NULL)
- module_add_common(fsmod, BM_TYPE_KMOD);
+ module_add_split(fsmod, BM_TYPE_KMOD);
for (bm = boot_modules; bm; bm = bm->bm_next) {
fd = module_open(bm, 0, kdev, base_path, false);
diff -r d46644132e29 -r 37f0361323a9 sys/arch/i386/stand/lib/libi386.h
--- a/sys/arch/i386/stand/lib/libi386.h Mon Jun 24 13:57:30 2019 +0000
+++ b/sys/arch/i386/stand/lib/libi386.h Mon Jun 24 13:58:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libi386.h,v 1.42 2017/03/12 05:33:48 nonaka Exp $ */
+/* $NetBSD: libi386.h,v 1.43 2019/06/24 13:58:24 pgoyette Exp $ */
/*
* Copyright (c) 1996
@@ -145,6 +145,7 @@
void rnd_add(char *);
void fs_add(char *);
void userconf_add(char *);
+void module_add_split(const char *, uint8_t);
struct btinfo_framebuffer;
void framebuffer_configure(struct btinfo_framebuffer *);
diff -r d46644132e29 -r 37f0361323a9 sys/lib/libsa/ext2fs.c
--- a/sys/lib/libsa/ext2fs.c Mon Jun 24 13:57:30 2019 +0000
+++ b/sys/lib/libsa/ext2fs.c Mon Jun 24 13:58:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs.c,v 1.27 2019/04/05 20:09:29 christos Exp $ */
+/* $NetBSD: ext2fs.c,v 1.28 2019/06/24 13:58:24 pgoyette Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@@ -692,7 +692,7 @@
if (rc)
ext2fs_close(f);
else
- fsmod = "ext2fs";
+ fsmod = "ufs/ext2fs";
return rc;
}
diff -r d46644132e29 -r 37f0361323a9 sys/lib/libsa/ffsv1.c
--- a/sys/lib/libsa/ffsv1.c Mon Jun 24 13:57:30 2019 +0000
+++ b/sys/lib/libsa/ffsv1.c Mon Jun 24 13:58:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffsv1.c,v 1.6 2012/05/21 21:34:16 dsl Exp $ */
+/* $NetBSD: ffsv1.c,v 1.7 2019/06/24 13:58:24 pgoyette Exp $ */
#define LIBSA_FFSv1
@@ -15,4 +15,8 @@
#define ufs_dinode ufs1_dinode
#define indp_t int32_t
+#if 0
+#define FSMOD "wapbl/ufs/ffs"
+#endif
+
#include "ufs.c"
diff -r d46644132e29 -r 37f0361323a9 sys/lib/libsa/ffsv2.c
--- a/sys/lib/libsa/ffsv2.c Mon Jun 24 13:57:30 2019 +0000
+++ b/sys/lib/libsa/ffsv2.c Mon Jun 24 13:58:24 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffsv2.c,v 1.6 2012/05/21 21:34:16 dsl Exp $ */
+/* $NetBSD: ffsv2.c,v 1.7 2019/06/24 13:58:24 pgoyette Exp $ */
#define LIBSA_FFSv2
@@ -15,4 +15,8 @@
#define ufs_dinode ufs2_dinode
#define indp_t int64_t
+#if 0
+#define FSMOD "wapbl/ufs/ffs"
+#endif
+
#include "ufs.c"
Home |
Main Index |
Thread Index |
Old Index