1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-27 18:04:05 +03:00

udev: move ResolveNameTiming definition and parsers to udev-util.h

Follow-up for c4d44cba4d9bd9d92c86e06f21d5936cca1b8c16. No functional change,
but the parser is moved to libsystemd-shared.so.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-13 13:42:42 +01:00
parent 4b3ca79ea9
commit bc768f0475
4 changed files with 21 additions and 20 deletions

View File

@ -7,10 +7,19 @@
#include "fileio.h"
#include "log.h"
#include "parse-util.h"
#include "string-table.h"
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
static const char* const resolve_name_timing_table[_RESOLVE_NAME_TIMING_MAX] = {
[RESOLVE_NAME_NEVER] = "never",
[RESOLVE_NAME_LATE] = "late",
[RESOLVE_NAME_EARLY] = "early",
};
DEFINE_STRING_TABLE_LOOKUP(resolve_name_timing, ResolveNameTiming);
int udev_parse_config_full(
unsigned *ret_children_max,
usec_t *ret_exec_delay_usec,

View File

@ -3,6 +3,17 @@
#include "time-util.h"
typedef enum ResolveNameTiming {
RESOLVE_NAME_NEVER,
RESOLVE_NAME_LATE,
RESOLVE_NAME_EARLY,
_RESOLVE_NAME_TIMING_MAX,
_RESOLVE_NAME_TIMING_INVALID = -1,
} ResolveNameTiming;
ResolveNameTiming resolve_name_timing_from_string(const char *s) _pure_;
const char *resolve_name_timing_to_string(ResolveNameTiming i) _const_;
int udev_parse_config_full(
unsigned *ret_children_max,
usec_t *ret_exec_delay_usec,

View File

@ -30,7 +30,6 @@
#include "stat-util.h"
#include "stdio-util.h"
#include "strbuf.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "sysctl-util.h"
@ -2599,11 +2598,3 @@ finish:
return 0;
}
static const char* const resolve_name_timing_table[_RESOLVE_NAME_TIMING_MAX] = {
[RESOLVE_NAME_NEVER] = "never",
[RESOLVE_NAME_LATE] = "late",
[RESOLVE_NAME_EARLY] = "early",
};
DEFINE_STRING_TABLE_LOOKUP(resolve_name_timing, ResolveNameTiming);

View File

@ -18,6 +18,7 @@
#include "macro.h"
#include "strv.h"
#include "util.h"
#include "udev-util.h"
struct udev_event {
sd_device *dev;
@ -48,14 +49,6 @@ struct udev_event {
bool run_final;
};
typedef enum ResolveNameTiming {
RESOLVE_NAME_NEVER,
RESOLVE_NAME_LATE,
RESOLVE_NAME_EARLY,
_RESOLVE_NAME_TIMING_MAX,
_RESOLVE_NAME_TIMING_INVALID = -1,
} ResolveNameTiming;
/* udev-rules.c */
struct udev_rules;
struct udev_rules *udev_rules_new(ResolveNameTiming resolve_name_timing);
@ -66,9 +59,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
Hashmap *properties_list);
int udev_rules_apply_static_dev_perms(struct udev_rules *rules);
ResolveNameTiming resolve_name_timing_from_string(const char *s) _pure_;
const char *resolve_name_timing_to_string(ResolveNameTiming i) _const_;
static inline usec_t udev_warn_timeout(usec_t timeout_usec) {
return DIV_ROUND_UP(timeout_usec, 3);
}