1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

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>
This commit is contained in:
Kay Sievers 2005-11-16 04:14:15 +01:00
parent 7a77025092
commit fc55cf68ca
16 changed files with 34 additions and 82 deletions

View File

@ -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; \

View 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"
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/

View File

@ -71,14 +71,6 @@
</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>

View File

@ -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"

View File

@ -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);

4
udev.8
View File

@ -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

10
udev.h
View File

@ -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;

View File

@ -40,7 +40,6 @@
#include "udev_version.h"
#include "logging.h"
#include "udev_rules.h"
#include "udev_db.h"
#include "udev_selinux.h"

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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_ */

View File

@ -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)

View File

@ -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 */

View File

@ -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];

View File

@ -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 */

View File

@ -31,7 +31,6 @@
#include "udev.h"
#include "udev_utils.h"
#include "udev_version.h"
#include "udev_db.h"
#include "logging.h"