Dynamically get the udevadm hwdb files with a path variable#262
Conversation
bbonev
reviewed
Sep 30, 2023
Author
|
I think I applied the requested changes, or responded in the commit message and/or in comments. |
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
requested changes
Sep 30, 2023
bbonev
approved these changes
Sep 30, 2023
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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