summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-01 14:34:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-09-16 18:08:01 +0200
commit2bfa8466c079b81b016f8a4ab7958eb085eb5a7a (patch)
tree44bafd6b137a722115c409ae78ac48c79286e939 /src
parentda33cba0f8cf3d4c23c11218485d8d4f339fc45b (diff)
downloadsystemd-2bfa8466c079b81b016f8a4ab7958eb085eb5a7a.tar.gz
util-lib: move shall_restore_state() to shared/reboot-util
It's just a small function, but it is higher-level functionality. I don't see a good place for it, reboot-util.[ch] seems least bad
Diffstat (limited to 'src')
-rw-r--r--src/backlight/backlight.c2
-rw-r--r--src/basic/proc-cmdline.c11
-rw-r--r--src/basic/proc-cmdline.h2
-rw-r--r--src/rfkill/rfkill.c4
-rw-r--r--src/shared/reboot-util.c12
-rw-r--r--src/shared/reboot-util.h2
6 files changed, 17 insertions, 16 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index dfd6805398..0484414290 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -13,7 +13,7 @@
#include "main-func.h"
#include "mkdir.h"
#include "parse-util.h"
-#include "proc-cmdline.h"
+#include "reboot-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index 5d29774e09..23cda75708 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -306,14 +306,3 @@ int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...) {
return ret;
}
-
-int shall_restore_state(void) {
- bool ret;
- int r;
-
- r = proc_cmdline_get_bool("systemd.restore_state", &ret);
- if (r < 0)
- return r;
-
- return r > 0 ? ret : true;
-}
diff --git a/src/basic/proc-cmdline.h b/src/basic/proc-cmdline.h
index 429e7ca4a4..4115fdbc99 100644
--- a/src/basic/proc-cmdline.h
+++ b/src/basic/proc-cmdline.h
@@ -27,8 +27,6 @@ int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...);
char *proc_cmdline_key_startswith(const char *s, const char *prefix);
bool proc_cmdline_key_streq(const char *x, const char *y);
-int shall_restore_state(void);
-
/* A little helper call, to be used in proc_cmdline_parse_t callbacks */
static inline bool proc_cmdline_value_missing(const char *key, const char *value) {
if (!value) {
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index f9d309c909..501982819a 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -16,15 +16,15 @@
#include "fd-util.h"
#include "fileio.h"
#include "io-util.h"
+#include "list.h"
#include "main-func.h"
#include "mkdir.h"
#include "parse-util.h"
-#include "proc-cmdline.h"
+#include "reboot-util.h"
#include "string-table.h"
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
-#include "list.h"
/* Note that any write is delayed until exit and the rfkill state will not be
* stored for rfkill indices that disappear after a change. */
diff --git a/src/shared/reboot-util.c b/src/shared/reboot-util.c
index 08569e8bf3..5d76299179 100644
--- a/src/shared/reboot-util.c
+++ b/src/shared/reboot-util.c
@@ -6,6 +6,7 @@
#include "alloc-util.h"
#include "fileio.h"
#include "log.h"
+#include "proc-cmdline.h"
#include "raw-reboot.h"
#include "reboot-util.h"
#include "string-util.h"
@@ -96,3 +97,14 @@ int reboot_with_parameter(RebootFlags flags) {
return log_full_errno(flags & REBOOT_LOG ? LOG_ERR : LOG_DEBUG, errno, "Failed to reboot: %m");
}
+
+int shall_restore_state(void) {
+ bool ret;
+ int r;
+
+ r = proc_cmdline_get_bool("systemd.restore_state", &ret);
+ if (r < 0)
+ return r;
+
+ return r > 0 ? ret : true;
+}
diff --git a/src/shared/reboot-util.h b/src/shared/reboot-util.h
index 7bddc91ea6..5aeb34821f 100644
--- a/src/shared/reboot-util.h
+++ b/src/shared/reboot-util.h
@@ -11,3 +11,5 @@ typedef enum RebootFlags {
int read_reboot_parameter(char **parameter);
int reboot_with_parameter(RebootFlags flags);
+
+int shall_restore_state(void);