depmod: Add support for excluding a directory
PATCH v2 1/1 depmod: Add support for excluding a directory
This adds support to depmod to enable a new exclude directive in the depmod.d/*.conf configuration file. Currently depmod already excludes directories named source or build. This change will allow additional directories like .debug to be excluded also via a new exclude directive.
depmod.d/exclude.conf example:
exclude .debug
Upstream-Status: Submitted
---
v2: create should_exclude_dir() and some clean ups from Lucas
man/depmod.d.xml | 14 +++++++++++ tools/depmod.c | 65 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 4 deletions(-)
man/depmod.d.xml +14 -0
@@ -131,6 +131,20 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term>exclude <replaceable>excludedir</replaceable> + </term> + <listitem> + <para> + This specifies the trailing directories that will be excluded + during the search for kernel modules. + </para> + <para> + The <replaceable>excludedir</replaceable> is the trailing directory + to exclude + </para> + </listitem> + </varlistentry> </variablelist> </refsect1>
tools/depmod.c +61 -4
108 lines not on this page · raw message
Signature · 1 line
2.31.1
Lucas De Marchi
AppliedQuoted 6 lines · Saul Wold
This adds support to depmod to enable a new exclude directive in the depmod.d/*.conf configuration file. Currently depmod already excludes directories named source or build. This change will allow additional directories like .debug to be excluded also via a new exclude directive.
Quoted 6 lines
depmod.d/exclude.confexample:
exclude .debugUpstream-Status: Submitted
Signed-off-by Saul Wold <[email protected]>
tools/depmod.c: In function ‘depmod_modules_search_dir’:tools/depmod.c:1302:46: warning: passing argument 1 of ‘should_exclude_dir’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1302 | if (should_exclude_dir(depmod->cfg, name))
| ~~~~~~^~~~~tools/depmod.c:1273:43: note: expected ‘struct cfg *’ but argument is of type ‘const struct cfg *’
1273 | static int should_exclude_dir(struct cfg *cfg, char *name)
| ~~~~~~~~~~~~^~~
tools/depmod.c:1302:53: warning: passing argument 2 of ‘should_exclude_dir’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1302 | if (should_exclude_dir(depmod->cfg, name))
| ^~~~tools/depmod.c:1273:54: note: expected ‘char *’ but argument is of type ‘const char *’
1273 | static int should_exclude_dir(struct cfg *cfg, char *name)
| ~~~~~~^~~~
I fixed the warnings and changed should_exclude_dir() to return bool.
Applied, thanks.
Lucas De Marchi