chiark / gitweb /
remove "udev_db" option from config file
authorKay Sievers <kay.sievers@suse.de>
Wed, 16 Nov 2005 03:14:15 +0000 (04:14 +0100)
committerKay Sievers <kay.sievers@suse.de>
Wed, 16 Nov 2005 03:14:15 +0000 (04:14 +0100)
All udev state is kept in /$udev_root/.udev/ now. No option to
configure that anymore, it will always be there.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
16 files changed:
Makefile
RELEASE-NOTES
docs/udev.xml
etc/udev/udev.conf.in
test/udev-test.pl
udev.8
udev.h
udev_add.c
udev_config.c
udev_db.c
udev_db.h [deleted file]
udev_remove.c
udev_rules.c
udevd.c
udevd.h
udevinfo.c

index de305cb9bffb202853d6d9aae9471796e40f8378..4968df42616b6cdffe8b416d4f8dfe0f7f4a9f8f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,6 @@ HEADERS = \
        udev.h                          \
        udev_utils.h                    \
        udev_rules.h                    \
        udev.h                          \
        udev_utils.h                    \
        udev_rules.h                    \
-       udev_db.h                       \
        logging.h                       \
        udev_libc_wrapper.h             \
        udev_selinux.h                  \
        logging.h                       \
        udev_libc_wrapper.h             \
        udev_selinux.h                  \
@@ -117,7 +116,6 @@ usrsbindir =        ${exec_prefix}/usr/sbin
 mandir =       ${prefix}/usr/share/man
 configdir =    ${etcdir}/udev
 udevdir =      /dev
 mandir =       ${prefix}/usr/share/man
 configdir =    ${etcdir}/udev
 udevdir =      /dev
-udevdb =       ${udevdir}/.udevdb
 LOCAL_CFG_DIR =        etc/udev
 DESTDIR =
 
 LOCAL_CFG_DIR =        etc/udev
 DESTDIR =
 
@@ -250,7 +248,6 @@ udev_version.h:
        @echo "Creating udev_version.h"
        @echo \#define UDEV_VERSION             \"$(VERSION)\" > $@
        @echo \#define UDEV_ROOT                \"$(udevdir)\" >> $@
        @echo "Creating udev_version.h"
        @echo \#define UDEV_VERSION             \"$(VERSION)\" > $@
        @echo \#define UDEV_ROOT                \"$(udevdir)\" >> $@
-       @echo \#define UDEV_DB                  \"$(udevdb)\" >> $@
        @echo \#define UDEV_CONFIG_DIR          \"$(configdir)\" >> $@
        @echo \#define UDEV_CONFIG_FILE         \"$(configdir)/udev.conf\" >> $@
        @echo \#define UDEV_RULES_FILE          \"$(configdir)/rules.d\" >> $@
        @echo \#define UDEV_CONFIG_DIR          \"$(configdir)\" >> $@
        @echo \#define UDEV_CONFIG_FILE         \"$(configdir)/udev.conf\" >> $@
        @echo \#define UDEV_RULES_FILE          \"$(configdir)/rules.d\" >> $@
@@ -347,7 +344,7 @@ install-bin:
        done;
 ifndef DESTDIR
        - killall udevd
        done;
 ifndef DESTDIR
        - killall udevd
-       - rm -rf $(udevdb)
+       - rm -rf /dev/.udev
        - $(sbindir)/udevd --daemon
 endif
 .PHONY: install-bin
        - $(sbindir)/udevd --daemon
 endif
 .PHONY: install-bin
@@ -363,7 +360,7 @@ uninstall-bin:
        - rm -f $(DESTDIR)$(DESTDIR)$(usrbindir)/udevtest
 ifndef DESTDIR
        - killall udevd
        - rm -f $(DESTDIR)$(DESTDIR)$(usrbindir)/udevtest
 ifndef DESTDIR
        - killall udevd
-       - rm -rf $(udevdb)
+       - rm -rf /dev/.udev
 endif
        @extras="$(EXTRAS)"; for target in $$extras; do \
                echo $$target; \
 endif
        @extras="$(EXTRAS)"; for target in $$extras; do \
                echo $$target; \
index 18e2829bbb08bee80b1ac1f7ce624ae5ea26e180..69166cfef1e16c1ae361e07569a59356aabce27c 100644 (file)
@@ -7,6 +7,10 @@ the timing of the "bus" link creation, the former integrated logic should
 be emulated by a rule placed before all other rules:
   ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
 
 be emulated by a rule placed before all other rules:
   ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
 
