Skip to contentSkip to conversation

inter_module_* backport to 2.2.18

PATCH New Chip Salzenberg 1 participant 1 message Feb 12, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 inter_module_* backport to 2.2.18

The inter_module_* feature of 2.4 is neat ... so neat that tpctl-2.0 actually requires it. I figured it would be easier to backport the feature rather than to make tpctl get along without it. The backport was quite clean. Perhaps you'll want to include it in 2.2.19....

Index: include/linux/module.h

linux/module.h +35 -0
@@ -9,4 +9,5 @@
 
 #include <linux/config.h>
+#include <linux/list.h>
 
 #ifdef __GENKSYMS__
@@ -148,4 +149,38 @@ static inline unsigned long get_module_s
 extern unsigned long get_module_symbol(char *, char *);
 #endif
+
+/* Generic inter module communication.
+ *
+ * NOTE: This interface is intended for small amounts of data that are
+ *       passed between two objects and either or both of the objects
+ *       might be compiled as modules.  Do not over use this interface.
+ *
+ *       If more than two objects need to communicate then you probably
+ *       need a specific interface instead of abusing this generic
+ *       interface.  If both objects are *always* built into the kernel
+ *       then a global extern variable is good enough, you do not need
+ *       this interface.
+ *
+ * Keith Owens <[email protected]> 28 Oct 2000.
+ */
+
+#ifdef __KERNEL__
+#define HAVE_INTER_MODULE
+extern void inter_module_register(const char *, struct module *, const void *);
+extern void inter_module_unregister(const char *);
+extern const void *inter_module_get(const char *);
+extern const void *inter_module_get_request(const char *, const char *);
+extern void inter_module_put(const char *);
+
+struct inter_module_entry {
+	struct list_head list;
+	const char *im_name;
+	struct module *owner;
+	const void *userdata;
+};
+
+extern int try_inc_mod_count(struct module *mod);
+#endif /* __KERNEL__ */
+
 #if defined(MODULE) && !defined(__GENKSYMS__)
 

Index: kernel/ksyms.c

ksyms.c +7 -0
@@ -94,4 +94,11 @@ EXPORT_SYMBOL(get_module_symbol);
 EXPORT_SYMBOL(get_options);
 
+EXPORT_SYMBOL(inter_module_register);
+EXPORT_SYMBOL(inter_module_unregister);
+EXPORT_SYMBOL(inter_module_get);
+EXPORT_SYMBOL(inter_module_get_request);
+EXPORT_SYMBOL(inter_module_put);
+EXPORT_SYMBOL(try_inc_mod_count);
+
 /* process memory management */
 EXPORT_SYMBOL(do_mmap);

Index: kernel/module.c

module.c +190 -0

209 lines not on this page · raw message

Signature · 6 lines
Chip Salzenberg            - a.k.a. -            <[email protected]>
   "Give me immortality, or give me death!"  // Firesign Theatre
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/