diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2003-12-30 22:31:37 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:13:12 -0700 |
commit | f4dc8d11c22ef72567a2e5c56ac9bae82867189b (patch) | |
tree | 9d7f00e254092ec7fe277c7db1dbc75abb5c9f9f /udevdb.c | |
parent | c78cb204bc64bce32e705dead071bd4149b731ac (diff) |
[PATCH] make udev user callable to query the database
Here is a slightly better version that prints the usage if a unknown option is given:
kay@pim:~/src/udev.kay$ ./udev -x
./udev: invalid option -- x
Usage: [-qrVh]
-q arg query database
-r print udev root
-V print udev version
-h print this help text
> Here is a patch that makes it possible to call udev with options on the command line.
> Valid options are for now:
>
> -V for the udev version:
> kay@pim:~/src/udev.kay$ ./udev -V
> udev, version 011_bk
>
> -r for the udev root:
> kay@pim:~/src/udev.kay$ ./udev -r
> /udev/
>
> -q to query the database with the sysfs path for the name of the node:
> kay@pim:~/src/udev.kay$ ./udev -q /class/video4linux/video0
> test/video/webcam0
Diffstat (limited to 'udevdb.c')
-rw-r--r-- | udevdb.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -128,3 +128,16 @@ int udevdb_init(int init_flag) } return 0; } + +/** + * udevdb_init: open database for reading + */ +int udevdb_open_ro(void) +{ + udevdb = tdb_open(udev_db_filename, 0, 0, O_RDONLY, 0); + if (udevdb == NULL) { + dbg("unable to open database at '%s'", udev_db_filename); + return -EINVAL; + } + return 0; +} |