v850 obsolete params fix

v850 obsolete params fix

Post by Rusty Russel » Tue, 14 Jan 2003 05:50:11



Linus, please apply.  No variable arrays anywhere.

Rusty.

Name: Make obsolete module parameters work with MODULE_SYMBOL_PREFIX
Author: Rusty Russell, Miles Bader
Status: Trivial

D: Since these are just symbols in the module object, they need symbol name
D: munging to find the symbol from the parameter name.

diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5-bk/kernel/module.c working-2.5-bk-obsparm-symprefix/kernel/module.c
--- linux-2.5-bk/kernel/module.c        Fri Jan 10 10:55:43 2003

        if (!kp)
                return -ENOMEM;

-       DEBUGP("Module %s has %u obsolete params\n", name, num);
-       for (i = 0; i < num; i++)
-               DEBUGP("Param %i: %s type %s\n",
-                      num, obsparm[i].name, obsparm[i].type);
-
        for (i = 0; i < num; i++) {
+               char sym_name[128 + sizeof(MODULE_SYMBOL_PREFIX)];
+
+               snprintf(sym_name, sizeof(sym_name), "%s%s",
+                        MODULE_SYMBOL_PREFIX, obsparm[i].name);
+
                kp[i].name = obsparm[i].name;
                kp[i].perm = 000;
                kp[i].set = set_obsolete;
                kp[i].get = NULL;
                obsparm[i].addr
                        = (void *)find_local_symbol(sechdrs, symindex, strtab,
-                                                   obsparm[i].name);
+                                                   sym_name);
                if (!obsparm[i].addr) {
                        printk("%s: falsely claims to have parameter %s\n",
                               name, obsparm[i].name);

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. Make `obsolete params' work correctly if MODULE_SYMBOL_PRE


In principle, the idea of variable-length arrays should cause
the compiler to generate very reasonable code because the
length is only a value to subtract from ESP.

void foo(int len)
{
   char use[0x100];
   char bar[len];

In the case of 'use', the compiler subtracts (0x100 * sizeof(char))
from the current stack value and uses that as the location for 'use'.
In the case of 'bar' the compiler subtracts (len * sizeof(char))
from the current stack value and uses that as the location for 'bar'.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. 43 W95 and Linux Proxy - report 1

3. Make `obsolete params' work correctly if MODULE_SYMBOL_PREFIX is non-empty

4. Upgrading: RedHat vs. Debian

5. [v850] Include <linux/fs.h> in arch/v850/kernel/rte_cb_leds.c

6. I don't understand a linker warning about fp_realloc()

7. Block Yahoo! Messenger is possible?

8. [v850] Define __kernel_timer_t and __kernel_clockid_t on v850

9. [v850] Get rid of bogus definitions of `smp_...' barrier macros on the v850

10. [v850] Use <asm-generic/statsfs.h> on v850

11. [v850] Add leading underline to new linker-script symbols on the v850

12. [v850] Correct v850 support for RTE-NB85E-CB platform