module: rename next_string() to module_next_tag_pair()
authorLuis Chamberlain <mcgrof@kernel.org>
Sun, 19 Mar 2023 21:27:36 +0000 (14:27 -0700)
committerLuis Chamberlain <mcgrof@kernel.org>
Fri, 24 Mar 2023 18:05:15 +0000 (11:05 -0700)
This makes it clearer what it is doing. While at it,
make it available to other code other than main.c.
This will be used in the subsequent patch and make
the changes easier to read.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
kernel/module/internal.h
kernel/module/main.c

index e3883b7d48409f3cc1071fe6d2bc3c0b5b8d1f7e..1fa2328636ec29bf906b77cfd45ae12ce9da1c04 100644 (file)
@@ -96,6 +96,8 @@ long module_get_offset_and_type(struct module *mod, enum mod_mem_type type,
 char *module_flags(struct module *mod, char *buf, bool show_state);
 size_t module_flags_taint(unsigned long taints, char *buf);
 
+char *module_next_tag_pair(char *string, unsigned long *secsize);
+
 static inline void module_assert_mutex_or_preempt(void)
 {
 #ifdef CONFIG_LOCKDEP
index 1e739f5341004d1036d47b6c8d715291489dc236..ebb5e6b92a48f5440cc4a61afd4cb25402e44ecb 100644 (file)
@@ -1017,7 +1017,7 @@ int try_to_force_load(struct module *mod, const char *reason)
 }
 
 /* Parse tag=value strings from .modinfo section */
-static char *next_string(char *string, unsigned long *secsize)
+char *module_next_tag_pair(char *string, unsigned long *secsize)
 {
        /* Skip non-zero chars */
        while (string[0]) {
@@ -1051,10 +1051,10 @@ static char *get_next_modinfo(const struct load_info *info, const char *tag,
 
        if (prev) {
                size -= prev - modinfo;
-               modinfo = next_string(prev, &size);
+               modinfo = module_next_tag_pair(prev, &size);
        }
 
-       for (p = modinfo; p; p = next_string(p, &size)) {
+       for (p = modinfo; p; p = module_next_tag_pair(p, &size)) {
                if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=')
                        return p + taglen + 1;
        }