summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2003-10-15 23:50:13 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:01:40 -0700
commit6739707df53097ac378f8ff2f0aa694257e31da1 (patch)
tree841262fe4d59cc4200e8c8cb3dc7d100ea3cec8a
parentc27e69116d3ef0ea069a3c5146009ced08a0238b (diff)
[PATCH] put config files and database in /etc/udev by default
Can be overridden on the makefile line.
-rw-r--r--Makefile14
-rw-r--r--namedev.h1
-rw-r--r--udev.h16
-rw-r--r--udevdb.c14
-rw-r--r--udevdb.h5
5 files changed, 35 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 3f9fef49d5..92b3dc7465 100644
--- a/Makefile
+++ b/Makefile
@@ -22,10 +22,16 @@ DEBUG = true
ROOT = udev
-VERSION = 0.2
+VERSION = 003
INSTALL_DIR = /usr/local/bin
RELEASE_NAME = $(ROOT)-$(VERSION)
+# override this to make udev look in a different location for it's config files
+PREFIX =
+CONFIG_DIR = $(PREFIX)/etc/udev/
+
+# place to put our device nodes
+UDEV_DIR = /udev/
# Comment out this line to build with something other
# than the local version of klibc
@@ -135,7 +141,9 @@ GEN_HEADERS = udev_version.h
# Rules on how to create the generated header files
udev_version.h:
- @echo \#define UDEV_VERSION \"$(VERSION)\" > $@
+ @echo \#define UDEV_VERSION \"$(VERSION)\" > $@
+ @echo \#define UDEV_CONFIG_DIR \"$(CONFIG_DIR)\" >> $@
+ @echo \#define UDEV_ROOT \"$(UDEV_DIR)\" >> $@
$(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) $(TDB)
@@ -151,7 +159,7 @@ clean:
$(MAKE) -C libsysfs clean
$(MAKE) -C tdb clean
-DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS )
+DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v ".tdb" )
DISTDIR := $(RELEASE_NAME)
srcdir = .
release: $(DISTFILES) clean
diff --git a/namedev.h b/namedev.h
index 1f535c4c8b..567756c827 100644
--- a/namedev.h
+++ b/namedev.h
@@ -30,7 +30,6 @@ struct sysfs_class_device;
/* namedev config files */
#define COMMENT_CHARACTER '#'
-#define NAMEDEV_CONFIG_ROOT "/home/greg/src/udev/"
#define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions"
#define NAMEDEV_CONFIG_FILE "namedev.config"
diff --git a/udev.h b/udev.h
index e9fc2e46eb..33cb89af55 100644
--- a/udev.h
+++ b/udev.h
@@ -34,15 +34,23 @@
#define dbg(format, arg...) do { } while (0)
#endif
+/* Parser needs it's own debugging statement, we usually don't care about this at all */
+#ifdef DEBUG_PARSER
+#define dbg_parse(format, arg...) \
+ do { \
+ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
+ } while (0)
+#else
+ #define dbg_parse(format, arg...) do { } while (0)
+#endif
-/* Lots of constants that should be in a config file sometime */
-
-/* Where udev should create its device nodes, trailing / needed */
-#define UDEV_ROOT "/udev/"
extern int log_message (int level, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));
+
+/* Lots of constants that should be in a config file sometime */
+
#define NAME_SIZE 100
#define OWNER_SIZE 30
#define GROUP_SIZE 30
diff --git a/udevdb.c b/udevdb.c
index c2e90be32f..db5bb73de9 100644
--- a/udevdb.c
+++ b/udevdb.c
@@ -9,6 +9,9 @@
#include <errno.h>
#include <signal.h>
+#include "udev_version.h"
+#include "udev.h"
+#include "namedev.h"
#include "udevdb.h"
#include "tdb/tdb.h"
@@ -63,9 +66,14 @@ static void udevdb_close(void)
*/
static int udevdb_open(int method)
{
- udevdb = tdb_open(UDEVDB, 0, method, O_RDWR | O_CREAT, 0644);
- if (udevdb == NULL)
- return -1;
+ udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, method, O_RDWR | O_CREAT, 0644);
+ if (udevdb == NULL) {
+ if (method == UDEVDB_INTERNAL)
+ dbg("Unable to initialize in-memory database");
+ else
+ dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB);
+ return -EINVAL;
+ }
return 0;
}
diff --git a/udevdb.h b/udevdb.h
index a9ba2f93b4..089af2972b 100644
--- a/udevdb.h
+++ b/udevdb.h
@@ -4,10 +4,7 @@
#ifndef _UDEVDB_H_
#define _UDEVDB_H_
-#include "namedev.h"
-#include "udev.h"
-
-#define UDEVDB "/home/greg/src/udev/udevdb.tdb"
+#define UDEV_DB "udevdb.tdb"
#define PATH_SIZE 256