lkml.org 
[lkml]   [2004]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [ANNOUNCE] udev 015 release
From
Date
On Mon, 2004-01-26 at 23:50, Greg KH wrote:

I see latest version is very noisy, and although it is a good option
to have, I think it should be tweakable (and recompiling is not always
an option if you want some quick debugging).

Attached is a simple patch to add a config option to udev.conf to toggle
logging.


Thanks,

--
Martin Schlemmer
--- udev-015/Makefile 2004-01-29 20:03:55.920842712 +0200
+++ udev-015.log_option/Makefile 2004-01-29 20:20:06.758252992 +0200
@@ -232,6 +232,7 @@
@echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@
@echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@
@echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@
+ @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@

# config files automatically generated
GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf
@@ -252,12 +253,12 @@
$(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o logging.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS)
$(STRIPCMD) $@

-$(DAEMON): udevd.h udevd.o udevd.o logging.o
- $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
+$(DAEMON): udevd.h udevd.o udevd.o udev_config.o logging.o $(SYSFS)
+ $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_config.o logging.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
$(STRIPCMD) $@

-$(SENDER): udevd.h udevsend.o udevd.o logging.o
- $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS)
+$(SENDER): udevd.h udevsend.o udevd.o udev_config.o logging.o $(SYSFS)
+ $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_config.o logging.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)
$(STRIPCMD) $@

clean:
--- udev-015/etc/udev/udev.conf.in 2004-01-29 19:59:08.296568248 +0200
+++ udev-015.log_option/etc/udev/udev.conf.in 2004-01-29 20:15:01.824609952 +0200
@@ -29,3 +29,6 @@
# explicit match in the permissions file
default_group="root"

+# udev_log - set to "yes" if you want logging, else "no"
+udev_log="yes"
+
--- udev-015/udev_config.c 2004-01-29 19:20:34.634298376 +0200
+++ udev-015.log_option/udev_config.c 2004-01-29 20:22:49.771471216 +0200
@@ -48,6 +48,7 @@ char udev_config_filename[PATH_MAX+NAME_
char default_mode_str[MODE_SIZE];
char default_owner_str[OWNER_SIZE];
char default_group_str[GROUP_SIZE];
+char udev_log_str[BOOL_SIZE];


static void init_variables(void)
@@ -60,6 +61,7 @@ static void init_variables(void)
strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE);
strfieldcpy(udev_rules_filename, UDEV_RULES_FILE);
strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE);
+ strfieldcpy(udev_log_str, UDEV_LOG_DEFAULT);
}

#define set_var(_name, _var) \
@@ -156,6 +158,7 @@ static int parse_config_file(void)
set_var("default_mode", default_mode_str);
set_var("default_owner", default_owner_str);
set_var("default_group", default_group_str);
+ set_var("udev_log", udev_log_str);
}
dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename,
lineno, temp - line, temp);
@@ -191,6 +194,7 @@ static void get_dirs(void)
dbg_parse("udev_db_filename = %s", udev_db_filename);
dbg_parse("udev_rules_filename = %s", udev_rules_filename);
dbg_parse("udev_permissions_filename = %s", udev_permissions_filename);
+ dbg_parse("udev_log_str = %s", udev_log_str);
parse_config_file();

dbg_parse("udev_root = %s", udev_root);
@@ -198,6 +202,7 @@ static void get_dirs(void)
dbg_parse("udev_db_filename = %s", udev_db_filename);
dbg_parse("udev_rules_filename = %s", udev_rules_filename);
dbg_parse("udev_permissions_filename = %s", udev_permissions_filename);
+ dbg_parse("udev_log_str = %s", udev_log_str);
}

void udev_init_config(void)
--- udev-015/logging.c 2004-01-29 19:20:40.673380296 +0200
+++ udev-015.log_option/logging.c 2004-01-29 20:02:41.316184344 +0200
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <syslog.h>

+#include "udev.h"
#include "logging.h"


@@ -47,6 +48,9 @@ int log_message(int level, const char *f
{
va_list args;

+ if (0 != strncmp(udev_log_str, "yes", BOOL_SIZE))
+ return 0;
+
if (!logging_init)
init_logging();
va_start(args, format);
--- udev-015/udev.h 2004-01-29 20:00:40.473555216 +0200
+++ udev-015.log_option/udev.h 2004-01-29 20:03:16.094897176 +0200
@@ -32,6 +32,7 @@
#define OWNER_SIZE 30
#define GROUP_SIZE 30
#define MODE_SIZE 8
+#define BOOL_SIZE 5

struct udevice {
char name[NAME_SIZE];
@@ -72,5 +73,6 @@ extern char udev_rules_filename[PATH_MAX
extern char default_mode_str[MODE_SIZE];
extern char default_owner_str[OWNER_SIZE];
extern char default_group_str[GROUP_SIZE];
+extern char udev_log_str[BOOL_SIZE];

#endif[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:00    [from the cache]
©2003-2011 Jasper Spaans