diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-21 22:30:48 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-12-21 22:30:48 +0100 |
commit | 81dadce58f80edae4dc45ba55a2c41cb0f26570b (patch) | |
tree | 59cee628c06f7255cbfb527e5cc45b9efcca2247 /udev/udev-builtin.c | |
parent | f18f225cf1eac9b61849f10f387bc3628332d738 (diff) |
prepare builtins for blkid and kmod
Diffstat (limited to 'udev/udev-builtin.c')
-rw-r--r-- | udev/udev-builtin.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index eeec6e990d..36821702c1 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -29,6 +29,8 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, + [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, }; int udev_builtin_list(struct udev *udev) @@ -45,19 +47,30 @@ const char *udev_builtin_name(enum udev_builtin_cmd cmd) return builtins[cmd]->name; } -enum udev_builtin_cmd udev_builtin_lookup(const char *name) +bool udev_builtin_run_once(enum udev_builtin_cmd cmd) { + return builtins[cmd]->run_once; +} + +enum udev_builtin_cmd udev_builtin_lookup(const char *command) +{ + char name[UTIL_PATH_SIZE]; enum udev_builtin_cmd i; + char *pos; + util_strscpy(name, sizeof(name), command); + pos = strchr(name, ' '); + if (pos) + pos[0] = '\0'; for (i = 0; i < ARRAY_SIZE(builtins); i++) if (strcmp(builtins[i]->name, name) == 0) return i; return UDEV_BUILTIN_MAX; } -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test) +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) { - return builtins[cmd]->cmd(dev, test); + return builtins[cmd]->cmd(dev, command, test); } int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) |