Merge pull request #15862 from hunger/master
repart: Add Uuid option to config files
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sd-id128.h"
|
||||
#include "signal-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "string-util.h"
|
||||
@@ -648,6 +649,35 @@ int config_parse_bool(const char* unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_id128(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
sd_id128_t t, *result = data;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
|
||||
r = sd_id128_from_string(rvalue, &t);
|
||||
if (r < 0)
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue);
|
||||
else if (sd_id128_is_null(t))
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0, "128bit ID/UUID is all 0, ignoring: %s", rvalue);
|
||||
|
||||
*result = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_tristate(
|
||||
const char* unit,
|
||||
const char *filename,
|
||||
|
||||
@@ -122,6 +122,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_iec_size);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_si_uint64);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_bool);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_id128);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tristate);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_string);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_path);
|
||||
|
||||
Reference in New Issue
Block a user