Skip to content

Dynamically get the udevadm hwdb files with a path variable#262

Merged
bbonev merged 3 commits intomasterfrom
unknown repository
Sep 30, 2023
Merged

Dynamically get the udevadm hwdb files with a path variable#262
bbonev merged 3 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Sep 26, 2023

Dear eudev developers,

It would be useful for a Guix package to let udevadm hwdb --update collect hwdb files from different places in the file system. Usually, this is done with a search path. Here I introduce UDEV_HWDB_PATH, which is searched when compiling hwdb.bin, for hwdb files, in addition to /etc/udev/hwdb.d and /lib/udev/hwdb.d.

What do you think?

Best regards,

Vivien Kraus

@ghost
Copy link
Author

ghost commented Sep 30, 2023

I think I applied the requested changes, or responded in the commit message and/or in comments.

vivien35af and others added 2 commits September 30, 2023 19:40
Introduce UDEV_HWDB_PATH, containing a colon-separated path with hwdb
files in it. The whole path is searched, in addition to the system
locations, when searching for hwdb files.

Due to how conf_files_list_strv is implemented, as a thin wrapper
around the internal function, it is easy to also implement a variant
accepting a search path in the same way. Since the internal function
expects an allocated array of allocated strings, the path scanning is
done in 2 steps, to first get the array length, and then duplicate the
items. It is not possible to use strtok(_r) here because it would work
for only 1 pass.

* src/shared/conf-files.c (conf_files_list_follow_path): New function.
(conf_files_list_strv_path): Use it here.
* src/shared/conf-files.h: Export the signature for the _path variant.
* src/udev/udevadm-hwdb.c (list_conf_file_path): New function
replacing conf_file_dirs.
(help): Document the search path for hwdb files.
(adm_hwdb): Use list_conf_file_path and conf_files_list_strv_path.
* man/udevadm.xml: Mention UDEV_HWDB_PATH.
* man/udev.xml: Same.
* man/udevadm.8: Regenerate.
* man/udev.7: Same.
@bbonev bbonev merged commit 805c07a into eudev-project:master Sep 30, 2023
@bbonev bbonev mentioned this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants