hostnamed: allow setting machine tags via udev rules (#42390)
This gives hostnamed a lot of love, and makes it possibly to "auto-tag" a machine via a udev rule. It builds on the machine tag concept added in v261.
This commit is contained in:
+13
-4
@@ -812,16 +812,14 @@ bool strv_is_uniq(char * const *l) {
|
||||
}
|
||||
|
||||
char** strv_remove(char **l, const char *s) {
|
||||
char **f, **t;
|
||||
|
||||
if (!l)
|
||||
return NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
/* Drops every occurrence of s in the string list, edits
|
||||
* in-place. */
|
||||
/* Drops every occurrence of s in the string list, edits in-place. */
|
||||
|
||||
char **f, **t;
|
||||
for (f = t = l; *f; f++)
|
||||
if (streq(*f, s))
|
||||
free(*f);
|
||||
@@ -832,6 +830,17 @@ char** strv_remove(char **l, const char *s) {
|
||||
return l;
|
||||
}
|
||||
|
||||
char** strv_remove_strv(char **l, char *const*ll) {
|
||||
|
||||
if (strv_isempty(l))
|
||||
return l;
|
||||
|
||||
STRV_FOREACH(i, ll)
|
||||
strv_remove(l, *i);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
bool strv_overlap(char * const *a, char * const *b) {
|
||||
POINTER_MAY_BE_NULL(a);
|
||||
POINTER_MAY_BE_NULL(b);
|
||||
|
||||
@@ -85,6 +85,7 @@ int strv_consume_pair(char ***l, char *a, char *b);
|
||||
int strv_consume_prepend(char ***l, char *value);
|
||||
|
||||
char** strv_remove(char **l, const char *s);
|
||||
char** strv_remove_strv(char **l, char *const*ll);
|
||||
char** strv_uniq(char **l);
|
||||
bool strv_is_uniq(char * const *l) _pure_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user