+The option "udev_db" does no longer exist. All udev state will always
+be in /$udev_root/.udev/ now, there is no longer an option to set this
+to anything else.
+
 udev 075
 ========
 Silent a too verbose error logging for the old hotplug.d/ dev.d/
 udev 075
 ========
 Silent a too verbose error logging for the old hotplug.d/ dev.d/
index c98054f8ceae5dd70e9db90cff2d555ef20aafe0..3db66f80016d4ea2ad55bf81e03359101a8b72df 100644 (file)
               </listitem>
             </varlistentry>
 
               </listitem>
             </varlistentry>
 
-            <varlistentry>
-              <term><option>udev_db</option></term>
-              <listitem>
-                <para>The name and location of the udev database. The default value is
-                <filename>/dev/.udevdb</filename>.</para>
-              </listitem>
-            </varlistentry>
-
             <varlistentry>
               <term><option>udev_rules</option></term>
               <listitem>
             <varlistentry>
               <term><option>udev_rules</option></term>
               <listitem>
index c44ed3092cee7a46dd55c022397b4ad53c47ef62..90c1f99ba65684cee79e16bc8f910ff853953670 100644 (file)
@@ -3,9 +3,6 @@
 # Where in the filesystem to place the device nodes
 udev_root="@udevdir@"
 
 # Where in the filesystem to place the device nodes
 udev_root="@udevdir@"
 
-# The name and location of the udev database.
-udev_db="@udevdir@/.udevdb"
-
 # The name and location of the udev rules file(s).
 udev_rules="@configdir@/rules.d"
 
 # The name and location of the udev rules file(s).
 udev_rules="@configdir@/rules.d"
 
index 2549c7ee69ac4f6862f75c851d4d7c726caa471a..c33c79b1c096adbe0793748484235da3a197a406 100755 (executable)
@@ -24,7 +24,6 @@ my $PWD               = $ENV{PWD};
 my $sysfs      = "sys/";
 my $udev_bin   = "../udev";
 my $udev_root  = "udev-root/"; # !!! directory will be removed !!!
 my $sysfs      = "sys/";
 my $udev_bin   = "../udev";
 my $udev_root  = "udev-root/"; # !!! directory will be removed !!!
-my $udev_db    = ".udevdb";
 my $udev_conf  = "udev-test.conf";
 my $udev_rules = "udev-test.rules";
 
 my $udev_conf  = "udev-test.conf";
 my $udev_rules = "udev-test.rules";
 
