Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.

Add the '-P' option to modload(8) to set this flag.
This commit is contained in:
jnemeth 2009-06-09 20:35:02 +00:00
parent 268e5bfd87
commit cbd3656645
4 changed files with 21 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.10 2009/06/05 11:37:30 jnemeth Exp $ */
/* $NetBSD: main.c,v 1.11 2009/06/09 20:35:02 jnemeth Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: main.c,v 1.10 2009/06/05 11:37:30 jnemeth Exp $");
__RCSID("$NetBSD: main.c,v 1.11 2009/06/09 20:35:02 jnemeth Exp $");
#endif /* !lint */
#include <sys/module.h>
@ -81,8 +81,11 @@ main(int argc, char **argv)
del_props = merge_props = output_props = false;
flags = 0;
while ((ch = getopt(argc, argv, "b:d:fi:m:ps:")) != -1) {
while ((ch = getopt(argc, argv, "Pb:d:fi:m:ps:")) != -1) {
switch (ch) {
case 'P':
flags |= MODCTL_NO_PROP;
break;
case 'b':
parse_param(props, optarg, parse_bool_param);
break;
@ -248,9 +251,9 @@ usage(void)
{
(void)fprintf(stderr,
"Usage: %s [-f] [-b var=boolean] [-i var=integer] "
"Usage: %s [-P] [-f] [-b var=boolean] [-i var=integer] "
"[-s var=string] module\n"
" %s -p [-b var=boolean] [-d var] [-i var=integer] "
" %s -p [-P] [-b var=boolean] [-d var] [-i var=integer] "
"[-m plist]\n [-s var=string]\n",
getprogname(), getprogname());
exit(EXIT_FAILURE);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: modload.8,v 1.34 2009/06/05 11:37:30 jnemeth Exp $
.\" $NetBSD: modload.8,v 1.35 2009/06/09 20:35:02 jnemeth Exp $
.\"
.\" Copyright (c) 1993 Christopher G. Demetriou
.\" All rights reserved.
@ -32,7 +32,7 @@
.\"
.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
.\"
.Dd June 5, 2009
.Dd June 9, 2009
.Dt MODLOAD 8
.Os
.Sh NAME
@ -43,6 +43,7 @@
.Op Fl f
.Op Fl b Ar var=boolean
.Op Fl i Ar var=integer
.Op Fl P
.Op Fl s Ar var=string
.Ar module
.Nm
@ -51,6 +52,7 @@
.Op Fl d Ar var
.Op Fl i Ar var=integer
.Op Fl m Ar plist
.Op Fl P
.Op Fl s Ar var=string
.Sh DESCRIPTION
The
@ -100,6 +102,8 @@ When used in conjuction with
.Fl p ,
merge new options with an existing property list contained in
.Ar plist .
.It Fl P
This option tells the kernel not to load an associated property list.
.It Fl p
Output a property list suitable for loading along with a module.
When using this option, you do not need to specify a module.

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_module.c,v 1.47 2009/06/09 19:09:03 jnemeth Exp $ */
/* $NetBSD: kern_module.c,v 1.48 2009/06/09 20:35:02 jnemeth Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.47 2009/06/09 19:09:03 jnemeth Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.48 2009/06/09 20:35:02 jnemeth Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@ -788,7 +788,8 @@ module_do_load(const char *name, bool isdep, int flags,
/*
* Load and process <module>.prop if it exists.
*/
if (mod->mod_source == MODULE_SOURCE_FILESYS) {
if (((flags & MODCTL_NO_PROP) == 0) &&
(mod->mod_source == MODULE_SOURCE_FILESYS)) {
error = module_load_plist_file(path, nochroot, &plist,
&plistlen);
if (error != 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: module.h,v 1.14 2008/11/25 15:14:07 ad Exp $ */
/* $NetBSD: module.h,v 1.15 2009/06/09 20:35:02 jnemeth Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -139,7 +139,8 @@ void module_print_list(void (*)(const char *, ...));
typedef struct modctl_load {
const char *ml_filename;
#define MODCTL_LOAD_FORCE 1
#define MODCTL_NO_PROP 0x2
#define MODCTL_LOAD_FORCE 0x1
int ml_flags;
const char *ml_props;