]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bsod: several cleanups 28926/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Aug 2023 13:54:43 +0000 (22:54 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Aug 2023 14:20:14 +0000 (23:20 +0900)
- add reference to the service unit in the man page,
- fix several indentation and typos,
- replace '(uint64_t) -1' with 'UINT64_MAX',
- drop unnecessary 'continue'.

man/rules/meson.build
man/systemd-bsod.service.xml [moved from man/systemd-bsod.xml with 59% similarity]
src/journal/bsod.c
src/journal/meson.build
units/meson.build
units/systemd-bsod.service.in

index ca1a2cc1eb677a4d05389291d3fdebfeb0edb16b..eaaf4adb1bd1cdde8cd7e467d7937b9e6095a919 100644 (file)
@@ -902,7 +902,7 @@ manpages = [
   ''],
  ['systemd-boot-random-seed.service', '8', [], 'ENABLE_BOOTLOADER'],
  ['systemd-boot', '7', ['sd-boot'], 'ENABLE_BOOTLOADER'],
- ['systemd-bsod', '8', [], 'HAVE_QRENCODE'],
+ ['systemd-bsod.service', '8', ['systemd-bsod'], 'HAVE_QRENCODE'],
  ['systemd-cat', '1', [], ''],
  ['systemd-cgls', '1', [], ''],
  ['systemd-cgtop', '1', [], ''],
similarity index 59%
rename from man/systemd-bsod.xml
rename to man/systemd-bsod.service.xml
index 86efb29db0809da215309831bc69becf6dca75af..8530468d1dc2f279ed2a48873827fba6ddde8abb 100644 (file)
@@ -3,7 +3,7 @@
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
 
-<refentry id="systemd-bsod" conditional='HAVE_QRENCODE' xmlns:xi="http://www.w3.org/2001/XInclude">
+<refentry id="systemd-bsod.service" conditional='HAVE_QRENCODE' xmlns:xi="http://www.w3.org/2001/XInclude">
 
   <refentryinfo>
     <title>systemd-bsod</title>
   </refentryinfo>
 
   <refmeta>
-    <refentrytitle>systemd-bsod</refentrytitle>
+    <refentrytitle>systemd-bsod.service</refentrytitle>
     <manvolnum>8</manvolnum>
   </refmeta>
 
   <refnamediv>
+    <refname>systemd-bsod.service</refname>
     <refname>systemd-bsod</refname>
-    <refpurpose>Displays boot-time emergency log message full-screen.</refpurpose>
+    <refpurpose>Displays boot-time emergency log message in full screen.</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
+    <para><filename>systemd-bsod.service</filename></para>
     <cmdsynopsis>
       <command>systemd-bsod</command>
       <arg choice="opt" rep="repeat">OPTIONS</arg>
   <refsect1>
     <title>Description</title>
 
-    <para><command>systemd-bsod</command> is used to display a blue screen which contains a message relating to
-        a boot failure, including a QR code which users can scan with their phones to get helpful information
-        about the cause of their boot failure.</para>
+    <para><filename>systemd-bsod.service</filename> is used to display a blue screen which contains a message
+    relating to a boot failure, including a QR code which can be scanned to get helpful information about the
+    failure.</para>
   </refsect1>
 
   <refsect1>
     <title>Options</title>
 
-    <para>The following options are understood:</para>
+    <para>The following options are understood by <command>systemd-bsod</command>:</para>
 
     <variablelist>
       <xi:include href="standard-options.xml" xpointer="help" />
       <xi:include href="standard-options.xml" xpointer="version" />
 
-     <varlistentry>
+      <varlistentry>
         <term><option>-c</option></term>
         <term><option>--continuous</option></term>
 
-        <listitem><para> Used to make systemd-bsod wait continuously for changes in the
-         journal's status if doesn't find any emergency messages on initial attempt.</para></listitem>
-     </varlistentry>
+        <listitem><para>When specified, <command>systemd-bsod</command> waits continuously for changes in the
+        journal if it doesn't find any emergency messages on the initial attempt.</para></listitem>
+      </varlistentry>
     </variablelist>
 
   </refsect1>
index 76907d2e5cb4685edfda72722c4866cb9926bd28..4e7090cda93fd5fe7db536e645466a3cba837315 100644 (file)
@@ -39,7 +39,7 @@ static int help(void) {
                "   -h --help            Show this help\n"
                "      --version         Show package version\n"
                "   -c --continuous      Make systemd-bsod wait continuously\n"
-               "for changes in the journal\n"
+               "                        for changes in the journal\n"
                "\nSee the %s for details.\n",
                program_invocation_short_name,
                ansi_highlight(),
@@ -77,9 +77,9 @@ static int acquire_first_emergency_log_message(char **ret) {
 
         r = sd_journal_seek_head(j);
         if (r < 0)
-                return log_error_errno(r, "Failed to seek to start of jornal: %m");
+                return log_error_errno(r, "Failed to seek to start of journal: %m");
 
-        for(;;) {
+        for (;;) {
                 r = sd_journal_next(j);
                 if (r < 0)
                         return log_error_errno(r, "Failed to read next journal entry: %m");
@@ -92,11 +92,9 @@ static int acquire_first_emergency_log_message(char **ret) {
                         return 0;
                 }
 
-                r = sd_journal_wait(j, (uint64_t) -1);
+                r = sd_journal_wait(j, UINT64_MAX);
                 if (r < 0)
                         return log_error_errno(r, "Failed to wait for changes: %m");
-
-                continue;
         }
 
         r = sd_journal_get_data(j, "MESSAGE", &d, &l);
@@ -223,9 +221,9 @@ static int parse_argv(int argc, char * argv[]) {
         };
 
         static const struct option options[] = {
-                { "help",    no_argument, NULL, 'h'         },
-                { "version", no_argument, NULL, ARG_VERSION },
-                { "continuous",    no_argument, NULL, 'c'   },
+                { "help",       no_argument, NULL, 'h'         },
+                { "version",    no_argument, NULL, ARG_VERSION },
+                { "continuous", no_argument, NULL, 'c'         },
                 {}
         };
 
@@ -254,6 +252,7 @@ static int parse_argv(int argc, char * argv[]) {
                 default:
                         assert_not_reached();
                 }
+
         if (optind < argc)
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                        "%s takes no argument.",
index 32d73cca828dbfb06bfb1a719927ec58c27b90d7..9b0dc2cf58479d47e3b3929dff1fca188fe58bb2 100644 (file)
@@ -74,6 +74,7 @@ executables += [
         },
         libexec_template + {
                 'name' : 'systemd-bsod',
+                'public' : true,
                 'conditions' : ['HAVE_QRENCODE'],
                 'sources' : files('bsod.c'),
                 'link_with' : libshared,
index cb1be8359965080dcaf1a16644487476cfc5595d..2e649d6e5f0e6f43b9905299c86748fe664454c3 100644 (file)
@@ -62,7 +62,7 @@ units = [
         },
         {
           'file' : 'systemd-bsod.service.in',
-          'conditions' : ['HAVE_QRENCODE','ENABLE_INITRD'],
+          'conditions' : ['HAVE_QRENCODE', 'ENABLE_INITRD'],
           'symlinks' : ['initrd.target.wants/'],
         },
         {
index 306d4a66239b3e672cf532913452d07da07fdbde..2d2f988fbfc60b272247f7965fe240be9b8aa339 100644 (file)
@@ -8,13 +8,13 @@
 #  (at your option) any later version.
 
 [Unit]
-Description=Displays emergency message full screen.
-Documentation=man:systemd-bsod(8)
+Description=Displays emergency message in full screen.
+Documentation=man:systemd-bsod.service(8)
 ConditionVirtualization=no
 DefaultDependencies=no
-Conflicts=shutdown.target
-Before=shutdown.target
 After=systemd-battery-check.service
+Before=shutdown.target
+Conflicts=shutdown.target
 
 [Service]
 RemainAfterExit=yes