From 4b06c852cb7da274b50f665a75367f901d8064ae Mon Sep 17 00:00:00 2001 From: "sjoerd@spring.luon.net" Date: Thu, 8 Apr 2004 18:48:56 -0700 Subject: [PATCH] [PATCH] DEVNODE -> DEVNAME transition fixes It seems that the transition from DEVNODE to DEVNAME wasn't done everywhere. This broke udev_dbus for me. Attached patch does the transition in the places it wasn't done yet. --- dev_d.c | 4 ++-- extras/dbus/udev_dbus.c | 24 ++++++++++++------------ extras/selinux/udev_selinux.c | 10 +++++----- udev_lib.c | 12 ++++++------ udev_lib.h | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dev_d.c b/dev_d.c index 483ceb4b..81c70133 100644 --- a/dev_d.c +++ b/dev_d.c @@ -11,8 +11,8 @@ /* * This essentially emulates the following shell script logic in C: * DIR="/etc/dev.d" - * export DEVNODE="whatever_dev_name_udev_just_gave" - * for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + * export DEVNAME="whatever_dev_name_udev_just_gave" + * for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do * if [ -f $I ]; then $I $1 ; fi * done * exit 1; diff --git a/extras/dbus/udev_dbus.c b/extras/dbus/udev_dbus.c index 955a3dbb..e99e92ec 100644 --- a/extras/dbus/udev_dbus.c +++ b/extras/dbus/udev_dbus.c @@ -80,10 +80,10 @@ static void sysbus_connect(void) /** Send out a signal that a device node is created * - * @param devnode name of the device node, e.g. /dev/sda1 + * @param devname name of the device node, e.g. /dev/sda1 * @param path Sysfs path of device */ -static void sysbus_send_create(const char *devnode, const char *path) +static void sysbus_send_create(const char *devname, const char *path) { DBusMessage* message; DBusMessageIter iter; @@ -94,7 +94,7 @@ static void sysbus_send_create(const char *devnode, const char *path) "NodeCreated"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, devname); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -107,10 +107,10 @@ static void sysbus_send_create(const char *devnode, const char *path) /** Send out a signal that a device node is deleted * - * @param devnode Name of the device node, e.g. /udev/sda1 + * @param devname Name of the device node, e.g. /udev/sda1 * @param path Sysfs path of device */ -static void sysbus_send_remove(const char *devnode, const char *path) +static void sysbus_send_remove(const char *devname, const char *path) { DBusMessage* message; DBusMessageIter iter; @@ -121,7 +121,7 @@ static void sysbus_send_remove(const char *devnode, const char *path) "NodeDeleted"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, devname); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -136,7 +136,7 @@ int main(int argc, char *argv[], char *envp[]) { char *action; char *devpath; - char *devnode; + char *devname; int retval = 0; init_logging("udev_dbus"); @@ -155,17 +155,17 @@ int main(int argc, char *argv[], char *envp[]) dbg("no devpath?"); goto exit; } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); + devname = get_devname(); + if (!devname) { + dbg("no devname?"); goto exit; } if (strcmp(action, "add") == 0) { - sysbus_send_create(devnode, devpath); + sysbus_send_create(devname, devpath); } else { if (strcmp(action, "remove") == 0) { - sysbus_send_remove(devnode, devpath); + sysbus_send_remove(devname, devpath); } else { dbg("unknown action '%s'", action); retval = -EINVAL; diff --git a/extras/selinux/udev_selinux.c b/extras/selinux/udev_selinux.c index bbbdd6ba..df23d9e6 100644 --- a/extras/selinux/udev_selinux.c +++ b/extras/selinux/udev_selinux.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[], char *envp[]) { char *action; char *devpath; - char *devnode; + char *devname; int retval = 0; init_logging("udev_selinux"); @@ -58,14 +58,14 @@ int main(int argc, char *argv[], char *envp[]) dbg("no action?"); goto exit; } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); + devname = get_devname(); + if (!devname) { + dbg("no devname?"); goto exit; } if (strcmp(action, "add") == 0) - selinux_add_node(devnode); + selinux_add_node(devname); exit: return retval; diff --git a/udev_lib.c b/udev_lib.c index db1096eb..381492db 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -58,15 +58,15 @@ char *get_devpath(void) return devpath; } -char *get_devnode(void) +char *get_devname(void) { - char *devnode; + char *devname; - devnode = getenv("DEVNODE"); - if (devnode != NULL && strlen(devnode) > NAME_SIZE) - devnode[NAME_SIZE-1] = '\0'; + devname = getenv("DEVNAME"); + if (devname != NULL && strlen(devname) > NAME_SIZE) + devname[NAME_SIZE-1] = '\0'; - return devnode; + return devname; } char *get_seqnum(void) diff --git a/udev_lib.h b/udev_lib.h index e412ba96..cc264fa9 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -68,7 +68,7 @@ do { \ extern char *get_action(void); extern char *get_devpath(void); -extern char *get_devnode(void); +extern char *get_devname(void); extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); extern char get_device_type(const char *path, const char *subsystem); -- 2.39.5