diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-31 15:05:36 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 22:35:37 -0400 |
commit | 49502677e11079c2e3e01867c922a894ce06a8be (patch) | |
tree | c3e512207a4d5c4cc0678b8154c2643ca39201e0 | |
parent | 66f92cf9d415e96a5bdd6c64de8dd8418595d2fc (diff) |
module: use strstarts()
Impact: minor cleanup.
I'm not going to neaten anyone else's code, but I'm happy to clean up
my own.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/module.c b/kernel/module.c index 1a9a3986b136..f6e08b7cff7c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1673,8 +1673,7 @@ static void layout_sections(struct module *mod, | |||
1673 | if ((s->sh_flags & masks[m][0]) != masks[m][0] | 1673 | if ((s->sh_flags & masks[m][0]) != masks[m][0] |
1674 | || (s->sh_flags & masks[m][1]) | 1674 | || (s->sh_flags & masks[m][1]) |
1675 | || s->sh_entsize != ~0UL | 1675 | || s->sh_entsize != ~0UL |
1676 | || strncmp(secstrings + s->sh_name, | 1676 | || strstarts(secstrings + s->sh_name, ".init")) |
1677 | ".init", 5) == 0) | ||
1678 | continue; | 1677 | continue; |
1679 | s->sh_entsize = get_offset(mod, &mod->core_size, s, i); | 1678 | s->sh_entsize = get_offset(mod, &mod->core_size, s, i); |
1680 | DEBUGP("\t%s\n", secstrings + s->sh_name); | 1679 | DEBUGP("\t%s\n", secstrings + s->sh_name); |
@@ -1691,8 +1690,7 @@ static void layout_sections(struct module *mod, | |||
1691 | if ((s->sh_flags & masks[m][0]) != masks[m][0] | 1690 | if ((s->sh_flags & masks[m][0]) != masks[m][0] |
1692 | || (s->sh_flags & masks[m][1]) | 1691 | || (s->sh_flags & masks[m][1]) |
1693 | || s->sh_entsize != ~0UL | 1692 | || s->sh_entsize != ~0UL |
1694 | || strncmp(secstrings + s->sh_name, | 1693 | || !strstarts(secstrings + s->sh_name, ".init")) |
1695 | ".init", 5) != 0) | ||
1696 | continue; | 1694 | continue; |
1697 | s->sh_entsize = (get_offset(mod, &mod->init_size, s, i) | 1695 | s->sh_entsize = (get_offset(mod, &mod->init_size, s, i) |
1698 | | INIT_OFFSET_MASK); | 1696 | | INIT_OFFSET_MASK); |
@@ -1825,8 +1823,7 @@ static char elf_type(const Elf_Sym *sym, | |||
1825 | else | 1823 | else |
1826 | return 'b'; | 1824 | return 'b'; |
1827 | } | 1825 | } |
1828 | if (strncmp(secstrings + sechdrs[sym->st_shndx].sh_name, | 1826 | if (strstarts(secstrings + sechdrs[sym->st_shndx].sh_name, ".debug")) |
1829 | ".debug", strlen(".debug")) == 0) | ||
1830 | return 'n'; | 1827 | return 'n'; |
1831 | return '?'; | 1828 | return '?'; |
1832 | } | 1829 | } |
@@ -1952,7 +1949,7 @@ static noinline struct module *load_module(void __user *umod, | |||
1952 | } | 1949 | } |
1953 | #ifndef CONFIG_MODULE_UNLOAD | 1950 | #ifndef CONFIG_MODULE_UNLOAD |
1954 | /* Don't load .exit sections */ | 1951 | /* Don't load .exit sections */ |
1955 | if (strncmp(secstrings+sechdrs[i].sh_name, ".exit", 5) == 0) | 1952 | if (strstarts(secstrings+sechdrs[i].sh_name, ".exit")) |
1956 | sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC; | 1953 | sechdrs[i].sh_flags &= ~(unsigned long)SHF_ALLOC; |
1957 | #endif | 1954 | #endif |
1958 | /* Don't keep __versions around; it's just for loading. */ | 1955 | /* Don't keep __versions around; it's just for loading. */ |