@@ -1740,7 +1739,6 @@ sub run_test {
        print "\n";
 
        if (defined($rules->{option}) && $rules->{option} eq "clean") {
        print "\n";
 
        if (defined($rules->{option}) && $rules->{option} eq "clean") {
-               system("rm -rf $udev_db");
                system("rm -rf $udev_root");
                mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
        }
                system("rm -rf $udev_root");
                mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
        }
@@ -1761,7 +1759,6 @@ mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
 # create config file
 open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
 print CONF "udev_root=\"$udev_root\"\n";
 # create config file
 open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
 print CONF "udev_root=\"$udev_root\"\n";
-print CONF "udev_db=\"$udev_db\"\n";
 print CONF "udev_rules=\"$udev_rules\"\n";
 print CONF "udev_log=\"info\"\n";
 close CONF;
 print CONF "udev_rules=\"$udev_rules\"\n";
 print CONF "udev_log=\"info\"\n";
 close CONF;
@@ -1791,7 +1788,6 @@ if ($ARGV[0]) {
 print "$error errors occured\n\n";
 
 # cleanup
 print "$error errors occured\n\n";
 
 # cleanup
-system("rm -rf $udev_db");
 system("rm -rf $udev_root");
 unlink($udev_rules);
 unlink($udev_conf);
 system("rm -rf $udev_root");
 unlink($udev_rules);
 unlink($udev_conf);
diff --git a/udev.8 b/udev.8
index a591a1398e280defb89e8016d66f65892b6c868b..2ea58120924ec85f22053f69d5922413c973e9f1 100644 (file)
--- a/udev.8
+++ b/udev.8
@@ -35,10 +35,6 @@ udev expects its main configuration file at
 Specifies where to place the device nodes in the filesystem. The default value is 
 \fI/dev\fR.
 .TP
 Specifies where to place the device nodes in the filesystem. The default value is 
 \fI/dev\fR.
 .TP
-\fBudev_db\fR
-The name and location of the udev database. The default value is 
-\fI/dev/.udevdb\fR.
-.TP
 \fBudev_rules\fR
 The name of the udev rules file or directory to look for files with the suffix 
 \fI.rules\fR. Multiple rule files are read in lexical order. The default value is 
 \fBudev_rules\fR
 The name of the udev rules file or directory to look for files with the suffix 
 \fI.rules\fR. Multiple rule files are read in lexical order. The default value is 
diff --git a/udev.h b/udev.h
index e61b692df789bb1c0ec1787ec7e43f0e7786810d..faa12a31eee1f130f18402e617b69b6ffa8a4ab7 100644 (file)
--- a/udev.h
+++ b/udev.h
@@ -28,6 +28,7 @@
 #include "list.h"
 
 #define COMMENT_CHARACTER              '#'
 #include "list.h"
 
 #define COMMENT_CHARACTER              '#'
+#define PATH_TO_NAME_CHAR              '@'
 #define LINE_SIZE                      512
 #define NAME_SIZE                      128
 #define PATH_SIZE                      256
 #define LINE_SIZE                      512
 #define NAME_SIZE                      128
 #define PATH_SIZE                      256
@@ -38,6 +39,8 @@
 #define DEFAULT_PARTITIONS_COUNT       15
 #define UDEV_ALARM_TIMEOUT             180
 
 #define DEFAULT_PARTITIONS_COUNT       15
 #define UDEV_ALARM_TIMEOUT             180
 
+#define DB_DIR                         ".udev/db"
+
 struct udev_rules;
 
 enum device_type {
 struct udev_rules;
 
 enum device_type {
@@ -92,9 +95,14 @@ extern void udev_init_config(void);
 extern int udev_start(void);
 extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid);
 
 extern int udev_start(void);
 extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid);
 
+extern int udev_db_add_device(struct udevice *dev);
+extern int udev_db_delete_device(struct udevice *dev);
+extern int udev_db_get_device(struct udevice *udev, const char *devpath);
+extern int udev_db_lookup_name(const char *name, char *devpath, size_t len);
+extern int udev_db_get_all_entries(struct list_head *name_list);
+
 extern char sysfs_path[PATH_SIZE];
 extern char udev_root[PATH_SIZE];
 extern char sysfs_path[PATH_SIZE];
 extern char udev_root[PATH_SIZE];
-extern char udev_db_path[PATH_SIZE];
 extern char udev_config_filename[PATH_SIZE];
 extern char udev_rules_filename[PATH_SIZE];
 extern int udev_log_priority;
 extern char udev_config_filename[PATH_SIZE];
 extern char udev_rules_filename[PATH_SIZE];
 extern int udev_log_priority;
index 1a224a17923641ac07f9f8925a29d8f1a6586d58..128917e519db9457720fdca27c15ebc9ca32a76c 100644 (file)
@@ -40,7 +40,6 @@
 #include "udev_version.h"
 #include "logging.h"
 #include "udev_rules.h"
 #include "udev_version.h"
 #include "logging.h"
 #include "udev_rules.h"
-#include "udev_db.h"
 #include "udev_selinux.h"
 
 
 #include "udev_selinux.h"
 
 
index 192a0b80d2e6055c06f93595c0eb217f909750cc..7037a1708169a2135931cf9fde890f841e9f5b12 100644 (file)
@@ -38,7 +38,6 @@
 /* global variables */
 char sysfs_path[PATH_SIZE];
 char udev_root[PATH_SIZE];
 /* global variables */
 char sysfs_path[PATH_SIZE];
 char udev_root[PATH_SIZE];
-char udev_db_path[PATH_SIZE];
 char udev_config_filename[PATH_SIZE];
 char udev_rules_filename[PATH_SIZE];
 int udev_log_priority;
 char udev_config_filename[PATH_SIZE];
 char udev_rules_filename[PATH_SIZE];
 int udev_log_priority;
@@ -153,12 +152,6 @@ static int parse_config_file(void)
                        continue;
                }
 
                        continue;
                }
 
-               if (strcasecmp(variable, "udev_db") == 0) {
-                       strlcpy(udev_db_path, value, sizeof(udev_db_path));
-                       remove_trailing_chars(udev_db_path, '/');
-                       continue;
-               }
-
                if (strcasecmp(variable, "udev_rules") == 0) {
                        strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename));
                        remove_trailing_chars(udev_rules_filename, '/');
                if (strcasecmp(variable, "udev_rules") == 0) {
                        strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename));
                        remove_trailing_chars(udev_rules_filename, '/');
