From: Sjoerd Simons <sjoerd@spring.luon.net>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] DEVNODE -> DEVNAME transition fixes
Date: Mon, 05 Apr 2004 21:09:38 +0000 [thread overview]
Message-ID: <20040405210938.GA4025@spring.luon.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
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
--
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
[-- Attachment #2: devnode_to_devname.patch --]
[-- Type: text/plain, Size: 4953 bytes --]
diff -Naur udev-024/dev_d.c udev-024.patched/dev_d.c
--- udev-024/dev_d.c 2004-04-03 00:47:29.000000000 +0200
+++ udev-024.patched/dev_d.c 2004-04-05 22:18:52.556518260 +0200
@@ -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 -Naur udev-024/extras/dbus/udev_dbus.c udev-024.patched/extras/dbus/udev_dbus.c
--- udev-024/extras/dbus/udev_dbus.c 2004-04-03 00:47:28.000000000 +0200
+++ udev-024.patched/extras/dbus/udev_dbus.c 2004-04-05 22:19:58.598966260 +0200
@@ -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;
diff -Naur udev-024/extras/selinux/udev_selinux.c udev-024.patched/extras/selinux/udev_selinux.c
--- udev-024/extras/selinux/udev_selinux.c 2004-04-03 00:47:28.000000000 +0200
+++ udev-024.patched/extras/selinux/udev_selinux.c 2004-04-05 22:20:27.013589259 +0200
@@ -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;
diff -Naur udev-024/udev_lib.c udev-024.patched/udev_lib.c
--- udev-024/udev_lib.c 2004-04-03 00:47:29.000000000 +0200
+++ udev-024.patched/udev_lib.c 2004-04-05 22:18:09.047564313 +0200
@@ -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)
diff -Naur udev-024/udev_lib.h udev-024.patched/udev_lib.h
--- udev-024/udev_lib.h 2004-04-03 00:47:28.000000000 +0200
+++ udev-024.patched/udev_lib.h 2004-04-05 22:20:56.583237583 +0200
@@ -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);
next reply other threads:[~2004-04-05 21:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-05 21:09 Sjoerd Simons [this message]
2004-04-08 17:52 ` [PATCH] DEVNODE -> DEVNAME transition fixes Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040405210938.GA4025@spring.luon.net \
--to=sjoerd@spring.luon.net \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).