diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-06-01 10:03:28 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-06-01 10:03:28 +0000 |
| commit | 19a4b38f2bcfe6a1809bdcbcd23fdec15c3cf771 (patch) | |
| tree | 6595c36b3a8d11959689eb69231d0cbf90a0cca2 | |
| parent | f2dfc6263ece1fc0f41e01adbb33350b7f024d89 (diff) | |
| download | mdevd-19a4b38f2bcfe6a1809bdcbcd23fdec15c3cf771.tar.gz | |
Add config test option to mdevd (thanks lanodan)
Signed-off-by: Laurent Bercot <ska@appnovation.com>
| -rw-r--r-- | AUTHORS | 3 | ||||
| -rw-r--r-- | doc/mdevd.html | 5 | ||||
| -rw-r--r-- | src/mdevd/mdevd.c | 6 |
3 files changed, 11 insertions, 3 deletions
@@ -1,6 +1,9 @@ Main author: Laurent Bercot <ska-skaware@skarnet.org> +Contributors: + Haelwenn (lanodan) Monnier <contact@hacktivis.me> + Thanks to: Rob Landley <rob@landley.net> Natanael Copa <ncopa@alpinelinux.org> diff --git a/doc/mdevd.html b/doc/mdevd.html index 7c2a869..4b814de 100644 --- a/doc/mdevd.html +++ b/doc/mdevd.html @@ -49,7 +49,7 @@ to running mdevd over mdev. </li> <h2> Interface </h2> <pre> - mdevd [ -v <em>verbosity</em> ] [ -D <em>notif</em> ] [ -I <em>intake</em> ] [ -o <em>outputfd</em> ] [ -I <em>intake</em> ] [ -O <em>nlgroups</em> ] [ -b <em>kbufsz</em> ] [ -f <em>conffile</em> ] [ -n ] [ -s <em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ] [ -C ] + mdevd [ -v <em>verbosity</em> ] [ -D <em>notif</em> ] [ -I <em>intake</em> ] [ -o <em>outputfd</em> ] [ -I <em>intake</em> ] [ -O <em>nlgroups</em> ] [ -b <em>kbufsz</em> ] [ -f <em>conffile</em> ] [ -n | -N ] [ -s <em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ] [ -C ] </pre> <ul> @@ -126,6 +126,9 @@ from mdevd at coldplug time, try increasing this number. </li> <li> <tt>-n</tt> : dry run. mdevd will not create or delete device nodes, and it will not spawn commands. Instead, it will print to stdout the actions it would have performed. </li> + <li> <tt>-N</tt> : configuration file test. mdevd will not run, it will +only parse its configuration file and exit 0 on success or nonzero (with an +error message) on failure. This option overrides, and is overridden by, <tt>-n</tt>. </li> <li> <tt>-f</tt> <em>conffile</em> : read the configuration file from <em>conffile</em>. Default is <tt>/etc/mdev.conf</tt>. <em>conffile</em> must be an absolute path. </li> diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c index f5222f7..c34bf58 100644 --- a/src/mdevd/mdevd.c +++ b/src/mdevd/mdevd.c @@ -43,7 +43,7 @@ #include <mdevd/config.h> #include "mdevd-internal.h" -#define USAGE "mdevd [ -v verbosity ] [ -D notif ] [ -I intake ] [ -o outputfd ] [ -O nlgroups ] [ -b kbufsz ] [ -f conffile ] [ -n ] [ -s slashsys ] [ -d slashdev ] [ -F fwbase ] [ -C ]" +#define USAGE "mdevd [ -v verbosity ] [ -D notif ] [ -I intake ] [ -o outputfd ] [ -O nlgroups ] [ -b kbufsz ] [ -f conffile ] [ -n | -N ] [ -s slashsys ] [ -d slashdev ] [ -F fwbase ] [ -C ]" #define dieusage() strerr_dieusage(100, USAGE) #define CONFBUFSIZE 8192 @@ -915,11 +915,12 @@ int main (int argc, char const *const *argv) subgetopt l = SUBGETOPT_ZERO ; for (;;) { - int opt = subgetopt_r(argc, argv, "nv:D:I:o:O:b:f:s:d:F:C", &l) ; + int opt = subgetopt_r(argc, argv, "nNv:D:I:o:O:b:f:s:d:F:C", &l) ; if (opt == -1) break ; switch (opt) { case 'n' : dryrun = 1 ; break ; + case 'N' : dryrun = 2 ; break ; case 'v' : if (!uint0_scan(l.arg, &verbosity)) dieusage() ; break ; case 'D' : if (!uint0_scan(l.arg, ¬if)) dieusage() ; break ; case 'I' : if (!uint0_scan(l.arg, &intake)) dieusage() ; break ; @@ -1023,6 +1024,7 @@ int main (int argc, char const *const *argv) memset(script, 0, scriptlen * sizeof(scriptelem)) ; script[scriptlen++] = scriptelem_catchall ; script_secondpass(storage, script, envmatch) ; + if (dryrun == 2) break ; cont = 2 ; if (docoldplug) { |