@@ -180,7 +173,6 @@ void udev_init_config(void)
        const char *env;
 
        strcpy(udev_root, UDEV_ROOT);
        const char *env;
 
        strcpy(udev_root, UDEV_ROOT);
-       strcpy(udev_db_path, UDEV_DB);
        strcpy(udev_config_filename, UDEV_CONFIG_FILE);
        strcpy(udev_rules_filename, UDEV_RULES_FILE);
        udev_log_priority = LOG_ERR;
        strcpy(udev_config_filename, UDEV_CONFIG_FILE);
        strcpy(udev_rules_filename, UDEV_RULES_FILE);
        udev_log_priority = LOG_ERR;
@@ -207,7 +199,6 @@ void udev_init_config(void)
        dbg("sysfs_path='%s'", sysfs_path);
        dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename);
        dbg("udev_root='%s'", udev_root);
        dbg("sysfs_path='%s'", sysfs_path);
        dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename);
        dbg("udev_root='%s'", udev_root);
-       dbg("udev_db='%s'", udev_db_path);
        dbg("udev_rules='%s'", udev_rules_filename);
        dbg("udev_log=%d", udev_log_priority);
 }
        dbg("udev_rules='%s'", udev_rules_filename);
        dbg("udev_log=%d", udev_log_priority);
 }
index 5caf3fda8049094aeefcbba3b8402baa4810fea9..e2b7b4d9214e6a40b53f27eca451b41e71e56ea0 100644 (file)
--- a/udev_db.c
+++ b/udev_db.c
 #include "udev.h"
 #include "udev_utils.h"
 #include "logging.h"
 #include "udev.h"
 #include "udev_utils.h"
 #include "logging.h"
-#include "udev_db.h"
 
 
-#define PATH_TO_NAME_CHAR              '@'
 
 static int devpath_to_db_path(const char *devpath, char *filename, size_t len)
 {
        size_t start, end, i;
 
        /* add location of db files */
 
 static int devpath_to_db_path(const char *devpath, char *filename, size_t len)
 {
        size_t start, end, i;
 
        /* add location of db files */
-       start = strlcpy(filename, udev_db_path, len);
+       strlcpy(filename, udev_root, len);
+       strlcat(filename, "/", len);
+       start = strlcat(filename, DB_DIR, len);
        end = strlcat(filename, devpath, len);
        if (end > len)
                end = len;
        end = strlcat(filename, devpath, len);
        if (end > len)
                end = len;
@@ -205,12 +205,16 @@ int udev_db_delete_device(struct udevice *udev)
 
 int udev_db_lookup_name(const char *name, char *devpath, size_t len)
 {
 
 int udev_db_lookup_name(const char *name, char *devpath, size_t len)
 {
+       char dbpath[PATH_MAX];
        DIR *dir;
        int found = 0;
 
        DIR *dir;
        int found = 0;
 
-       dir = opendir(udev_db_path);
+       strlcpy(dbpath, udev_root, sizeof(dbpath));
+       strlcat(dbpath, "/", sizeof(dbpath));
+       strlcat(dbpath, DB_DIR, sizeof(dbpath));
+       dir = opendir(dbpath);
        if (dir == NULL) {
        if (dir == NULL) {
-               err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno));
+               err("unable to open udev_db '%s': %s", dbpath, strerror(errno));
                return -1;
        }
 
                return -1;
        }
 
@@ -230,7 +234,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len)
                if (ent->d_name[0] == '.')
                        continue;
 
                if (ent->d_name[0] == '.')
                        continue;
 
-               snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name);
+               snprintf(filename, sizeof(filename), "%s/%s", dbpath, ent->d_name);
                filename[sizeof(filename)-1] = '\0';
                dbg("looking at '%s'", filename);
 
                filename[sizeof(filename)-1] = '\0';
                dbg("looking at '%s'", filename);
 
@@ -274,11 +278,15 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len)
 
 int udev_db_get_all_entries(struct list_head *name_list)
 {
 
 int udev_db_get_all_entries(struct list_head *name_list)
 {
+       char dbpath[PATH_MAX];
        DIR *dir;
 
        DIR *dir;
 
-       dir = opendir(udev_db_path);
+       strlcpy(dbpath, udev_root, sizeof(dbpath));
+       strlcat(dbpath, "/", sizeof(dbpath));
+       strlcat(dbpath, DB_DIR, sizeof(dbpath));
+       dir = opendir(dbpath);
        if (dir == NULL) {
        if (dir == NULL) {
-               err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno));
+               err("unable to open udev_db '%s': %s", dbpath, strerror(errno));
                return -1;
        }
 
                return -1;
        }
 
