1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

udev: make udev_builtin_run take sd_device

This commit is contained in:
Yu Watanabe 2018-10-14 01:38:54 +09:00
parent 9b917abe02
commit 3d6194e83e
5 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,6 @@
#include <string.h>
#include "device-private.h"
#include "libudev-device-internal.h"
#include "string-util.h"
#include "strv.h"
#include "udev-builtin.h"
@ -103,7 +102,7 @@ enum udev_builtin_cmd udev_builtin_lookup(const char *command) {
return UDEV_BUILTIN_MAX;
}
int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) {
int udev_builtin_run(sd_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) {
_cleanup_strv_free_ char **argv = NULL;
if (!builtins[cmd])
@ -115,7 +114,7 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c
/* we need '0' here to reset the internal state */
optind = 0;
return builtins[cmd]->cmd(dev->device, strv_length(argv), argv, test);
return builtins[cmd]->cmd(dev, strv_length(argv), argv, test);
}
int udev_builtin_add_property(sd_device *dev, bool test, const char *key, const char *val) {

View File

@ -5,8 +5,6 @@
#include "sd-device.h"
#include "libudev.h"
enum udev_builtin_cmd {
#if HAVE_BLKID
UDEV_BUILTIN_BLKID,
@ -61,7 +59,7 @@ void udev_builtin_exit(void);
enum udev_builtin_cmd udev_builtin_lookup(const char *command);
const char *udev_builtin_name(enum udev_builtin_cmd cmd);
bool udev_builtin_run_once(enum udev_builtin_cmd cmd);
int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test);
int udev_builtin_run(sd_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test);
void udev_builtin_list(void);
bool udev_builtin_validate(void);
int udev_builtin_add_property(sd_device *dev, bool test, const char *key, const char *val);

View File

@ -901,7 +901,7 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_
udev_event_apply_format(event, cmd, command, sizeof(command), false);
if (builtin_cmd < UDEV_BUILTIN_MAX)
udev_builtin_run(event->dev, builtin_cmd, command, false);
udev_builtin_run(event->dev->device, builtin_cmd, command, false);
else {
if (event->exec_delay > 0) {
log_debug("delay execution of '%s'", command);

View File

@ -22,6 +22,7 @@
#include "fileio.h"
#include "fs-util.h"
#include "glob-util.h"
#include "libudev-device-internal.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "stat-util.h"
@ -2014,7 +2015,7 @@ int udev_rules_apply_to_event(
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) {
if (udev_builtin_run(event->dev->device, cur->key.builtin_cmd, command, false) != 0) {
/* remember failure */
log_debug("IMPORT builtin '%s' returned non-zero",
udev_builtin_name(cur->key.builtin_cmd));

View File

@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "libudev-device-internal.h"
#include "libudev-private.h"
#include "path-util.h"
#include "string-util.h"
@ -98,7 +99,7 @@ int builtin_main(int argc, char *argv[], void *userdata) {
goto finish;
}
r = udev_builtin_run(dev, cmd, arg_command, true);
r = udev_builtin_run(dev->device, cmd, arg_command, true);
if (r < 0)
log_debug("error executing '%s', exit code %i", arg_command, r);