[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241119235705.1576946-12-masahiroy@kernel.org>
Date: Wed, 20 Nov 2024 08:56:50 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>,
linux-kernel@...r.kernel.org
Subject: [PATCH 12/15] modpost: move strstarts() to modpost.h
This macro is useful in file2alias.c as well.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/mod/file2alias.c | 2 +-
scripts/mod/modpost.c | 2 --
scripts/mod/modpost.h | 2 ++
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index b2d5e6451959..01a4b0eaca6d 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1513,7 +1513,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
return;
/* All our symbols are of form __mod_<name>__<identifier>_device_table. */
- if (strncmp(symname, "__mod_", strlen("__mod_")))
+ if (!strstarts(symname, "__mod_"))
return;
name = symname + strlen("__mod_");
namelen = strlen(name);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 1948d69ce2b9..3bbd5efcf3f3 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -341,8 +341,6 @@ static const char *sec_name(const struct elf_info *info, unsigned int secindex)
return sech_name(info, &info->sechdrs[secindex]);
}
-#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
-
static struct symbol *sym_add_exported(const char *name, struct module *mod,
bool gpl_only, const char *namespace)
{
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 52efe0026b34..49848fcbe2a1 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -67,6 +67,8 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
+
struct buffer {
char *p;
int pos;
--
2.43.0
Powered by blists - more mailing lists