linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] libkmod: Fix documentation on config precedence order
@ 2021-01-19 14:52 Lucas De Marchi
  2021-01-19 14:52 ` [PATCH 2/3] depmod: fix " Lucas De Marchi
  2021-01-19 14:52 ` [PATCH 3/3] Support /usr/local for configuration files Lucas De Marchi
  0 siblings, 2 replies; 7+ messages in thread
From: Lucas De Marchi @ 2021-01-19 14:52 UTC (permalink / raw)
  To: linux-modules; +Cc: Jan Tojnar

/etc is has higher priority than /run.
---
 libkmod/libkmod.c  | 2 +-
 man/depmod.d.xml   | 2 +-
 man/modprobe.d.xml | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 43423d6..25655b9 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -235,7 +235,7 @@ static char *get_kernel_release(const char *dirname)
  * @config_paths: ordered array of paths (directories or files) where
  *                to load from user-defined configuration parameters such as
  *                alias, blacklists, commands (install, remove). If
- *                NULL defaults to /run/modprobe.d, /etc/modprobe.d and
+ *                NULL defaults to /etc/modprobe.d, /run/modprobe.d and
  *                /lib/modprobe.d. Give an empty vector if configuration should
  *                not be read. This array must be null terminated.
  *
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 4341a56..6472bda 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -40,8 +40,8 @@
 
   <refsynopsisdiv>
     <para><filename>/usr/lib/depmod.d/*.conf</filename></para>
-    <para><filename>/etc/depmod.d/*.conf</filename></para>
     <para><filename>/run/depmod.d/*.conf</filename></para>
+    <para><filename>/etc/depmod.d/*.conf</filename></para>
   </refsynopsisdiv>
 
   <refsect1><title>DESCRIPTION</title>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 211af84..a674d69 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -41,8 +41,8 @@
 
   <refsynopsisdiv>
     <para><filename>/lib/modprobe.d/*.conf</filename></para>
-    <para><filename>/etc/modprobe.d/*.conf</filename></para>
     <para><filename>/run/modprobe.d/*.conf</filename></para>
+    <para><filename>/etc/modprobe.d/*.conf</filename></para>
   </refsynopsisdiv>
 
   <refsect1><title>DESCRIPTION</title>
-- 
2.30.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] depmod: fix precedence order
  2021-01-19 14:52 [PATCH 1/3] libkmod: Fix documentation on config precedence order Lucas De Marchi
@ 2021-01-19 14:52 ` Lucas De Marchi
  2021-01-19 15:34   ` Marco d'Itri
  2021-01-19 18:31   ` Dmitry V. Levin
  2021-01-19 14:52 ` [PATCH 3/3] Support /usr/local for configuration files Lucas De Marchi
  1 sibling, 2 replies; 7+ messages in thread
From: Lucas De Marchi @ 2021-01-19 14:52 UTC (permalink / raw)
  To: linux-modules; +Cc: Jan Tojnar

Configuration in /etc should have higher prio than /run.
Given how rarely configuration in /run is used with depmod, this is
likely not to cause any problems, even if it's a change in behavior.
---
 tools/depmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/depmod.c b/tools/depmod.c
index 3f31cdf..8e1d9ec 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -51,8 +51,8 @@ static int verbose = DEFAULT_VERBOSE;
 static const char CFG_BUILTIN_KEY[] = "built-in";
 static const char CFG_EXTERNAL_KEY[] = "external";
 static const char *default_cfg_paths[] = {
-	"/run/depmod.d",
 	SYSCONFDIR "/depmod.d",
+	"/run/depmod.d",
 	"/lib/depmod.d",
 	NULL
 };
-- 
2.30.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Support /usr/local for configuration files
  2021-01-19 14:52 [PATCH 1/3] libkmod: Fix documentation on config precedence order Lucas De Marchi
  2021-01-19 14:52 ` [PATCH 2/3] depmod: fix " Lucas De Marchi
@ 2021-01-19 14:52 ` Lucas De Marchi
  1 sibling, 0 replies; 7+ messages in thread
From: Lucas De Marchi @ 2021-01-19 14:52 UTC (permalink / raw)
  To: linux-modules; +Cc: Jan Tojnar

Add /usr/local to the search path for configuration files. These are
intended for local installs, provided /usr/local is given as prefix.
---
 libkmod/libkmod.c  | 10 ++++++----
 man/depmod.d.xml   |  1 +
 man/modprobe.d.xml |  1 +
 tools/depmod.c     |  1 +
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 25655b9..7c2b889 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -64,6 +64,7 @@ static struct _index_files {
 static const char *default_config_paths[] = {
 	SYSCONFDIR "/modprobe.d",
 	"/run/modprobe.d",
+	"/usr/local/lib/modprobe.d",
 	"/lib/modprobe.d",
 	NULL
 };
@@ -234,10 +235,11 @@ static char *get_kernel_release(const char *dirname)
  *           Otherwise, give an absolute dirname.
  * @config_paths: ordered array of paths (directories or files) where
  *                to load from user-defined configuration parameters such as
- *                alias, blacklists, commands (install, remove). If
- *                NULL defaults to /etc/modprobe.d, /run/modprobe.d and
- *                /lib/modprobe.d. Give an empty vector if configuration should
- *                not be read. This array must be null terminated.
+ *                alias, blacklists, commands (install, remove). If NULL
+ *                defaults to /etc/modprobe.d, /run/modprobe.d,
+ *                /usr/local/lib/modprobe.d and /lib/modprobe.d. Give an empty
+ *                vector if configuration should not be read. This array must
+ *                be null terminated.
  *
  * Create kmod library context. This reads the kmod configuration
  * and fills in the default values.
diff --git a/man/depmod.d.xml b/man/depmod.d.xml
index 6472bda..b315e93 100644
--- a/man/depmod.d.xml
+++ b/man/depmod.d.xml
@@ -40,6 +40,7 @@
 
   <refsynopsisdiv>
     <para><filename>/usr/lib/depmod.d/*.conf</filename></para>
+    <para><filename>/usr/local/lib/depmod.d/*.conf</filename></para>
     <para><filename>/run/depmod.d/*.conf</filename></para>
     <para><filename>/etc/depmod.d/*.conf</filename></para>
   </refsynopsisdiv>
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index a674d69..0ab3e91 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -41,6 +41,7 @@
 
   <refsynopsisdiv>
     <para><filename>/lib/modprobe.d/*.conf</filename></para>
+    <para><filename>/usr/local/lib/modprobe.d/*.conf</filename></para>
     <para><filename>/run/modprobe.d/*.conf</filename></para>
     <para><filename>/etc/modprobe.d/*.conf</filename></para>
   </refsynopsisdiv>
diff --git a/tools/depmod.c b/tools/depmod.c
index 8e1d9ec..170a1d8 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -53,6 +53,7 @@ static const char CFG_EXTERNAL_KEY[] = "external";
 static const char *default_cfg_paths[] = {
 	SYSCONFDIR "/depmod.d",
 	"/run/depmod.d",
+	"/usr/local/lib/depmod.d",
 	"/lib/depmod.d",
 	NULL
 };
-- 
2.30.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] depmod: fix precedence order
  2021-01-19 14:52 ` [PATCH 2/3] depmod: fix " Lucas De Marchi
@ 2021-01-19 15:34   ` Marco d'Itri
  2021-01-19 17:22     ` Lucas De Marchi
  2021-01-19 18:31   ` Dmitry V. Levin
  1 sibling, 1 reply; 7+ messages in thread
From: Marco d'Itri @ 2021-01-19 15:34 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-modules

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

On Jan 19, Lucas De Marchi <lucas.demarchi@intel.com> wrote:

> Configuration in /etc should have higher prio than /run.
> Given how rarely configuration in /run is used with depmod, this is
> likely not to cause any problems, even if it's a change in behavior.
I agree. But the order is documented in the man pages, so you should 
change it there as well.

-- 
ciao,
Marco

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] depmod: fix precedence order
  2021-01-19 15:34   ` Marco d'Itri
@ 2021-01-19 17:22     ` Lucas De Marchi
  0 siblings, 0 replies; 7+ messages in thread
From: Lucas De Marchi @ 2021-01-19 17:22 UTC (permalink / raw)
  To: linux-modules

On Tue, Jan 19, 2021 at 04:34:45PM +0100, Marco d'Itri wrote:
>On Jan 19, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
>
>> Configuration in /etc should have higher prio than /run.
>> Given how rarely configuration in /run is used with depmod, this is
>> likely not to cause any problems, even if it's a change in behavior.
>I agree. But the order is documented in the man pages, so you should
>change it there as well.

that is what the first patch does.

thanks
Lucas De Marchi

>
>-- 
>ciao,
>Marco



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] depmod: fix precedence order
  2021-01-19 14:52 ` [PATCH 2/3] depmod: fix " Lucas De Marchi
  2021-01-19 15:34   ` Marco d'Itri
@ 2021-01-19 18:31   ` Dmitry V. Levin
  2021-01-19 20:36     ` Lucas De Marchi
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry V. Levin @ 2021-01-19 18:31 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-modules, Jan Tojnar

On Tue, Jan 19, 2021 at 06:52:37AM -0800, Lucas De Marchi wrote:
> Configuration in /etc should have higher prio than /run.

Should it?  Isn't the common practice nowadays to have /run override /etc?

> Given how rarely configuration in /run is used with depmod, this is
> likely not to cause any problems, even if it's a change in behavior.
> ---
>  tools/depmod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/depmod.c b/tools/depmod.c
> index 3f31cdf..8e1d9ec 100644
> --- a/tools/depmod.c
> +++ b/tools/depmod.c
> @@ -51,8 +51,8 @@ static int verbose = DEFAULT_VERBOSE;
>  static const char CFG_BUILTIN_KEY[] = "built-in";
>  static const char CFG_EXTERNAL_KEY[] = "external";
>  static const char *default_cfg_paths[] = {
> -	"/run/depmod.d",
>  	SYSCONFDIR "/depmod.d",
> +	"/run/depmod.d",
>  	"/lib/depmod.d",
>  	NULL
>  };

-- 
ldv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] depmod: fix precedence order
  2021-01-19 18:31   ` Dmitry V. Levin
@ 2021-01-19 20:36     ` Lucas De Marchi
  0 siblings, 0 replies; 7+ messages in thread
From: Lucas De Marchi @ 2021-01-19 20:36 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: Lucas De Marchi, linux-modules, Jan Tojnar

On Tue, Jan 19, 2021 at 10:35 AM Dmitry V. Levin <ldv@altlinux.org> wrote:
>
> On Tue, Jan 19, 2021 at 06:52:37AM -0800, Lucas De Marchi wrote:
> > Configuration in /etc should have higher prio than /run.
>
> Should it?  Isn't the common practice nowadays to have /run override /etc?

Doesn't make much sense as /run can be derived from /usr/lib. /etc is
what the system
administrator touches and should have the final say.

Man pages from systemd agree with this logic:

    <title>Configuration Directories and Precedence</title>

    <para>Configuration files are read from directories in
<filename>/etc/</filename>,
    <filename>/run/</filename>, <filename>/usr/local/lib/</filename>,
and <filename>/usr/lib/</filename>, in
    order of precedence, as listed in the SYNOPSIS section above.
Files must have the the
    <literal>.conf</literal> extension. Files in
<filename>/etc/</filename> override files with the same name
    in <filename>/run/</filename>, <filename>/usr/local/lib/</filename>, and
    <filename>/usr/lib/</filename>. Files in
<filename>/run/</filename> override files with the same name
    under <filename>/usr/</filename>.</para>

Lucas De Marchi

>
> > Given how rarely configuration in /run is used with depmod, this is
> > likely not to cause any problems, even if it's a change in behavior.
> > ---
> >  tools/depmod.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/depmod.c b/tools/depmod.c
> > index 3f31cdf..8e1d9ec 100644
> > --- a/tools/depmod.c
> > +++ b/tools/depmod.c
> > @@ -51,8 +51,8 @@ static int verbose = DEFAULT_VERBOSE;
> >  static const char CFG_BUILTIN_KEY[] = "built-in";
> >  static const char CFG_EXTERNAL_KEY[] = "external";
> >  static const char *default_cfg_paths[] = {
> > -     "/run/depmod.d",
> >       SYSCONFDIR "/depmod.d",
> > +     "/run/depmod.d",
> >       "/lib/depmod.d",
> >       NULL
> >  };
>
> --
> ldv

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-19 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 14:52 [PATCH 1/3] libkmod: Fix documentation on config precedence order Lucas De Marchi
2021-01-19 14:52 ` [PATCH 2/3] depmod: fix " Lucas De Marchi
2021-01-19 15:34   ` Marco d'Itri
2021-01-19 17:22     ` Lucas De Marchi
2021-01-19 18:31   ` Dmitry V. Levin
2021-01-19 20:36     ` Lucas De Marchi
2021-01-19 14:52 ` [PATCH 3/3] Support /usr/local for configuration files Lucas De Marchi

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox