[systemd-commits] 3 commits - Makefile.am src/fstab-generator src/libsystemd-network src/udev

Lennart Poettering lennart at kemper.freedesktop.org
Mon Jan 5 04:20:38 PST 2015


 Makefile.am                            |    3 +
 src/fstab-generator/fstab-generator.c  |    7 +++-
 src/libsystemd-network/lldp-internal.h |    2 -
 src/libsystemd-network/sd-lldp.c       |   12 +++----
 src/udev/accelerometer/accelerometer.c |   12 ++++---
 src/udev/collect/collect.c             |   14 +++++---
 src/udev/scsi_id/scsi_id.c             |   28 +++++++++--------
 src/udev/udev-builtin-blkid.c          |    2 -
 src/udev/udev-builtin-hwdb.c           |    2 -
 src/udev/udev-builtin-input_id.c       |    2 -
 src/udev/udev-builtin-keyboard.c       |    2 -
 src/udev/udev-builtin-kmod.c           |    2 -
 src/udev/udev-builtin-net_id.c         |    2 -
 src/udev/udev-builtin-net_setup_link.c |    2 -
 src/udev/udev-builtin-path_id.c        |    2 -
 src/udev/udev-builtin-uaccess.c        |    2 -
 src/udev/udev-builtin-usb_id.c         |    2 -
 src/udev/udev-builtin.c                |    2 -
 src/udev/udevadm-control.c             |   25 ++++++++-------
 src/udev/udevadm-info.c                |   52 +++++++++++++++++----------------
 src/udev/udevadm-monitor.c             |   19 ++++++------
 src/udev/udevadm-settle.c              |   13 +++++---
 src/udev/udevadm-test-builtin.c        |   12 +++++--
 src/udev/udevadm-test.c                |   19 ++++++++----
 src/udev/udevadm-trigger.c             |   39 +++++++++++++-----------
 src/udev/udevadm.c                     |    9 +++--
 src/udev/udevd.c                       |   17 +++++-----
 src/udev/v4l_id/v4l_id.c               |   19 ++++++------
 28 files changed, 185 insertions(+), 139 deletions(-)

New commits:
commit 5ac0162c3af95efa08a07b84ff62ad32842922c7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jan 5 13:19:55 2015 +0100

    udevadm,..: make --help output of udev tools more like the output of the various other tools

diff --git a/Makefile.am b/Makefile.am
index 10fc8a9..0b46a12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3778,7 +3778,8 @@ v4l_id_SOURCES = \
 	src/udev/v4l_id/v4l_id.c
 
 v4l_id_LDADD = \
-	libudev-internal.la
+	libudev-internal.la \
+	libsystemd-shared.la
 
 udevlibexec_PROGRAMS += \
 	v4l_id
diff --git a/src/udev/accelerometer/accelerometer.c b/src/udev/accelerometer/accelerometer.c
index 9c13d97..0f1b3c6 100644
--- a/src/udev/accelerometer/accelerometer.c
+++ b/src/udev/accelerometer/accelerometer.c
@@ -195,11 +195,13 @@ static void test_orientation(struct udev *udev,
         puts(text);
 }
 
