1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
Commit Graph

39 Commits

Author SHA1 Message Date
Sergey Vlasov
e0c0807ab3 unlink old database file before creating a new one
udev_db_add_device() can be called when the corressponding database
entry already exists - it should overwrite the old entry in this case.
However, if the old entry was a symlink, fopen(filename, "w") will not
overwrite it properly - it will keep the symlink and create a file
named after the symlink target.  Calling unlink(filename) before
trying to create the database file fixes the problem.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
2007-01-23 19:55:38 +01:00
Kay Sievers
27b77df44d update source file headers 2006-08-28 00:29:11 +02:00
Kay Sievers
5780be9eab rename major/minor variable to maj/min to avoid warning 2006-08-24 10:25:34 +02:00
Kay Sievers
34bb5d057c udev_db.c: include <sys/stat.h> 2006-08-24 00:13:07 +02:00
Kay Sievers
e3e7358137 db: don't create a db file for only a node name to store 2006-08-21 02:38:48 +02:00
Kay Sievers
95776dc6ec consistent key naming to match only the event device or include all parent devices
This scheme is more consistent and makes it obvious if a match happens
against the event device only, or the full chain of parent devices.

The old key names are now:
  BUS -> SUBSYSTEMS
  ID -> KERNELS
  SYSFS -> ATTRS
  DRIVER -> DRIVERS

Match keys for the event device:
  KERNEL
  SUBSYSTEM
  ATTR
  DRIVER (in a future release, for now the same as DRIVERS)

Match keys for all devices along the parent device chain:
  KERNELS
  SUBSYSTEMS
  ATTRS
  DRIVERS

ID, BUS, SYSFS are no longer mentioned in the man page but still work.
DRIVER must be converted to DRIVERS to match the new scheme. For now,
an error is logged, if DRIVER is used. In a future release, the DRIVER
key behaviour will change.
2006-08-19 16:06:25 +02:00
Kay Sievers
554dde8e9a db: store devpath - node relationship for all devices
If we don't have any interesting values to store, we just use
a symlink (doesn't occupy a whole page on tmpfs like a file)
to store the name of the node belonging to a devpath. This will
allow udevinfo to resolve all names, even when we don't have a
full database entry.
2006-08-18 02:27:16 +02:00
Kay Sievers
1aa1e24848 replace libsysfs
We never used any of the libsysfs convenience features. Here we replace
it completely with 300 lines of code, which are much simpler and a bit
faster cause udev(d) does not open any syfs file for a simple event which
does not need any parent device information.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-09 21:18:00 +01:00
Kay Sievers
caa4fd85ae don't log error if database does not exist
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-12-20 11:23:08 +01:00
Kay Sievers
30473427e8 merge two consecutive static strlcat's
Thanks for Marco, who noticed it.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-24 20:06:22 +01:00
Kay Sievers
fc55cf68ca 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>
2005-11-16 04:14:15 +01:00
Marco d'Itri
df4e89bfa6 move some logging from dbg() to info() 2005-11-07 18:52:03 +01:00
Marco d'Itri
ff3e4bed21 add strerror() to error logs 2005-11-07 18:44:18 +01:00
Kay Sievers
7104c558da don't store devpath in udevdb, we don't need it
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 23:27:43 +02:00
Kay Sievers
314edf3ca4 change parameter order of udev_db_search_name()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 15:46:58 +02:00
Kay Sievers
db481105c2 prepare for new HAL udevdb dump
HAL soon wants to read the whole content of the udevdatabase while
starting up. This makes the whole udev structure available to the
udevinfo "dump".

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 02:59:20 +02:00
Kay Sievers
3ad7a5b1a5 fix lookup for name in the udevdb, it should return the devpath
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-26 22:43:49 +02:00
Kay Sievers
40caaeec51 cleanup some debug output and move to info level + unify select() loops
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15 11:57:04 +02:00
Kay Sievers
853ccc433c fix more compiler warnings ...
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13 00:18:44 +02:00
Kay Sievers
13d11705bf switch some strlcpy's to memcpy
strlcpy counts the sourec string lengt and is therefore not suitable
to copy a defined length of characters from one string to another.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08 02:21:55 +02:00
Kay Sievers
e8d569b414 move code to its own files
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-22 12:35:58 -04:00
Kay Sievers
25103c4849 create udevdb files only if somehting interesting happened
Device nodes created with the default rule, without any symlink or option
are no longer saved to the udevdb. This saves us ~3 MB RAM for pretty much
useless files on tmpfs.
Note: HAL needs a fix to handle this correctly. It's already available on
the list.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-05 22:40:42 +02:00
Kay Sievers
b8476286d6 store the imported device information in the udevdb
Any program can query with udevinfo for persistent device
attributes evaluated on device discovery now.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-26 18:55:24 +02:00
kay.sievers@vrfy.org
8a4c0c32f4 [PATCH] fix klibc's broken strlcpy/strlcat
udevinfo segfaults cause klibc's strlcpy writes behind the specified
size of the destination string. strlcat truncates the destination
string which is also not what you expect from a concatenation function.
2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
6b493a20e1 [PATCH] support log-priority levels in udev.conf 2005-04-26 23:54:59 -07:00
kay.sievers@vrfy.org
63f61c5cf6 [PATCH] replace strncpy()/strncat() by strlcpy()/strlcat() 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
845d4751ac [PATCH] udev_volume_id: version 39 2005-04-26 23:51:00 -07:00
kay.sievers@vrfy.org
599e17a3e6 [PATCH] udevinfo -d: speed-up device dump 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org
e48fc108d9 [PATCH] allow unlimitied count of symlinks 2005-04-26 23:48:48 -07:00
kay.sievers@vrfy.org
237415b141 [PATCH] unmap db-file after use 2005-04-26 23:39:49 -07:00
kay.sievers@vrfy.org
9fe1a96d88 [PATCH] udevinfo: print devpath -> node relationship for all devices 2005-04-26 23:39:48 -07:00
kay.sievers@vrfy.org
f8a178a35b [PATCH] trivial rename of some variables 2005-04-26 23:36:14 -07:00
kay.sievers@vrfy.org
8f2f6e426f [PATCH] cleanup db functions 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org
7e720bd4ad [PATCH] switch major/minor to dev_t 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org
1cec1c2416 [PATCH] remove the device node only if the major/minor number matches 2005-04-26 23:36:13 -07:00
kay.sievers@vrfy.org
1134a81b98 [PATCH] fix -Wsign-compare warnings 2005-04-26 23:24:19 -07:00
kay.sievers@vrfy.org
9af5bb2f8f [PATCH] rename udev_lib to udev_utils and dev_d to udev_multiplex 2005-04-26 22:44:02 -07:00
kay.sievers@vrfy.org
7efa217db0 [PATCH] add NAME{ignore_remove} attribute
Some broken ide drivers are generating high event traffic, with
add/remove events. With this attribute, it can be specified,
that the node is always available. It may be used in conjunction
with the new DRIVER= match to catch specific kernel device drivers.
2005-04-26 22:27:34 -07:00
kay.sievers@vrfy.org
02fa9ae589 [PATCH] rename udevdb* to udev_db* 2005-04-26 22:25:14 -07:00