diff --git a/zdev/man/chzdev.8 b/zdev/man/chzdev.8 index 62b6a73e..91dddc35 100644 --- a/zdev/man/chzdev.8 +++ b/zdev/man/chzdev.8 @@ -636,6 +636,15 @@ option unless chzdev is run in an environment where udev is not fully functional (such as in the early phase of an initial RAM disk). .PP . +.OD no-module-load "" "" +Do not load kernel modules during chzdev execution. + +In some situations \fBchzdev\fR will attempt to load kernel modules to +complete a configuration action. This behavior may be undesirable in some +scenarios. The \fB\-\-no-module-load\fR option suppresses kernel module loading +during \fBchzdev\fR execution. +.PP +. .OD persistent "p" "" Apply changes to persistent configuration only. diff --git a/zdev/src/chzdev.c b/zdev/src/chzdev.c index 29928de0..4f20fd36 100644 --- a/zdev/src/chzdev.c +++ b/zdev/src/chzdev.c @@ -109,6 +109,7 @@ struct options { unsigned int quiet:1; unsigned int no_settle:1; unsigned int site_id; + unsigned int no_module_load:1; }; /* Makefile converts chzdev_usage.txt into C file which we include here. */ @@ -156,6 +157,7 @@ enum { OPT_NO_SETTLE = (OPT_ANONYMOUS_BASE+__COUNTER__), OPT_AUTO_CONF = (OPT_ANONYMOUS_BASE+__COUNTER__), OPT_SITE = 's', + OPT_NO_MODULE_LOAD = (OPT_ANONYMOUS_BASE+__COUNTER__), }; static struct opts_conflict conflict_list[] = { @@ -260,6 +262,7 @@ static const struct option opt_list[] = { { "quiet", no_argument, NULL, OPT_QUIET }, { "no-settle", no_argument, NULL, OPT_NO_SETTLE }, { "site", required_argument, NULL, OPT_SITE }, + { "no-module-load", no_argument, NULL, OPT_NO_MODULE_LOAD }, { NULL, no_argument, NULL, 0 }, }; @@ -1018,6 +1021,11 @@ static exit_code_t parse_options(struct options *opts, int argc, char *argv[]) opts->no_settle = 1; break; + case OPT_NO_MODULE_LOAD: + /* --no-module-load */ + opts->no_module_load = 1; + break; + case OPT_SITE: /* --site */ /* 1. User can specify only site-ids from 0 to 9 @@ -3177,6 +3185,7 @@ int main(int argc, char *argv[]) dryrun = opts.dryrun; udev_no_settle = opts.no_settle; path_set_base(opts.base); + module_load_suppress(opts.no_module_load); if (dryrun) info("Starting dry-run, configuration will not be changed\n"); diff --git a/zdev/src/chzdev_usage.txt b/zdev/src/chzdev_usage.txt index d146057e..87deb8ca 100644 --- a/zdev/src/chzdev_usage.txt +++ b/zdev/src/chzdev_usage.txt @@ -57,6 +57,7 @@ OPTIONS --dry-run Display changes without applying --base PATH Use PATH as base for accessing files --no-settle Do not wait for udev to settle + --no-module-load Do not load kernel modules during execution --auto-conf Apply changes to auto-configuration only -s, --site ID Apply changes to the specified site only --is-owner FILE Examine whether the file is generated by zdev