diff --git a/udev_db.h b/udev_db.h
deleted file mode 100644 (file)
index 8951393..0000000
--- a/udev_db.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * udev_db.h
- *
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
- *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
- * 
- *     This program is distributed in the hope that it will be useful, but
- *     WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *     General Public License for more details.
- * 
- *     You should have received a copy of the GNU General Public License along
- *     with this program; if not, write to the Free Software Foundation, Inc.,
- *     675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _UDEV_DB_H_
-#define _UDEV_DB_H_
-
-
-extern int udev_db_add_device(struct udevice *dev);
-extern int udev_db_delete_device(struct udevice *dev);
-
-extern int udev_db_get_device(struct udevice *udev, const char *devpath);
-extern int udev_db_lookup_name(const char *name, char *devpath, size_t len);
-extern int udev_db_get_all_entries(struct list_head *name_list);
-
-#endif /* _UDEV_DB_H_ */
index 4d1b9286a0884a4d13ddf1c850c831be51aaab6e..83518604724f001657037ec72bad77c222dbae2e 100644 (file)
@@ -32,7 +32,6 @@
 #include "udev.h"
 #include "udev_utils.h"
 #include "udev_version.h"
 #include "udev.h"
 #include "udev_utils.h"
 #include "udev_version.h"
-#include "udev_db.h"
 #include "logging.h"
 
 static int delete_path(const char *path)
 #include "logging.h"
 
 static int delete_path(const char *path)
index a3100f8e143f7e051bd4102223772556e0367c28..492a9b0dfc89e81bd6333d65a142256ca5cdabae 100644 (file)
@@ -39,7 +39,6 @@
 #include "udev_version.h"
 #include "logging.h"
 #include "udev_rules.h"
 #include "udev_version.h"
 #include "logging.h"
 #include "udev_rules.h"
-#include "udev_db.h"
 
 
 /* extract possible {attr} and move str behind it */
 
 
 /* extract possible {attr} and move str behind it */
diff --git a/udevd.c b/udevd.c
index 93f02c5395d226dec85a66ab8d062c54d54ea589..e1afb7622b115fe1519a9f5ae42481fde525532c 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -139,9 +139,6 @@ enum event_state {
        EVENT_FAILED,
 };
 
        EVENT_FAILED,
 };
 
-#define PATH_TO_NAME_CHAR              '@'
-#define EVENT_QUEUE_DIR                        ".udev/queue"
-#define EVENT_FAILED_DIR               ".udev/failed"
 static void export_event_state(struct uevent_msg *msg, enum event_state state)
 {
        char filename[PATH_SIZE];
 static void export_event_state(struct uevent_msg *msg, enum event_state state)
 {
        char filename[PATH_SIZE];
diff --git a/udevd.h b/udevd.h
index 4040942ac9a5af59dca1da5a2a2de832a9f939b9..afbc3a31b14e6a0e95e8ac88517e5b6eb399a646 100644 (file)
--- a/udevd.h
+++ b/udevd.h
@@ -29,6 +29,9 @@
 #define UDEVD_PRIORITY                 -4
 #define UDEV_PRIORITY                  -2
 
 #define UDEVD_PRIORITY                 -4
 #define UDEV_PRIORITY                  -2
 
+#define EVENT_QUEUE_DIR                        ".udev/queue"
+#define EVENT_FAILED_DIR               ".udev/failed"
+
 /* maximum limit of runnig childs */
 #define UDEVD_MAX_CHILDS               64
 /* start to throttle forking if maximum number of running childs in our session is reached */
 /* maximum limit of runnig childs */
 #define UDEVD_MAX_CHILDS               64
 /* start to throttle forking if maximum number of running childs in our session is reached */
index b668655f29ec21e6a739c9dbdee65bd1ae48592e..8ff09da3d1504d7e212ea09a6a7954e72f844de0 100644 (file)
@@ -31,7 +31,6 @@
 #include "udev.h"
 #include "udev_utils.h"
 #include "udev_version.h"
 #include "udev.h"
 #include "udev_utils.h"
 #include "udev_version.h"
-#include "udev_db.h"
 #include "logging.h"
 
 
 #include "logging.h"