From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [ANNOUNCE] udev 013 release
Date: Thu, 15 Jan 2004 04:14:16 +0000 [thread overview]
Message-ID: <20040115041416.GA14601@vrfy.org> (raw)
In-Reply-To: <20040113235213.GA7659@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]
On Wed, Jan 14, 2004 at 01:10:43PM -0800, Greg KH wrote:
> On Wed, Jan 14, 2004 at 02:34:26PM -0600, Clay Haapala wrote:
> > On Wed, 14 Jan 2004, Chris Friesen spake thusly:
> > >
> > > Maybe for ones with a matching rule, you could print something like:
> > >
> > >
> > Is the act of printing/syslogging a rule in an of itself?
>
> No, as currently the only way stuff ends up in the syslog is if
> DEBUG=true is used on the build line.
>
> But it's sounding like we might want to change that... :)
How about this in the syslog after connect/disconnect?
Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n'
Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0'
Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0'
Kay
[-- Attachment #2: 00-simple-syslog.patch --]
[-- Type: text/plain, Size: 4577 bytes --]
diff -Nru a/Makefile b/Makefile
--- a/Makefile Thu Jan 15 05:11:38 2004
+++ b/Makefile Thu Jan 15 05:11:38 2004
@@ -16,6 +16,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+# Use of syslog
+LOG= true
+
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
DEBUG = false
@@ -102,6 +105,10 @@
CFLAGS+=-pipe
else
CFLAGS+=-pipe
+endif
+
+ifeq ($(strip $(LOG)),true)
+ CFLAGS += -DLOG
endif
# if DEBUG is enabled, then we do not strip or optimize
diff -Nru a/logging.c b/logging.c
--- a/logging.c Thu Jan 15 05:11:37 2004
+++ b/logging.c Thu Jan 15 05:11:37 2004
@@ -27,7 +27,7 @@
#include <syslog.h>
#include "udev.h"
-#ifdef DEBUG
+#ifdef LOG
static int logging_init = 0;
static unsigned char udev_logname[42];
diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c Thu Jan 15 05:11:38 2004
+++ b/namedev.c Thu Jan 15 05:11:38 2004
@@ -295,12 +295,12 @@
/* sleep to give the kernel a chance to create the file */
sleep(1);
}
- dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file);
+ dbg("timed out waiting for '%s' file, continuing on anyway...", b->file);
goto exit;
}
b++;
}
- dbg("Did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus);
+ dbg("did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus);
exit:
return; /* here to prevent compiler warning... */
}
@@ -544,7 +544,7 @@
if (sysfs_device != NULL)
goto device_found;
}
- dbg("Timed out waiting for device symlink, continuing on anyway...");
+ dbg("timed out waiting for device symlink, continuing on anyway...");
device_found:
/* We have another issue with just the wait above - the sysfs part of
@@ -569,10 +569,10 @@
if (sysfs_device->bus[0] != '\0')
goto bus_found;
}
- dbg("Timed out waiting to find the device bus, continuing on anyway\n");
+ dbg("timed out waiting to find the device bus, continuing on anyway");
goto exit;
bus_found:
- dbg("Device %s is registered with bus %s\n",
+ dbg("device %s is registered with bus '%s'",
sysfs_device->name, sysfs_device->bus);
}
exit:
@@ -704,7 +704,8 @@
}
/* Yup, this rule belongs to us! */
- dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
+ info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+ udev_rules_filename, dev->config_line, dev->kernel, dev->name);
strfieldcpy(udev->name, dev->name);
strfieldcpy(udev->symlink, dev->symlink);
goto found;
diff -Nru a/namedev.h b/namedev.h
--- a/namedev.h Thu Jan 15 05:11:37 2004
+++ b/namedev.h Thu Jan 15 05:11:37 2004
@@ -65,6 +65,7 @@
char name[NAME_SIZE];
char symlink[NAME_SIZE];
struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
+ int config_line;
};
struct perm_device {
diff -Nru a/namedev_parse.c b/namedev_parse.c
--- a/namedev_parse.c Thu Jan 15 05:11:37 2004
+++ b/namedev_parse.c Thu Jan 15 05:11:37 2004
@@ -249,6 +249,7 @@
goto error;
}
+ dev.config_line = lineno;
retval = add_config_dev(&dev);
if (retval) {
dbg("add_config_dev returned with error %d", retval);
diff -Nru a/udev-add.c b/udev-add.c
--- a/udev-add.c Thu Jan 15 05:11:38 2004
+++ b/udev-add.c Thu Jan 15 05:11:38 2004
@@ -141,6 +141,7 @@
if (strrchr(dev->name, '/'))
create_path(filename);
+ info("creating device node '%s'", filename);
dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor);
retval = mknod(filename, dev->mode, res);
if (retval)
diff -Nru a/udev-remove.c b/udev-remove.c
--- a/udev-remove.c Thu Jan 15 05:11:37 2004
+++ b/udev-remove.c Thu Jan 15 05:11:37 2004
@@ -73,7 +73,7 @@
strncpy(filename, udev_root, sizeof(filename));
strncat(filename, dev->name, sizeof(filename));
- dbg("unlinking node '%s'", filename);
+ info("removing device node '%s'", filename);
retval = unlink(filename);
if (retval) {
dbg("unlink(%s) failed with error '%s'",
diff -Nru a/udev.h b/udev.h
--- a/udev.h Thu Jan 15 05:11:38 2004
+++ b/udev.h Thu Jan 15 05:11:38 2004
@@ -26,8 +26,17 @@
#include "libsysfs/libsysfs.h"
#include <sys/param.h>
-#ifdef DEBUG
+#ifdef LOG
#include <syslog.h>
+#define info(format, arg...) \
+ do { \
+ log_message (LOG_INFO , format , ## arg); \
+ } while (0)
+#else
+ #define info(format, arg...) do { } while (0)
+#endif
+
+#ifdef DEBUG
#define dbg(format, arg...) \
do { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
next prev parent reply other threads:[~2004-01-15 4:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-13 23:52 [ANNOUNCE] udev 013 release Greg KH
2004-01-14 1:38 ` Frédéric L. W. Meunier
2004-01-14 2:14 ` Jon Smirl
2004-01-14 5:15 ` Nuno Silva
2004-01-14 17:15 ` Greg KH
2004-01-14 17:46 ` Chris Friesen
2004-01-14 19:23 ` Nuno Silva
2004-01-14 21:14 ` Greg KH
2004-01-15 7:48 ` Nuno Silva
2004-01-15 23:03 ` Greg KH
2004-01-14 20:34 ` Clay Haapala
2004-01-14 20:47 ` Chris Friesen
2004-01-14 21:12 ` Greg KH
2004-01-14 21:10 ` Greg KH
2004-01-14 17:27 ` Greg KH
2004-01-15 4:14 ` Kay Sievers [this message]
2004-01-15 14:32 ` Kay Sievers
2004-01-15 22:40 ` Greg KH
2004-01-16 2:25 ` Nuno Silva
2004-01-16 3:24 ` Kay Sievers
2004-01-16 3:45 ` Nuno Silva
2004-01-19 20:29 ` Olaf Hering
2004-01-19 20:40 ` Greg KH
2004-01-19 20:44 ` Olaf Hering
2004-01-19 20:50 ` 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=20040115041416.GA14601@vrfy.org \
--to=kay.sievers@vrfy.org \
--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).