diff options
| -rw-r--r-- | meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch b/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch index 18d9793533..ea0570af2b 100644 --- a/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch +++ b/meta/recipes-kernel/kmod/kmod/0001-depmod-Add-support-for-excluding-a-directory.patch | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | From 01f3fe68a7a42b06eb318f3b09fa5e5ea75d46c4 Mon Sep 17 00:00:00 2001 | 1 | From f50e2d67575ac5f256fb853ca9d29aeac92d9a57 Mon Sep 17 00:00:00 2001 |
| 2 | From: Saul Wold <saul.wold@windriver.com> | 2 | From: Saul Wold <saul.wold@windriver.com> |
| 3 | Date: Tue, 22 Mar 2022 12:11:45 -0700 | 3 | Date: Thu, 31 Mar 2022 14:56:28 -0700 |
| 4 | Subject: [PATCH] depmod: Add support for excluding a directory | 4 | Subject: [PATCH] depmod: Add support for excluding a directory |
| 5 | 5 | ||
| 6 | This adds support to depmod to enable a new exclude directive in | 6 | This adds support to depmod to enable a new exclude directive in |
| @@ -12,13 +12,15 @@ via a new exclude directive. | |||
| 12 | depmod.d/exclude.conf example: | 12 | depmod.d/exclude.conf example: |
| 13 | exclude .debug | 13 | exclude .debug |
| 14 | 14 | ||
| 15 | Upstream-Status: Submitted | 15 | Upstream-Status: Accepted |
| 16 | 16 | ||
| 17 | Signed-off-by: Saul Wold <saul.wold@windriver.com> | 17 | Signed-off-by: Saul Wold <saul.wold@windriver.com> |
| 18 | [ Fix warnings and make should_exclude_dir() return bool ] | ||
| 19 | Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> | ||
| 18 | --- | 20 | --- |
| 19 | man/depmod.d.xml | 14 +++++++++++ | 21 | man/depmod.d.xml | 14 ++++++++++ |
| 20 | tools/depmod.c | 65 +++++++++++++++++++++++++++++++++++++++++++++--- | 22 | tools/depmod.c | 66 +++++++++++++++++++++++++++++++++++++++++++++--- |
| 21 | 2 files changed, 75 insertions(+), 4 deletions(-) | 23 | 2 files changed, 76 insertions(+), 4 deletions(-) |
| 22 | 24 | ||
| 23 | diff --git a/man/depmod.d.xml b/man/depmod.d.xml | 25 | diff --git a/man/depmod.d.xml b/man/depmod.d.xml |
| 24 | index b315e93..76548e9 100644 | 26 | index b315e93..76548e9 100644 |
| @@ -46,7 +48,7 @@ index b315e93..76548e9 100644 | |||
| 46 | </refsect1> | 48 | </refsect1> |
| 47 | 49 | ||
| 48 | diff --git a/tools/depmod.c b/tools/depmod.c | 50 | diff --git a/tools/depmod.c b/tools/depmod.c |
| 49 | index eb810b8..ac365e9 100644 | 51 | index 07a35ba..4117dd1 100644 |
| 50 | --- a/tools/depmod.c | 52 | --- a/tools/depmod.c |
| 51 | +++ b/tools/depmod.c | 53 | +++ b/tools/depmod.c |
| 52 | @@ -458,6 +458,11 @@ struct cfg_external { | 54 | @@ -458,6 +458,11 @@ struct cfg_external { |
| @@ -125,32 +127,33 @@ index eb810b8..ac365e9 100644 | |||
| 125 | } | 127 | } |
| 126 | 128 | ||
| 127 | 129 | ||
| 128 | @@ -1229,6 +1270,24 @@ add: | 130 | @@ -1229,6 +1270,25 @@ add: |
| 129 | return 0; | 131 | return 0; |
| 130 | } | 132 | } |
| 131 | 133 | ||
| 132 | +static int should_exclude_dir(struct cfg *cfg, char *name) | 134 | +static bool should_exclude_dir(const struct cfg *cfg, const char *name) |
| 133 | +{ | 135 | +{ |
| 134 | + struct cfg_exclude *exc; | 136 | + struct cfg_exclude *exc; |
| 135 | + | 137 | + |
| 136 | + if (name[0] == '.' && (name[1] == '\0' || | 138 | + if (name[0] == '.' && (name[1] == '\0' || |
| 137 | + (name[1] == '.' && name[2] == '\0'))) | 139 | + (name[1] == '.' && name[2] == '\0'))) |
| 138 | + return 1; | 140 | + return true; |
| 141 | + | ||
| 139 | + if (streq(name, "build") || streq(name, "source")) | 142 | + if (streq(name, "build") || streq(name, "source")) |
| 140 | + return 1; | 143 | + return true; |
| 141 | + | 144 | + |
| 142 | + for (exc = cfg->excludes; exc != NULL; exc = exc->next) { | 145 | + for (exc = cfg->excludes; exc != NULL; exc = exc->next) { |
| 143 | + if (streq(name, exc->exclude_dir)) { | 146 | + if (streq(name, exc->exclude_dir)) |
| 144 | + return 1; | 147 | + return true; |
| 145 | + } | ||
| 146 | + } | 148 | + } |
| 147 | + return 0; | 149 | + |
| 150 | + return false; | ||
| 148 | +} | 151 | +} |
| 149 | + | 152 | + |
| 150 | static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t baselen, struct scratchbuf *s_path) | 153 | static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t baselen, struct scratchbuf *s_path) |
| 151 | { | 154 | { |
| 152 | struct dirent *de; | 155 | struct dirent *de; |
| 153 | @@ -1240,11 +1299,9 @@ static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t basel | 156 | @@ -1240,11 +1300,9 @@ static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t basel |
| 154 | size_t namelen; | 157 | size_t namelen; |
| 155 | uint8_t is_dir; | 158 | uint8_t is_dir; |
| 156 | 159 | ||
