Corrected patch (was: [2.3.30-3] __{read,write}_lock_failed not exported)

Adam J. Richter (adam@yggdrasil.com)
Tue, 30 Nov 1999 22:18:50 -0800


Borislav Deianov <borislav@lix.polytechnique.fr> writes:
>Modules that use rw locks (like af_packet) need __read_lock_failed and
>__write_lock_failed to be exported. Something like this, I guess:
[snip.]

Thank you for developing that patch. I have made two changes to it.

Firstly, your patch does not work on a kernel built with module versioning.
it is necessary to use EXPORT_SYMBOL_NOVERS instead of EXPORT_SYMBOL to
make this symbol available, since it is a jump label with no matching
C prototype (although, I am keeping your declaration and use
of FASTCALL, on the assumption that perhaps it is possible
to call that snippet of code as a subroutine in the way that
prototype implies). Secondly, I have made the minor change of
grouping your extern declarations with other SMP-related extern
declarations in i386_ksyms.c, because that is the way the file is
organized. I have attached the patch below.

I have built a kernel with module versioning and it successfully loads
a module that uses __{read,write}_lock_failed (unix.o in this case).

Linus, I encourage you to apply this patch if you see nothing wrong with
it.

Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."

--- linux-2.3.30pre3/arch/i386/kernel/i386_ksyms.c Mon Nov 8 10:19:19 1999
+++ linux/arch/i386/kernel/i386_ksyms.c Tue Nov 30 22:08:44 1999
@@ -23,6 +23,11 @@
extern void dump_thread(struct pt_regs *, struct user *);
extern int dump_fpu(elf_fpregset_t *);

+#ifdef __SMP__
+extern void FASTCALL( __write_lock_failed(rwlock_t *rw));
+extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
+#endif
+
#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
extern struct drive_info_struct drive_info;
EXPORT_SYMBOL(drive_info);
@@ -92,6 +97,8 @@
EXPORT_SYMBOL(smp_num_cpus);
EXPORT_SYMBOL(cpu_present_map);
EXPORT_SYMBOL(cpu_online_map);
+EXPORT_SYMBOL_NOVERS(__write_lock_failed);
+EXPORT_SYMBOL_NOVERS(__read_lock_failed);

/* Global SMP irq stuff */
EXPORT_SYMBOL(synchronize_irq);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/