-static void help(void)
-{
-        printf("Usage: accelerometer [options] <device path>\n"
-               "  -d,--debug         debug to stderr\n"
-               "  -h,--help          print this help text\n\n");
+static void help(void) {
+
+        printf("%s [options] <device path>\n\n"
+               "Accelerometer device identification.\n\n"
+               "  -h --help  Print this message\n"
+               "  -d --debug Debug to stderr\n"
+               , program_invocation_short_name);
 }
 
 int main (int argc, char** argv)
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 11a618c..4bb6edb 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -68,17 +68,19 @@ noreturn static void sig_alrm(int signo)
 
 static void usage(void)
 {
-        printf("Usage: collect [options] <checkpoint> <id> <idlist>\n"
-               "  -a,--add         add ID <id> to the list <idlist>\n"
-               "  -r,--remove      remove ID <id> from the list <idlist>\n"
-               "  -d,--debug       debug to stderr\n"
-               "  -h,--help        print this help text\n\n"
+        printf("%s [options] <checkpoint> <id> <idlist>\n\n"
+               "Collect variables across events.\n\n"
+               "  -h --help        Print this message\n"
+               "  -a --add         Add ID <id> to the list <idlist>\n"
+               "  -r --remove      Remove ID <id> from the list <idlist>\n"
+               "  -d --debug       Debug to stderr\n\n"
                "  Adds ID <id> to the list governed by <checkpoint>.\n"
                "  <id> must be part of the list <idlist>.\n"
                "  If all IDs given by <idlist> are listed (ie collect has been\n"
                "  invoked for each ID in <idlist>) collect returns 0, the\n"
                "  number of missing IDs otherwise.\n"
-               "  On error a negative number is returned.\n\n");
+               "  On error a negative number is returned.\n\n"
+               , program_invocation_short_name);
 }
 
 /*
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 5270233..a1b8e75 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -304,18 +304,20 @@ static int get_file_options(struct udev *udev,
 }
 
 static void help(void) {
-        printf("Usage: scsi_id [OPTION...] DEVICE\n"
-               "  -d,--device=                     device node for SG_IO commands\n"
-               "  -f,--config=                     location of config file\n"
-               "  -p,--page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)\n"
-               "  -s,--sg-version=3|4              use SGv3 or SGv4\n"
-               "  -b,--blacklisted                 treat device as blacklisted\n"
-               "  -g,--whitelisted                 treat device as whitelisted\n"
-               "  -u,--replace-whitespace          replace all whitespace by underscores\n"
-               "  -v,--verbose                     verbose logging\n"
-               "  -V,--version                     print version\n"
-               "  -x,--export                      print values as environment keys\n"
-               "  -h,--help                        print this help text\n\n");
+        printf("Usage: %s [OPTION...] DEVICE\n\n"
+               "SCSI device identification.\n\n"
+               "  -h --help                        Print this message\n"
+               "     --version                     Print version of the program\n\n"
+               "  -d --device=                     Device node for SG_IO commands\n"
+               "  -f --config=                     Location of config file\n"
+               "  -p --page=0x80|0x83|pre-spc3-83  SCSI page (0x80, 0x83, pre-spc3-83)\n"
+               "  -s --sg-version=3|4              Use SGv3 or SGv4\n"
+               "  -b --blacklisted                 Treat device as blacklisted\n"
+               "  -g --whitelisted                 Treat device as whitelisted\n"
+               "  -u --replace-whitespace          Replace all whitespace by underscores\n"
+               "  -v --verbose                     Verbose logging\n"
+               "  -x --export                      Print values as environment keys\n"
+               , program_invocation_short_name);
 
 }
 
@@ -606,7 +608,7 @@ int main(int argc, char **argv)
                 exit(1);
 
         if (!dev_specified) {
-                log_error("no device specified");
+                log_error("No device specified.");
                 retval = 1;
                 goto exit;
         }
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 83bd8c4..548985e 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -325,6 +325,6 @@ out:
 const struct udev_builtin udev_builtin_blkid = {
         .name = "blkid",
         .cmd = builtin_blkid,
-        .help = "filesystem and partition probing",
+        .help = "Filesystem and partition probing",
         .run_once = true,
 };
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index e8301c6..9547664 100644
--- a/src/udev/udev-builtin-hwdb.c
+++ b/src/udev/udev-builtin-hwdb.c
@@ -216,5 +216,5 @@ const struct udev_builtin udev_builtin_hwdb = {
         .init = builtin_hwdb_init,
         .exit = builtin_hwdb_exit,
         .validate = builtin_hwdb_validate,
-        .help = "hardware database",
+        .help = "Hardware database",
 };
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 1a1121e..a328912 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -222,5 +222,5 @@ static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], boo
 const struct udev_builtin udev_builtin_input_id = {
         .name = "input_id",
         .cmd = builtin_input_id,
-        .help = "input device properties",
+        .help = "Input device properties",
 };
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index 273b27d..118e797 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -165,5 +165,5 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
 const struct udev_builtin udev_builtin_keyboard = {
         .name = "keyboard",
         .cmd = builtin_keyboard,
-        .help = "keyboard scan code to key mapping",
+        .help = "Keyboard scan code to key mapping",
 };
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index 0949d9f..ad2829e 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -122,6 +122,6 @@ const struct udev_builtin udev_builtin_kmod = {
         .init = builtin_kmod_init,
         .exit = builtin_kmod_exit,
         .validate = builtin_kmod_validate,
-        .help = "kernel module loader",
+        .help = "Kernel module loader",
         .run_once = false,
 };
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 95e5452..2e08467 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -562,5 +562,5 @@ out:
 const struct udev_builtin udev_builtin_net_id = {
         .name = "net_id",
         .cmd = builtin_net_id,
-        .help = "network device properties",
+        .help = "Network device properties",
 };
diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
index 55b6241..d458947 100644
--- a/src/udev/udev-builtin-net_setup_link.c
+++ b/src/udev/udev-builtin-net_setup_link.c
@@ -103,6 +103,6 @@ const struct udev_builtin udev_builtin_net_setup_link = {
         .init = builtin_net_setup_link_init,
         .exit = builtin_net_setup_link_exit,
         .validate = builtin_net_setup_link_validate,
-        .help = "configure network link",
+        .help = "Configure network link",
         .run_once = false,
 };
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index d540ba8..b6749aa 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -703,6 +703,6 @@ out:
 const struct udev_builtin udev_builtin_path_id = {
         .name = "path_id",
         .cmd = builtin_path_id,
-        .help = "compose persistent device path",
+        .help = "Compose persistent device path",
         .run_once = true,
 };
diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c
index 5919154..b78c09b 100644
--- a/src/udev/udev-builtin-uaccess.c
+++ b/src/udev/udev-builtin-uaccess.c
@@ -89,5 +89,5 @@ finish:
 const struct udev_builtin udev_builtin_uaccess = {
         .name = "uaccess",
         .cmd = builtin_uaccess,
-        .help = "manage device node user ACL",
+        .help = "Manage device node user ACL",
 };
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index 06d4191..ab0d96e 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -471,6 +471,6 @@ fallback:
 const struct udev_builtin udev_builtin_usb_id = {
         .name = "usb_id",
         .cmd = builtin_usb_id,
-        .help = "usb device properties",
+        .help = "USB device properties",
         .run_once = true,
 };
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index 3bcbd6e..1950ec2 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -88,7 +88,7 @@ void udev_builtin_list(struct udev *udev) {
         unsigned int i;
 
         for (i = 0; i < ELEMENTSOF(builtins); i++)
-                fprintf(stderr, "  %-12s %s\n", builtins[i]->name, builtins[i]->help);
+                fprintf(stderr, "  %-14s  %s\n", builtins[i]->name, builtins[i]->help);
 }
 
 const char *udev_builtin_name(enum udev_builtin_cmd cmd) {
diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c
index 6e3bc2a..6af7163 100644
--- a/src/udev/udevadm-control.c
+++ b/src/udev/udevadm-control.c
@@ -29,16 +29,19 @@
 #include "udev-util.h"
 
 static void print_help(void) {
-        printf("Usage: udevadm control COMMAND\n"
-                "  -e,--exit                 instruct the daemon to cleanup and exit\n"
-                "  -l,--log-priority=LEVEL   set the udev log level for the daemon\n"
-                "  -s,--stop-exec-queue      do not execute events, queue only\n"
-                "  -S,--start-exec-queue     execute events, flush queue\n"
-                "  -R,--reload               reload rules and databases\n"
-                "  -p,--property=KEY=VALUE   set a global property for all events\n"
-                "  -m,--children-max=N       maximum number of children\n"
-                "     --timeout=SECONDS      maximum time to block for a reply\n"
-                "  -h,--help                 print this help text\n\n");
+        printf("%s control COMMAND\n\n"
+               "Control the udev daemon.\n\n"
+               "  -h --help                Show this help\n"
+               "     --version             Show package version\n"
+               "  -e --exit                Instruct the daemon to cleanup and exit\n"
+               "  -l --log-priority=LEVEL  Set the udev log level for the daemon\n"
+               "  -s --stop-exec-queue     Do not execute events, queue only\n"
+               "  -S --start-exec-queue    Execute events, flush queue\n"
+               "  -R --reload              Reload rules and databases\n"
+               "  -p --property=KEY=VALUE  Set a global property for all events\n"
+               "  -m --children-max=N      Maximum number of children\n"
+               "     --timeout=SECONDS     Maximum time to block for a reply\n"
+               , program_invocation_short_name);
 }
 
 static int adm_control(struct udev *udev, int argc, char *argv[]) {
@@ -161,5 +164,5 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) {
 const struct udevadm_cmd udevadm_control = {
         .name = "control",
         .cmd = adm_control,
-        .help = "control the udev daemon",
+        .help = "Control the udev daemon",
 };
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index a56f159..f52a03d 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -258,6 +258,31 @@ static void cleanup_db(struct udev *udev) {
         }
 }
 
+static void help(void) {
+
+        printf("%s info [OPTIONS] [DEVPATH|FILE]\n\n"
+               "Query sysfs or the udev database.\n\n"
+               "  -h --help                   Print this message\n"
+               "     --version                Print version of the program\n"
+               "  -q --query=TYPE             Query device information:\n"
+               "       name                     Name of device node\n"
+               "       symlink                  Pointing to node\n"
+               "       path                     sysfs device path\n"
+               "       property                 The device properties\n"
+               "       all                      All values\n"
+               "  -p --path=SYSPATH           sysfs device path used for query or attribute walk\n"
+               "  -n --name=NAME              Node or symlink name used for query or attribute walk\n"
+               "  -r --root                   Prepend dev directory to path names\n"
+               "  -a --attribute-walk         Print all key matches walking along the chain\n"
+               "                              of parent devices\n"
+               "  -d --device-id-of-file=FILE Print major:minor of device containing this file\n"
+               "  -x --export                 Export key/value pairs\n"
+               "  -P --export-prefix          Export the key name with a prefix\n"
+               "  -e --export-db              Export the content of the udev database\n"
+               "  -c --cleanup-db             Clean up the udev database\n"
+               , program_invocation_short_name);
+}
+
 static int uinfo(struct udev *udev, int argc, char *argv[]) {
         _cleanup_udev_device_unref_ struct udev_device *device = NULL;
         bool root = 0;
@@ -283,27 +308,6 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) {
                 {}
         };
 
-        static const char *usage =
-                "Usage: udevadm info [OPTIONS] [DEVPATH|FILE]\n"
-                " -q,--query=TYPE             query device information:\n"
-                "      name                     name of device node\n"
-                "      symlink                  pointing to node\n"
-                "      path                     sys device path\n"
-                "      property                 the device properties\n"
-                "      all                      all values\n"
-                " -p,--path=SYSPATH           sys device path used for query or attribute walk\n"
-                " -n,--name=NAME              node or symlink name used for query or attribute walk\n"
-                " -r,--root                   prepend dev directory to path names\n"
-                " -a,--attribute-walk         print all key matches walking along the chain\n"
-                "                             of parent devices\n"
-                " -d,--device-id-of-file=FILE print major:minor of device containing this file\n"
-                " -x,--export                 export key/value pairs\n"
-                " -P,--export-prefix          export the key name with a prefix\n"
-                " -e,--export-db              export the content of the udev database\n"
-                " -c,--cleanup-db             cleanup the udev database\n"
-                "    --version                print version of the program\n"
-                " -h,--help                   print this message\n";
-
         enum action_type {
                 ACTION_QUERY,
                 ACTION_ATTRIBUTE_WALK,
@@ -388,7 +392,7 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) {
                         printf("%s\n", VERSION);
                         return 0;
                 case 'h':
-                        printf("%s\n", usage);
+                        help();
                         return 0;
                 default:
                         return 1;
@@ -398,7 +402,7 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) {
         case ACTION_QUERY:
                 if (!device) {
                         if (!argv[optind]) {
-                                fprintf(stderr, "%s\n", usage);
+                                help();
                                 return 2;
                         }
                         device = find_device(udev, argv[optind], NULL);
@@ -489,5 +493,5 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) {
 const struct udevadm_cmd udevadm_info = {
         .name = "info",
         .cmd = uinfo,
-        .help = "query sysfs or the udev database",
+        .help = "Query sysfs or the udev database",
 };
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 1a5f516..15ded09 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -64,13 +64,16 @@ static void print_device(struct udev_device *device, const char *source, int pro
 }
 
 static void help(void) {
-        printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n"
-               "  -p,--property                            print the event properties\n"
-               "  -k,--kernel                              print kernel uevents\n"
-               "  -u,--udev                                print udev events\n"
-               "  -s,--subsystem-match=SUBSYSTEM[/DEVTYPE] filter events by subsystem\n"
-               "  -t,--tag-match=TAG                       filter events by tag\n"
-               "  -h,--help\n\n");
+        printf("%s monitor [--property] [--kernel] [--udev] [--help]\n\n"
+               "Listen to kernel and udev events.\n\n"
+               "  -h --help                                Show this help\n"
+               "     --version                             Show package version\n"
+               "  -p --property                            Print the event properties\n"
+               "  -k --kernel                              Print kernel uevents\n"
+               "  -u --udev                                Print udev events\n"
+               "  -s --subsystem-match=SUBSYSTEM[/DEVTYPE] Filter events by subsystem\n"
+               "  -t --tag-match=TAG                       Filter events by tag\n"
+               , program_invocation_short_name);
 }
 
 static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
@@ -276,5 +279,5 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
 const struct udevadm_cmd udevadm_monitor = {
         .name = "monitor",
         .cmd = adm_monitor,
-        .help = "listen to kernel and udev events",
+        .help = "Listen to kernel and udev events",
 };
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index ddcf1dd..9eab8b2 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -37,10 +37,13 @@
 #include "util.h"
 
 static void help(void) {
-        printf("Usage: udevadm settle OPTIONS\n"
-               "  -t,--timeout=<seconds>     maximum time to wait for events\n"
-               "  -E,--exit-if-exists=<file> stop waiting if file exists\n"
-               "  -h,--help\n\n");
+        printf("%s settle OPTIONS\n\n"
+               "Wait for pending udev events.\n\n"
+               "  -h --help                 Show this help\n"
+               "     --version              Show package version\n"
+               "  -t --timeout=SECONDS      Maximum time to wait for events\n"
+               "  -E --exit-if-exists=FILE  Stop waiting if file exists\n"
+               , program_invocation_short_name);
 }
 
 static int adm_settle(struct udev *udev, int argc, char *argv[]) {
@@ -145,5 +148,5 @@ out:
 const struct udevadm_cmd udevadm_settle = {
         .name = "settle",
         .cmd = adm_settle,
-        .help = "wait for pending udev events",
+        .help = "Wait for pending udev events",
 };
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c
index a300e1e..b2a7376 100644
--- a/src/udev/udevadm-test-builtin.c
+++ b/src/udev/udevadm-test-builtin.c
@@ -34,10 +34,14 @@
 #include "udev.h"
 
 static void help(struct udev *udev) {
-        fprintf(stderr, "\n");
-        fprintf(stderr, "Usage: udevadm builtin [--help] COMMAND SYSPATH\n");
+        printf("%s builtin [--help] COMMAND SYSPATH\n\n"
+               "Test a built-in command.\n\n"
+               "  -h --help     Print this message\n"
+               "     --version  Print version of the program\n\n"
+               "Commands:\n"
+               , program_invocation_short_name);
+
         udev_builtin_list(udev);
-        fprintf(stderr, "\n");
 }
 
 static int adm_builtin(struct udev *udev, int argc, char *argv[]) {
@@ -112,6 +116,6 @@ out:
 const struct udevadm_cmd udevadm_test_builtin = {
         .name = "test-builtin",
         .cmd = adm_builtin,
-        .help = "test a built-in command",
+        .help = "Test a built-in command",
         .debug = true,
 };
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index d9d61b4..4922b5b 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -31,6 +31,17 @@
 #include "udev.h"
 #include "udev-util.h"
 
+static void help(void) {
+
+        printf("%s test OPTIONS <syspath>\n\n"
+               "Test an event run.\n"
+               "  -h --help                            Show this help\n"
+               "     --version                         Show package version\n"
+               "  -a --action=ACTION                   Set action string\n"
+               "  -N --resolve-names=early|late|never  When to resolve names\n"
+               , program_invocation_short_name);
+}
+
 static int adm_test(struct udev *udev, int argc, char *argv[]) {
         int resolve_names = 1;
         char filename[UTIL_PATH_SIZE];
@@ -71,11 +82,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
                         }
                         break;
                 case 'h':
-                        printf("Usage: udevadm test OPTIONS <syspath>\n"
-                               "  -a,--action=ACTION                  set action string\n"
-                               "  -N,--resolve-names=early|late|never when to resolve names\n"
-                               "  -h,--help                           print this help string\n"
-                               "\n");
+                        help();
                         exit(EXIT_SUCCESS);
                 case '?':
                         exit(EXIT_FAILURE);
@@ -161,6 +168,6 @@ out:
 const struct udevadm_cmd udevadm_test = {
         .name = "test",
         .cmd = adm_test,
-        .help = "test an event run",
+        .help = "Test an event run",
         .debug = true,
 };
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 4308466..4dc756a 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -73,23 +73,26 @@ static const char *keyval(const char *str, const char **val, char *buf, size_t s
 }
 
 static void help(void) {
-        printf("Usage: udevadm trigger OPTIONS\n"
-               "  -v,--verbose                       print the list of devices while running\n"
-               "  -n,--dry-run                       do not actually trigger the events\n"
-               "  -t,--type=                         type of events to trigger\n"
-               "          devices                       sys devices (default)\n"
-               "          subsystems                    sys subsystems and drivers\n"
-               "  -c,--action=<action>               event action value, default is \"change\"\n"
-               "  -s,--subsystem-match=<subsystem>   trigger devices from a matching subsystem\n"
-               "  -S,--subsystem-nomatch=<subsystem> exclude devices from a matching subsystem\n"
-               "  -a,--attr-match=<file[=<value>]>   trigger devices with a matching attribute\n"
-               "  -A,--attr-nomatch=<file[=<value>]> exclude devices with a matching attribute\n"
-               "  -p,--property-match=<key>=<value>  trigger devices with a matching property\n"
-               "  -g,--tag-match=<key>=<value>       trigger devices with a matching property\n"
-               "  -y,--sysname-match=<name>          trigger devices with this /sys path\n"
-               "     --name-match=<name>             trigger devices with this /dev name\n"
-               "  -b,--parent-match=<name>           trigger devices with that parent device\n"
-               "  -h,--help\n\n");
+        printf("%s trigger OPTIONS\n\n"
+               "Request events from the kernel.\n\n"
+               "  -h --help                         Show this help\n"
+               "     --version                      Show package version\n"
+               "  -v --verbose                      Print the list of devices while running\n"
+               "  -n --dry-run                      Do not actually trigger the events\n"
+               "  -t --type=                        Type of events to trigger\n"
+               "          devices                     sysfs devices (default)\n"
+               "          subsystems                  sysfs subsystems and drivers\n"
+               "  -c --action=ACTION                Event action value, default is \"change\"\n"
+               "  -s --subsystem-match=SUBSYSTEM    Trigger devices from a matching subsystem\n"
+               "  -S --subsystem-nomatch=SUBSYSTEM  Exclude devices from a matching subsystem\n"
+               "  -a --attr-match=FILE[=VALUE]      Trigger devices with a matching attribute\n"
+               "  -A --attr-nomatch=FILE[=VALUE]    Exclude devices with a matching attribute\n"
+               "  -p --property-match=KEY=VALUE     Trigger devices with a matching property\n"
+               "  -g --tag-match=KEY=VALUE          Trigger devices with a matching property\n"
+               "  -y --sysname-match=NAME           Trigger devices with this /sys path\n"
+               "     --name-match=NAME              Trigger devices with this /dev name\n"
+               "  -b --parent-match=NAME            Trigger devices with that parent device\n"
+               , program_invocation_short_name);
 }
 
 static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
@@ -245,5 +248,5 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
 const struct udevadm_cmd udevadm_trigger = {
         .name = "trigger",
         .cmd = adm_trigger,
-        .help = "request events from the kernel",
+        .help = "Request events from the kernel",
 };
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index a957e92..56cd0cd 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -60,11 +60,14 @@ static const struct udevadm_cmd *udevadm_cmds[] = {
 static int adm_help(struct udev *udev, int argc, char *argv[]) {
         unsigned int i;
 
-        fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n");
+        printf("%s [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n\n"
+               "Send control commands or test the device manager.\n\n"
+               "Commands:\n"
+               , program_invocation_short_name);
+
         for (i = 0; i < ELEMENTSOF(udevadm_cmds); i++)
                 if (udevadm_cmds[i]->help != NULL)
-                        printf("  %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help);
-        fprintf(stderr, "\n");
+                        printf("  %-12s  %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help);
         return 0;
 }
 
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 3edb29b..009e395 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1004,14 +1004,15 @@ static void kernel_cmdline_options(struct udev *udev) {
 static void help(void) {
         printf("%s [OPTIONS...]\n\n"
                "Manages devices.\n\n"
-               "  --daemon\n"
-               "  --debug\n"
-               "  --children-max=<maximum number of workers>\n"
-               "  --exec-delay=<seconds to wait before executing RUN=>\n"
-               "  --event-timeout=<seconds to wait before terminating an event>\n"
-               "  --resolve-names=early|late|never\n"
-               "  --version\n"
-               "  --help\n"
+               "  -h --help                   Print this message\n"
+               "     --version                Print version of the program\n"
+               "     --daemon                 Detach and run in the background\n"
+               "     --debug                  Enable debug output\n"
+               "     --children-max=INT       Set maximum number of workers\n"
+               "     --exec-delay=SECONDS     Seconds to wait before executing RUN=\n"
+               "     --event-timeout=SECONDS  Seconds to wait before terminating an event\n"
+               "     --resolve-names=early|late|never\n"
+               "                              When to resolve users and groups\n"
                , program_invocation_short_name);
 }
 
diff --git a/src/udev/v4l_id/v4l_id.c b/src/udev/v4l_id/v4l_id.c
index 08d3efa..0ebe434 100644
--- a/src/udev/v4l_id/v4l_id.c
+++ b/src/udev/v4l_id/v4l_id.c
@@ -26,17 +26,18 @@
 #include <sys/ioctl.h>
 #include <linux/videodev2.h>
 
-int main (int argc, char *argv[])
-{
+#include "util.h"
+
+int main(int argc, char *argv[]) {
         static const struct option options[] = {
                 { "help", no_argument, NULL, 'h' },
                 {}
         };
-        int fd;
+        _cleanup_close_ int fd = -1;
         char *device;
         struct v4l2_capability v2cap;
 
-        while (1) {
+        for (;;) {
                 int option;
 
                 option = getopt_long(argc, argv, "h", options, NULL);
@@ -45,7 +46,10 @@ int main (int argc, char *argv[])
 
                 switch (option) {
                 case 'h':
-                        printf("Usage: v4l_id [-h,--help] <device file>\n\n");
+                        printf("%s [-h,--help] <device file>\n\n"
+                               "Video4Linux device identification.\n\n"
+                               "  -h  Print this message\n"
+                               , program_invocation_short_name);
                         return 0;
                 default:
                         return 1;
@@ -55,11 +59,11 @@ int main (int argc, char *argv[])
 
         if (device == NULL)
                 return 2;
-        fd = open (device, O_RDONLY);
+        fd = open(device, O_RDONLY);
         if (fd < 0)
                 return 3;
 
-        if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) {
+        if (ioctl(fd, VIDIOC_QUERYCAP, &v2cap) == 0) {
                 printf("ID_V4L_VERSION=2\n");
                 printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
                 printf("ID_V4L_CAPABILITIES=:");
@@ -78,6 +82,5 @@ int main (int argc, char *argv[])
                 printf("\n");
         }
 
-        close (fd);
         return 0;
 }

commit 00b4ffdecbb39d849af65c0ab741be482325a4a9
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Jan 5 12:35:08 2015 +0100

    fstab-generator: use more appropriate checks for swap and device availability
    
    We always should use the same checks when deciding whether swap support
    and mounting of devices is supported. Hence, let's make
    fstab-generator's logic more similar to the usual logic we follow:
    
    a) Look for /proc/swaps and no container support before activating
    swaps.
    
    b) Look for /sys being writable befire supporting device mounts.

diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 1f34594..496657b 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -87,6 +87,11 @@ static int add_swap(
         assert(what);
         assert(me);
 
+        if (access("/proc/swaps", F_OK) < 0) {
+                log_info("Swap not supported, ignoring fstab swap entry for %s.", what);
+                return 0;
+        }
+
         if (detect_container(NULL) > 0) {
                 log_info("Running in a container, ignoring fstab swap entry for %s.", what);
                 return 0;
@@ -355,7 +360,7 @@ static int parse_fstab(bool initrd) {
                 if (!what)
                         return log_oom();
 
-                if (detect_container(NULL) > 0 && is_device_path(what)) {
+                if (is_device_path(what) && path_is_read_only_fs("sys") > 0) {
                         log_info("Running in a container, ignoring fstab device entry for %s.", what);
                         continue;
                 }

commit 6b3fd9a14d378a35d95ec4be65065708d092bee2
Author: Torstein Husebø <torstein at huseboe.net>
Date:   Mon Jan 5 09:55:11 2015 +0100

    libsystemd-network: fix typo in lldp

diff --git a/src/libsystemd-network/lldp-internal.h b/src/libsystemd-network/lldp-internal.h
index c7235c1..8e09ee8 100644
--- a/src/libsystemd-network/lldp-internal.h
+++ b/src/libsystemd-network/lldp-internal.h
@@ -31,7 +31,7 @@
 typedef struct lldp_neighbour_port lldp_neighbour_port;
 typedef struct lldp_chassis lldp_chassis;
 typedef struct lldp_chassis_id lldp_chassis_id;
-typedef struct lldp_agent_statitics lldp_agent_statitics;
+typedef struct lldp_agent_statistics lldp_agent_statistics;
 
 struct lldp_neighbour_port {
         uint8_t type;
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index 86c734b..19ef2cc 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -48,7 +48,7 @@ typedef enum LLDPAgentRXState {
 } LLDPAgentRXState;
 
 /* Section 10.5.2.2 Reception counters */
-struct lldp_agent_statitics {
+struct lldp_agent_statistics {
         uint64_t stats_ageouts_total;
         uint64_t stats_frames_discarded_total;
         uint64_t stats_frames_in_errors_total;
@@ -68,7 +68,7 @@ struct sd_lldp {
         void *userdata;
 
         LLDPAgentRXState rx_state;
-        lldp_agent_statitics statitics;
+        lldp_agent_statistics statistics;
 };
 
 static unsigned long chassis_id_hash_func(const void *p,
@@ -134,7 +134,7 @@ static int lldp_receive_frame(sd_lldp *lldp, tlv_packet *tlv) {
                  hashmap_size(lldp->neighbour_mib),
                  prioq_size(lldp->by_expiry));
 
-        lldp->statitics.stats_frames_in_total ++;
+        lldp->statistics.stats_frames_in_total ++;
 
         return 0;
 
@@ -339,8 +339,8 @@ int lldp_handle_packet(tlv_packet *tlv, uint16_t length) {
         lldp_set_state(lldp, LLDP_AGENT_RX_WAIT_FOR_FRAME);
 
         if (malformed) {
-                lldp->statitics.stats_frames_discarded_total ++;
-                lldp->statitics.stats_frames_in_errors_total ++;
+                lldp->statistics.stats_frames_discarded_total ++;
+                lldp->statistics.stats_frames_in_errors_total ++;
         }
 
         tlv_packet_free(tlv);
@@ -404,7 +404,7 @@ static void lldp_mib_delete_objects(sd_lldp *lldp) {
 
                 lldp_neighbour_port_remove_and_free(p);
 
-                lldp->statitics.stats_ageouts_total ++;
+                lldp->statistics.stats_ageouts_total ++;
         }
 }
 



More information about the systemd-commits mailing list