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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -11,3 +11,5 @@ typedef enum RebootFlags {
|
||||
|
||||
int read_reboot_parameter(char **parameter);
|
||||
int reboot_with_parameter(RebootFlags flags);
|
||||
|
||||
int shall_restore_state(void);
|
||||
|
||||
Reference in New Issue
Block a user