linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev and dbus
Date: Sun, 14 Mar 2004 19:59:25 +0000	[thread overview]
Message-ID: <20040314195925.GA25119@suse.de> (raw)
In-Reply-To: <20040217214449.GB12411@wonderland.linux.it>

 On Thu, Mar 11, Kay Sievers wrote:

> On Thu, 2004-03-11 at 19:32, Greg KH wrote:
> > On Thu, Mar 11, 2004 at 07:12:55PM +0100, Kay Sievers wrote:
> > > 
> > > I expect lot of lazy people to put their scripts in there, cause it's so
> > > comfortable to live inside the serialized hotplug events.
> > 
> > But people want to know about the device node creation and removal, they
> > don't care about the "raw" hotplug events.  They want udev to handle the
> > raw hotplug events for them.
> 
> I don't agree.
> 
> > > Something like this:
> > > "Nice, I can mount my USB-stick with udev.d/ right after udev has
> > > created my partition node, cause the scsi.agent was too fast..."
> > 
> > No, how can scsi.agent know about what the device node name was?  It
> > can't.
> 
> udevinfo! That's what it's made for :)

what about nodes="`UDEV_PRINT_NODES=1 udev $1`"
which fills $nodes will the name and the symlinks for DEVPATH? This can
work for add and remove events.

diff -pur udev-klibc/udev-add.c udev-klibc-debug/udev-add.c
--- udev-klibc/udev-add.c	2004-03-14 20:01:19.000000000 +0100
+++ udev-klibc-debug/udev-add.c	2004-03-14 20:56:15.573334811 +0100
@@ -197,6 +197,7 @@ static int create_node(struct udevice *d
 	int tail;
 	char *pos;
 	int len;
+	char *printnodes;
 
 	strfieldcpy(filename, udev_root);
 	strfieldcat(filename, dev->name);
@@ -217,6 +218,8 @@ static int create_node(struct udevice *d
 		return -EINVAL;
 	}
 
+	printnodes = getenv(UDEV_PRINT_NODES);
+
 	/* create parent directories if needed */
 	if (strrchr(dev->name, '/'))
 		create_path(filename);
@@ -257,6 +260,8 @@ static int create_node(struct udevice *d
 		unlink_entry(filename);
 		info("creating device node '%s'", filename);
 		make_node(filename, dev->major, dev->minor, dev->mode, uid, gid);
+		if (printnodes)
+			fprintf(stdout, "%s", filename);
 	} else {
 		info("creating device node '%s', major = '%d', minor = '%d', "
 		     "mode = '%#o', uid = '%d', gid = '%d'", filename,
@@ -316,8 +321,13 @@ static int create_node(struct udevice *d
 			if (retval != 0)
 				dbg("symlink(%s, %s) failed with error '%s'",
 				    linktarget, filename, strerror(errno));
+			else 
+			if (printnodes)
+				fprintf(stdout, " %s", filename);
 		}
 	}
+	if (printnodes)
+		fprintf(stdout, "\n");
 
 	return retval;
 }
diff -pur udev-klibc/udev-remove.c udev-klibc-debug/udev-remove.c
--- udev-klibc/udev-remove.c	2004-03-14 20:01:19.000000000 +0100
+++ udev-klibc-debug/udev-remove.c	2004-03-14 20:56:20.710112187 +0100
@@ -73,11 +73,14 @@ static int delete_node(struct udevice *d
 	int retval;
 	int i;
 	char *pos;
+	char *printnodes;
 	int len;
 
 	strfieldcpy(filename, udev_root);
 	strfieldcat(filename, dev->name);
 
+	printnodes = getenv(UDEV_PRINT_NODES);
+
 	info("removing device node '%s'", filename);
 	retval = unlink(filename);
 	if (errno = ENOENT)
@@ -88,6 +91,9 @@ static int delete_node(struct udevice *d
 		return retval;
 	}
 
+	if (printnodes)
+		fprintf(stdout, "%s", filename);
+
 	/* remove partition nodes */
 	if (dev->partitions > 0) {
 		info("removing partitions '%s[1-%i]'", filename, dev->partitions);
@@ -116,10 +122,14 @@ static int delete_node(struct udevice *d
 				filename, strerror(errno));
 			return retval;
 		}
+		if (printnodes)
+			fprintf(stdout, " %s", filename);
 		if (strchr(dev->symlink, '/')) {
 			delete_path(filename);
 		}
 	}
+	if (printnodes)
+		fprintf(stdout, "\n");
 
 	return retval;
 }
diff -pur udev-klibc/udev.h udev-klibc-debug/udev.h
--- udev-klibc/udev.h	2004-03-14 20:01:19.000000000 +0100
+++ udev-klibc-debug/udev.h	2004-03-14 20:55:53.998269342 +0100
@@ -103,6 +103,8 @@ do { \
 	    pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \
 		if (len > 0)
 
+#define UDEV_PRINT_NODES "UDEV_PRINT_NODES"
+
 static inline char *get_action(void)
 {
 	char *action;
-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
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_id\x1470&alloc_id638&opÃk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-03-14 19:59 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-17 21:44 udev and DBUS Marco d'Itri
2004-02-26 17:00 ` Marco d'Itri
2004-02-28 14:13 ` David Zeuthen
2004-03-10 16:31 ` udev and dbus David Zeuthen
2004-03-10 17:52 ` Kay Sievers
2004-03-10 19:18 ` Greg KH
2004-03-10 19:56 ` Greg KH
2004-03-10 19:57 ` Marco d'Itri
2004-03-10 20:00 ` Marco d'Itri
2004-03-10 20:02 ` Greg KH
2004-03-10 22:25 ` Patrick Mansfield
2004-03-10 22:37 ` Kay Sievers
2004-03-10 22:48 ` Greg KH
2004-03-11  1:28 ` Greg KH
2004-03-11  2:35 ` Kay Sievers
2004-03-11  8:55 ` Martin Waitz
2004-03-11 14:30 ` Kay Sievers
2004-03-11 15:06 ` David Zeuthen
2004-03-11 17:14 ` Kay Sievers
2004-03-11 17:23 ` Kay Sievers
2004-03-11 17:30 ` David Zeuthen
2004-03-11 17:41 ` David Zeuthen
2004-03-11 17:44 ` Kay Sievers
2004-03-11 18:12 ` Kay Sievers
2004-03-11 18:22 ` David Zeuthen
2004-03-11 18:32 ` Greg KH
2004-03-11 18:35 ` Greg KH
2004-03-11 18:36 ` Greg KH
2004-03-11 18:37 ` Kay Sievers
2004-03-11 18:38 ` Kay Sievers
2004-03-11 18:40 ` Kay Sievers
2004-03-11 18:47 ` Greg KH
2004-03-11 18:56 ` Kay Sievers
2004-03-12  0:18 ` Greg KH
2004-03-12 11:37 ` David Zeuthen
2004-03-12 15:54 ` Kay Sievers
2004-03-12 16:40 ` Daniel Stekloff
2004-03-12 17:17 ` Marco d'Itri
2004-03-12 17:26 ` Marco d'Itri
2004-03-13 15:22 ` David Zeuthen
2004-03-13 18:29 ` Kay Sievers
2004-03-14 19:59 ` Olaf Hering [this message]
2004-03-14 20:06 ` Kay Sievers
2004-03-14 20:11 ` Olaf Hering

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=20040314195925.GA25119@suse.de \
    --to=olh@suse.de \
    --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).