Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Sep 30, 2023
Merged

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

merged 3 commits into from Sep 30, 2023

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

src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
@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.

Vivien Kraus 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.
src/udev/udevadm-hwdb.c Outdated Show resolved Hide resolved
@bbonev bbonev merged commit 805c07a into eudev-project:master Sep 30, 2023
2 checks passed
@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.

1 participant