summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-11-16 04:14:15 +0100
committerKay Sievers <kay.sievers@suse.de>2005-11-16 04:14:15 +0100
commitfc55cf68ca0c0db5172a9de7e827c6c3f7c2a308 (patch)
tree8145a2bba92b1806c217ce644acf2cba64879679
parent7a7702509259f811d4f8321e64e28dc72037c88b (diff)
remove "udev_db" option from config file
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>
-rw-r--r--Makefile7
-rw-r--r--RELEASE-NOTES4
-rw-r--r--docs/udev.xml8
-rw-r--r--etc/udev/udev.conf.in3
-rwxr-xr-xtest/udev-test.pl4
-rw-r--r--udev.84
-rw-r--r--udev.h10
-rw-r--r--udev_add.c1
-rw-r--r--udev_config.c9
-rw-r--r--udev_db.c24
-rw-r--r--udev_db.h33
-rw-r--r--udev_remove.c1
-rw-r--r--udev_rules.c1
-rw-r--r--udevd.c3
-rw-r--r--udevd.h3
-rw-r--r--udevinfo.c1
16 files changed, 34 insertions, 82 deletions
diff --git a/Makefile b/Makefile
index de305cb9bf..4968df4261 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,6 @@ HEADERS = \
udev.h \
udev_utils.h \
udev_rules.h \
- udev_db.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
-udevdb = ${udevdir}/.udevdb
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 \#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\" >> $@
@@ -347,7 +344,7 @@ install-bin:
done;
ifndef DESTDIR
- killall udevd
- - rm -rf $(udevdb)
+ - rm -rf /dev/.udev
- $(sbindir)/udevd --daemon
endif
.PHONY: install-bin
@@ -363,7 +360,7 @@ uninstall-bin:
- 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; \
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 18e2829bbb..69166cfef1 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -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"
+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/
diff --git a/docs/udev.xml b/docs/udev.xml
index c98054f8ce..3db66f8001 100644
--- a/docs/udev.xml
+++ b/docs/udev.xml
@@ -72,14 +72,6 @@
</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>
<para>The name of the udev rules file or directory to look for files
diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in
index c44ed3092c..90c1f99ba6 100644
--- a/etc/udev/udev.conf.in
+++ b/etc/udev/udev.conf.in
@@ -3,9 +3,6 @@
# 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"
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 2549c7ee69..c33c79b1c0 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -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 $udev_db = ".udevdb";
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") {
- system("rm -rf $udev_db");
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";
-print CONF "udev_db=\"$udev_db\"\n";
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
-system("rm -rf $udev_db");
system("rm -rf $udev_root");
unlink($udev_rules);
unlink($udev_conf);
diff --git a/udev.8 b/udev.8
index a591a1398e..2ea5812092 100644
--- 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
-\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
diff --git a/udev.h b/udev.h
index e61b692df7..faa12a31ee 100644
--- a/udev.h
+++ b/udev.h
@@ -28,6 +28,7 @@
#include "list.h"
#define COMMENT_CHARACTER '#'
+#define PATH_TO_NAME_CHAR '@'
#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 DB_DIR ".udev/db"
+
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_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 udev_db_path[PATH_SIZE];
extern char udev_config_filename[PATH_SIZE];
extern char udev_rules_filename[PATH_SIZE];
extern int udev_log_priority;
diff --git a/udev_add.c b/udev_add.c
index 1a224a1792..128917e519 100644
--- a/udev_add.c
+++ b/udev_add.c
@@ -40,7 +40,6 @@
#include "udev_version.h"
#include "logging.h"
#include "udev_rules.h"
-#include "udev_db.h"
#include "udev_selinux.h"
diff --git a/udev_config.c b/udev_config.c
index 192a0b80d2..7037a17081 100644
--- a/udev_config.c
+++ b/udev_config.c
@@ -38,7 +38,6 @@
/* 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;
@@ -153,12 +152,6 @@ static int parse_config_file(void)
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, '/');
@@ -180,7 +173,6 @@ void udev_init_config(void)
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;
@@ -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("udev_db='%s'", udev_db_path);
dbg("udev_rules='%s'", udev_rules_filename);
dbg("udev_log=%d", udev_log_priority);
}
diff --git a/udev_db.c b/udev_db.c
index 5caf3fda80..e2b7b4d921 100644
--- a/udev_db.c
+++ b/udev_db.c
@@ -35,16 +35,16 @@
#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 */
- 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;
@@ -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)
{
+ char dbpath[PATH_MAX];
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) {
- 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;
}
@@ -230,7 +234,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len)
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);
@@ -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)
{
+ char dbpath[PATH_MAX];
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) {
- 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;
}
diff --git a/udev_db.h b/udev_db.h
deleted file mode 100644
index 89513932b3..0000000000
--- 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_ */
diff --git a/udev_remove.c b/udev_remove.c
index 4d1b9286a0..8351860472 100644
--- a/udev_remove.c
+++ b/udev_remove.c
@@ -32,7 +32,6 @@
#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)
diff --git a/udev_rules.c b/udev_rules.c
index a3100f8e14..492a9b0dfc 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -39,7 +39,6 @@
#include "udev_version.h"
#include "logging.h"
#include "udev_rules.h"
-#include "udev_db.h"
/* extract possible {attr} and move str behind it */
diff --git a/udevd.c b/udevd.c
index 93f02c5395..e1afb7622b 100644
--- a/udevd.c
+++ b/udevd.c
@@ -139,9 +139,6 @@ enum event_state {
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];
diff --git a/udevd.h b/udevd.h
index 4040942ac9..afbc3a31b1 100644
--- a/udevd.h
+++ b/udevd.h
@@ -29,6 +29,9 @@
#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 */
diff --git a/udevinfo.c b/udevinfo.c
index b668655f29..8ff09da3d1 100644
--- a/udevinfo.c
+++ b/udevinfo.c
@@ -31,7 +31,6 @@
#include "udev.h"
#include "udev_utils.h"
#include "udev_version.h"
-#include "udev_db.h"
#include "logging.h"