mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
udev: factor out config parser call into function
... which is then called from both places. This makes sure that the configuration is parsed by udevd and other tools in exactly the same way.
This commit is contained in:
committed by
Yu Watanabe
parent
a1c7dc7d16
commit
09dd8e77fc
@@ -5,7 +5,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "conf-parser.h"
|
||||
#include "device-nodes.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
@@ -23,12 +22,10 @@
|
||||
#include "udev-util.h"
|
||||
#include "utf8.h"
|
||||
|
||||
int udev_parse_config(void) {
|
||||
int r, log_val = -1;
|
||||
const ConfigTableItem config_table[] = {
|
||||
{ NULL, "udev_log", config_parse_log_level, 0, &log_val },
|
||||
{}
|
||||
};
|
||||
int udev_parse_config_full(const ConfigTableItem config_table[]) {
|
||||
int r;
|
||||
|
||||
assert(config_table);
|
||||
|
||||
r = config_parse_config_file_full(
|
||||
"udev.conf",
|
||||
@@ -40,6 +37,17 @@ int udev_parse_config(void) {
|
||||
/* userdata = */ NULL);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
int udev_parse_config(void) {
|
||||
int r, log_val = -1;
|
||||
const ConfigTableItem config_table[] = {
|
||||
{ NULL, "udev_log", config_parse_log_level, 0, &log_val },
|
||||
{}
|
||||
};
|
||||
|
||||
r = udev_parse_config_full(config_table);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include "sd-device.h"
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "hashmap.h"
|
||||
#include "time-util.h"
|
||||
|
||||
int udev_parse_config_full(const ConfigTableItem config_table[]);
|
||||
int udev_parse_config(void);
|
||||
|
||||
int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t timeout_usec, sd_device **ret);
|
||||
|
||||
@@ -83,16 +83,7 @@ static int manager_parse_udev_config(Manager *manager) {
|
||||
{}
|
||||
};
|
||||
|
||||
r = config_parse_config_file_full(
|
||||
"udev.conf",
|
||||
"udev",
|
||||
/* sections = */ NULL,
|
||||
config_item_table_lookup,
|
||||
config_table,
|
||||
CONFIG_PARSE_WARN,
|
||||
/* userdata = */ NULL);
|
||||
if (r == -ENOENT)
|
||||
return 0;
|
||||
r = udev_parse_config_full(config_table);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user