mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
rename apply_format() cause it is public now
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
This commit is contained in:
parent
4a2c3aad07
commit
a9bd2ed84a
2
udev.c
2
udev.c
@ -165,7 +165,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
char program[PATH_SIZE];
|
||||
|
||||
strlcpy(program, name_loop->name, sizeof(program));
|
||||
apply_format(udev, program, sizeof(program));
|
||||
udev_rules_apply_format(udev, program, sizeof(program));
|
||||
run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
|
||||
}
|
||||
}
|
||||
|
16
udev_rules.c
16
udev_rules.c
@ -362,7 +362,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void apply_format(struct udevice *udev, char *string, size_t maxsize)
|
||||
void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
|
||||
{
|
||||
char temp[PATH_SIZE];
|
||||
char temp2[PATH_SIZE];
|
||||
@ -818,7 +818,7 @@ try_parent:
|
||||
char result[PATH_SIZE];
|
||||
|
||||
strlcpy(program, key_val(rule, &rule->program), sizeof(program));
|
||||
apply_format(udev, program, sizeof(program));
|
||||
udev_rules_apply_format(udev, program, sizeof(program));
|
||||
if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) {
|
||||
dbg("PROGRAM is false");
|
||||
udev->program_result[0] = '\0';
|
||||
@ -851,7 +851,7 @@ try_parent:
|
||||
int rc = -1;
|
||||
|
||||
strlcpy(import, key_val(rule, &rule->import), sizeof(import));
|
||||
apply_format(udev, import, sizeof(import));
|
||||
udev_rules_apply_format(udev, import, sizeof(import));
|
||||
dbg("check for IMPORT import='%s'", import);
|
||||
if (rule->import_type == IMPORT_PROGRAM) {
|
||||
rc = import_program_into_env(udev, import);
|
||||
@ -941,14 +941,14 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
|
||||
if (rule->owner.operation == KEY_OP_ASSIGN_FINAL)
|
||||
udev->owner_final = 1;
|
||||
strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner));
|
||||
apply_format(udev, udev->owner, sizeof(udev->owner));
|
||||
udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner));
|
||||
dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel_name);
|
||||
}
|
||||
if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) {
|
||||
if (rule->group.operation == KEY_OP_ASSIGN_FINAL)
|
||||
udev->group_final = 1;
|
||||
strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group));
|
||||
apply_format(udev, udev->group, sizeof(udev->group));
|
||||
udev_rules_apply_format(udev, udev->group, sizeof(udev->group));
|
||||
dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel_name);
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
|
||||
name_list_cleanup(&udev->symlink_list);
|
||||
}
|
||||
strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp));
|
||||
apply_format(udev, temp, sizeof(temp));
|
||||
udev_rules_apply_format(udev, temp, sizeof(temp));
|
||||
count = replace_untrusted_chars(temp);
|
||||
if (count)
|
||||
info("%i untrusted character(s) replaced" , count);
|
||||
@ -996,7 +996,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
|
||||
int count;
|
||||
name_set = 1;
|
||||
strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name));
|
||||
apply_format(udev, udev->name, sizeof(udev->name));
|
||||
udev_rules_apply_format(udev, udev->name, sizeof(udev->name));
|
||||
count = replace_untrusted_chars(udev->name);
|
||||
if (count)
|
||||
info("%i untrusted character(s) replaced", count);
|
||||
@ -1082,7 +1082,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev)
|
||||
name_list_cleanup(&udev->run_list);
|
||||
}
|
||||
strlcpy(program, key_val(rule, &rule->run), sizeof(program));
|
||||
apply_format(udev, program, sizeof(program));
|
||||
udev_rules_apply_format(udev, program, sizeof(program));
|
||||
dbg("add run '%s'", program);
|
||||
name_list_add(&udev->run_list, program, 0);
|
||||
if (rule->run.operation == KEY_OP_ASSIGN_FINAL)
|
||||
|
@ -105,8 +105,6 @@ struct udev_rules {
|
||||
extern int udev_rules_init(struct udev_rules *rules, int resolve_names);
|
||||
extern void udev_rules_cleanup(struct udev_rules *rules);
|
||||
|
||||
extern void apply_format(struct udevice *udev, char *string, size_t maxsize);
|
||||
|
||||
extern void udev_rules_iter_init(struct udev_rules *rules);
|
||||
extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules);
|
||||
extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label);
|
||||
@ -114,4 +112,6 @@ extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const c
|
||||
extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev);
|
||||
extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev);
|
||||
|
||||
extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize);
|
||||
|
||||
#endif
|
||||
|
2
udevd.c
2
udevd.c
@ -127,7 +127,7 @@ static int udev_event_process(struct uevent_msg *msg)
|
||||
char program[PATH_SIZE];
|
||||
|
||||
strlcpy(program, name_loop->name, sizeof(program));
|
||||
apply_format(udev, program, sizeof(program));
|
||||
udev_rules_apply_format(udev, program, sizeof(program));
|
||||
if (run_program(program, udev->dev->subsystem, NULL, 0, NULL,
|
||||
(udev_log_priority >= LOG_INFO)))
|
||||
retval = -1;
|
||||
|
@ -164,7 +164,7 @@ run:
|
||||
char program[PATH_SIZE];
|
||||
|
||||
strlcpy(program, name_loop->name, sizeof(program));
|
||||
apply_format(udev, program, sizeof(program));
|
||||
udev_rules_apply_format(udev, program, sizeof(program));
|
||||
run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user