condition-util.c | condition-util.c | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
along with systemd; If not, see <http://www.gnu.org/licenses/>. | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |||
***/ | ***/ | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <string.h> | #include <string.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <sys/statvfs.h> | #include <sys/statvfs.h> | |||
#include <fnmatch.h> | #include <fnmatch.h> | |||
#include <systemd/sd-id128.h> | #include "systemd/sd-id128.h" | |||
#include "util.h" | #include "util.h" | |||
#include "condition-util.h" | #include "condition-util.h" | |||
#include "virt.h" | #include "virt.h" | |||
#include "path-util.h" | #include "path-util.h" | |||
#include "fileio.h" | #include "fileio.h" | |||
#include "unit.h" | #include "unit.h" | |||
#include "architecture.h" | #include "architecture.h" | |||
Condition* condition_new(ConditionType type, const char *parameter, bool tr igger, bool negate) { | Condition* condition_new(ConditionType type, const char *parameter, bool tr igger, bool negate) { | |||
Condition *c; | Condition *c; | |||
skipping to change at line 77 | skipping to change at line 77 | |||
} | } | |||
void condition_free_list(Condition *first) { | void condition_free_list(Condition *first) { | |||
Condition *c, *n; | Condition *c, *n; | |||
LIST_FOREACH_SAFE(conditions, c, n, first) | LIST_FOREACH_SAFE(conditions, c, n, first) | |||
condition_free(c); | condition_free(c); | |||
} | } | |||
bool condition_test_kernel_command_line(Condition *c) { | bool condition_test_kernel_command_line(Condition *c) { | |||
char *line, *w, *state, *word = NULL; | char *line, *word = NULL; | |||
const char *w, *state; | ||||
bool equal; | bool equal; | |||
int r; | int r; | |||
size_t l, pl; | size_t l, pl; | |||
bool found = false; | bool found = false; | |||
assert(c); | assert(c); | |||
assert(c->parameter); | assert(c->parameter); | |||
assert(c->type == CONDITION_KERNEL_COMMAND_LINE); | assert(c->type == CONDITION_KERNEL_COMMAND_LINE); | |||
r = proc_cmdline(&line); | r = proc_cmdline(&line); | |||
skipping to change at line 116 | skipping to change at line 117 | |||
break; | break; | |||
} | } | |||
} else { | } else { | |||
if (startswith(word, c->parameter) && (word[pl] == '=' || word[pl] == 0)) { | if (startswith(word, c->parameter) && (word[pl] == '=' || word[pl] == 0)) { | |||
found = true; | found = true; | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
if (!isempty(state)) | ||||
log_warning("Trailing garbage and the end of kernel command | ||||
line, ignoring."); | ||||
free(word); | free(word); | |||
free(line); | free(line); | |||
return found == !c->negate; | return found == !c->negate; | |||
} | } | |||
bool condition_test_virtualization(Condition *c) { | bool condition_test_virtualization(Condition *c) { | |||
int b, v; | int b, v; | |||
const char *id; | const char *id; | |||
skipping to change at line 260 | skipping to change at line 263 | |||
[CONDITION_FILE_NOT_EMPTY] = "ConditionFileNotEmpty", | [CONDITION_FILE_NOT_EMPTY] = "ConditionFileNotEmpty", | |||
[CONDITION_FILE_IS_EXECUTABLE] = "ConditionFileIsExecutable", | [CONDITION_FILE_IS_EXECUTABLE] = "ConditionFileIsExecutable", | |||
[CONDITION_KERNEL_COMMAND_LINE] = "ConditionKernelCommandLine", | [CONDITION_KERNEL_COMMAND_LINE] = "ConditionKernelCommandLine", | |||
[CONDITION_VIRTUALIZATION] = "ConditionVirtualization", | [CONDITION_VIRTUALIZATION] = "ConditionVirtualization", | |||
[CONDITION_SECURITY] = "ConditionSecurity", | [CONDITION_SECURITY] = "ConditionSecurity", | |||
[CONDITION_CAPABILITY] = "ConditionCapability", | [CONDITION_CAPABILITY] = "ConditionCapability", | |||
[CONDITION_HOST] = "ConditionHost", | [CONDITION_HOST] = "ConditionHost", | |||
[CONDITION_AC_POWER] = "ConditionACPower", | [CONDITION_AC_POWER] = "ConditionACPower", | |||
[CONDITION_ARCHITECTURE] = "ConditionArchitecture", | [CONDITION_ARCHITECTURE] = "ConditionArchitecture", | |||
[CONDITION_NEEDS_UPDATE] = "ConditionNeedsUpdate", | [CONDITION_NEEDS_UPDATE] = "ConditionNeedsUpdate", | |||
[CONDITION_FIRST_BOOT] = "ConditionFirstBoot", | ||||
[CONDITION_NULL] = "ConditionNull" | [CONDITION_NULL] = "ConditionNull" | |||
}; | }; | |||
DEFINE_STRING_TABLE_LOOKUP(condition_type, ConditionType); | DEFINE_STRING_TABLE_LOOKUP(condition_type, ConditionType); | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |