Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */ 2 : #pragma once 3 : 4 : #include <linux/fiemap.h> 5 : #include "time-util.h" 6 : 7 : typedef struct SleepConfig { 8 : bool allow_suspend; /* AllowSuspend */ 9 : bool allow_hibernate; /* AllowHibernation */ 10 : bool allow_s2h; /* AllowSuspendThenHibernate */ 11 : bool allow_hybrid_sleep; /* AllowHybridSleep */ 12 : 13 : char **suspend_modes; /* SuspendMode */ 14 : char **suspend_states; /* SuspendState */ 15 : char **hibernate_modes; /* HibernateMode */ 16 : char **hibernate_states; /* HibernateState */ 17 : char **hybrid_modes; /* HybridSleepMode */ 18 : char **hybrid_states; /* HybridSleepState */ 19 : 20 : usec_t hibernate_delay_sec; /* HibernateDelaySec */ 21 : } SleepConfig; 22 : 23 : void free_sleep_config(SleepConfig *sc); 24 10 : DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, free_sleep_config); 25 : 26 : int sleep_settings(const char *verb, const SleepConfig *sleep_config, bool *ret_allow, char ***ret_modes, char ***ret_states); 27 : 28 : int read_fiemap(int fd, struct fiemap **ret); 29 : int parse_sleep_config(SleepConfig **sleep_config); 30 : int find_hibernate_location(char **device, char **type, uint64_t *size, uint64_t *used); 31 : 32 : int can_sleep(const char *verb); 33 : int can_sleep_disk(char **types); 34 : int can_sleep_state(char **types);