Skip to contentSkip to conversation

DEVNODE -> DEVNAME transition fixes

PATCH In review Sjoerd Simons 2 participants 2 messages Apr 5, 2004 – Apr 8, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DEVNODE -> DEVNAME transition fixes

Hi,

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.

Sjoerd

Signature · 3 lines
Nature is by and large to be found out of doors, a location where,
it cannot be argued, there are never enough comfortable chairs.
		-- Fran Lebowitz
dev_d.c +2 -2
diff -Naur udev-024/dev_d.c udev-024.patched/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;
extras/dbus/udev_dbus.c +12 -12
diff -Naur udev-024/extras/dbus/udev_dbus.c udev-024.patched/extras/dbus/udev_dbus.c
@@ -80,10 +80,10 @@
 
 /** 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 @@
 					  "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 @@
 
 /** 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 @@
 					  "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 @@
 {
 	char *action;
 	char *devpath;
-	char *devnode;
+	char *devname;
 	int retval = 0;
 
 	init_logging("udev_dbus");
@@ -155,17 +155,17 @@
 		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;
extras/selinux/udev_selinux.c +5 -5
diff -Naur udev-024/extras/selinux/udev_selinux.c udev-024.patched/extras/selinux/udev_selinux.c
@@ -48,7 +48,7 @@
 {
 	char *action;
 	char *devpath;
-	char *devnode;
+	char *devname;
 	int retval = 0;
 
 	init_logging("udev_selinux");
@@ -58,14 +58,14 @@
 		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;
udev_lib.c +6 -6
diff -Naur udev-024/udev_lib.c udev-024.patched/udev_lib.c
@@ -58,15 +58,15 @@
 	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)
udev_lib.h +1 -1
diff -Naur udev-024/udev_lib.h udev-024.patched/udev_lib.h
@@ -68,7 +68,7 @@
 
 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);
#1 lore raw
Quoted 6 lines · Sjoerd Simons

Hi,

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.

Thanks, I've applied this to the tree now.

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel