[PATCH v5 4/6] Intergrate symbol_exists with mod_symname_hash search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch introduces mod_symname_hash search to symbol_exists
to improve its performance. And code refactoring for
kernel_symbol_exists.

Signed-off-by: Tao Liu <ltao@xxxxxxxxxx>
Reviewed-by: Philipp Rudo <prudo@xxxxxxxxxx>
---
 symbols.c | 35 ++++-------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

diff --git a/symbols.c b/symbols.c
index 9373291..0a8e614 100644
--- a/symbols.c
+++ b/symbols.c
@@ -5489,33 +5489,11 @@ value_symbol(ulong value)
 int
 symbol_exists(char *symbol)
 {
-	int i;
-        struct syment *sp, *sp_end;
-	struct load_module *lm;
-
-	if ((sp = symname_hash_search(st->symname_hash, symbol)))
+	if (symname_hash_search(st->symname_hash, symbol))
 		return TRUE;
 
-        for (i = 0; i < st->mods_installed; i++) {
-                lm = &st->load_modules[i];
-		sp = lm->mod_symtable;
-                sp_end = lm->mod_symend;
-
-                for ( ; sp < sp_end; sp++) {
-                	if (STREQ(symbol, sp->name))
-                        	return(TRUE);
-                }
-
-		if (lm->mod_init_symtable) {
-			sp = lm->mod_init_symtable;
-			sp_end = lm->mod_init_symend;
-	
-			for ( ; sp < sp_end; sp++) {
-				if (STREQ(symbol, sp->name))
-					return(TRUE);
-			}
-		}
-	}
+	if (symname_hash_search(st->mod_symname_hash, symbol))
+		return TRUE;
 
         return(FALSE);
 }
@@ -5570,12 +5548,7 @@ per_cpu_symbol_search(char *symbol)
 int
 kernel_symbol_exists(char *symbol)
 {
-	struct syment *sp;
-
-	if ((sp = symname_hash_search(st->symname_hash, symbol)))
-                return TRUE;
-	else
-        	return FALSE;
+	return !!symname_hash_search(st->symname_hash, symbol);
 }
 
 /*
-- 
2.29.2

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux