Skip to contentSkip to conversation

Export new char dev functions

PATCH In review Jonathan Corbet 5 participants 10 messages Sep 16, 2003 – Sep 17, 2003 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Export new char dev functions

Nobody told me that the failure to export these (like their block counterparts) was anything but an oversight; modules will not be able to use larger device numbers without them. So...this patch exports the new char device functions.

jon

Jonathan Corbet
Executive editor, LWN.net
[email protected]

kernel/ksyms.c +11 -0
@@ -42,6 +42,7 @@
 #include <linux/highuid.h>
 #include <linux/fs.h>
 #include <linux/fs_struct.h>
+#include <linux/cdev.h>
 #include <linux/uio.h>
 #include <linux/tty.h>
 #include <linux/in6.h>
@@ -355,6 +356,16 @@
 EXPORT_SYMBOL(tty_register_driver);
 EXPORT_SYMBOL(tty_unregister_driver);
 EXPORT_SYMBOL(tty_std_termios);
+EXPORT_SYMBOL(register_chrdev_region);
+EXPORT_SYMBOL(unregister_chrdev_region);
+EXPORT_SYMBOL(alloc_chrdev_region);
+EXPORT_SYMBOL(cdev_init);
+EXPORT_SYMBOL(cdev_alloc);
+EXPORT_SYMBOL(cdev_get);
+EXPORT_SYMBOL(cdev_put);
+EXPORT_SYMBOL(cdev_del);
+EXPORT_SYMBOL(cdev_add);
+EXPORT_SYMBOL(cdev_unmap);
 
 /* block device driver support */
 EXPORT_SYMBOL(bmap);
#1 lore raw
Quoted 4 lines · Jonathan Corbet

Nobody told me that the failure to export these (like their block counterparts) was anything but an oversight; modules will not be able to use larger device numbers without them. So...this patch exports the new char device functions.

How about just exporting them in the files where they are declared? I do not think we want the ksyms.c file to grow anymore.

thanks,

greg k-h

#2 lore raw
Quoted 2 lines

How about just exporting them in the files where they are declared? I do not think we want the ksyms.c file to grow anymore.

Hmm, I figured somebody would say something like that...grumble...mutter... ...complain...gripe...moan...new patch appended...

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

jon

Jonathan Corbet
Executive editor, LWN.net
[email protected]

fs/char_dev.c +13 -0
@@ -445,3 +445,16 @@
 	kset_register(&kset_dynamic);
 	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
 }
+
+
+/* Let modules do char dev stuff */
+EXPORT_SYMBOL(register_chrdev_region);
+EXPORT_SYMBOL(unregister_chrdev_region);
+EXPORT_SYMBOL(alloc_chrdev_region);
+EXPORT_SYMBOL(cdev_init);
+EXPORT_SYMBOL(cdev_alloc);
+EXPORT_SYMBOL(cdev_get);
+EXPORT_SYMBOL(cdev_put);
+EXPORT_SYMBOL(cdev_del);
+EXPORT_SYMBOL(cdev_add);
+EXPORT_SYMBOL(cdev_unmap);
#3 lore raw

Em Tue, Sep 16, 2003 at 08:36:30PM -0600, Jonathan Corbet escreveu:

Quoted 8 lines
Quoted 2 lines

How about just exporting them in the files where they are declared? I do not think we want the ksyms.c file to grow anymore.

Hmm, I figured somebody would say something like that...grumble...mutter... ...complain...gripe...moan...new patch appended...

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

Linus call, perhaps, but I for one would love to see it just die, having it in the files that actually implement the functions exported is IMHO more maintainer friendly, not that ksyms.c is that much touched but...

- Arnaldo

#4 lore raw
In reply to Jonathan Corbet
Quoted 2 lines · Jonathan Corbet

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

I think we are, yes. ksyms.c just makes life harder.

regards
john

Signature · 2 lines
Khendon's Law:
If the same point is made twice by the same person, the thread is over.
#5 lore raw
Quoted 5 lines

John Levon sez:

Quoted 2 lines

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

I think we are, yes. ksyms.c just makes life harder.

OK, here is a version that evacutates all of fs/char_dev.c's functions out of ksyms.c. And that, probably, is about all the bandwidth this little patch is worth...

jon

fs/char_dev.c +15 -0
diff -urN -X dontdiff test5-vanilla/fs/char_dev.c test5/fs/char_dev.c
@@ -445,3 +445,18 @@
 	kset_register(&kset_dynamic);
 	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
 }
+
+
+/* Let modules do char dev stuff */
+EXPORT_SYMBOL(register_chrdev_region);
+EXPORT_SYMBOL(unregister_chrdev_region);
+EXPORT_SYMBOL(alloc_chrdev_region);
+EXPORT_SYMBOL(cdev_init);
+EXPORT_SYMBOL(cdev_alloc);
+EXPORT_SYMBOL(cdev_get);
+EXPORT_SYMBOL(cdev_put);
+EXPORT_SYMBOL(cdev_del);
+EXPORT_SYMBOL(cdev_add);
+EXPORT_SYMBOL(cdev_unmap);
+EXPORT_SYMBOL(register_chrdev);
+EXPORT_SYMBOL(unregister_chrdev);
kernel/ksyms.c +0 -2
diff -urN -X dontdiff test5-vanilla/kernel/ksyms.c test5/kernel/ksyms.c
@@ -348,8 +348,6 @@
 EXPORT_SYMBOL(unlock_page);
 
 /* device registration */
-EXPORT_SYMBOL(register_chrdev);
-EXPORT_SYMBOL(unregister_chrdev);
 EXPORT_SYMBOL(register_blkdev);
 EXPORT_SYMBOL(unregister_blkdev);
 EXPORT_SYMBOL(tty_register_driver);
#6 lore raw

fs/char_dev.c

Quoted 15 lines · Jonathan Corbet
Quoted 5 lines

John Levon sez:

Quoted 2 lines

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

I think we are, yes. ksyms.c just makes life harder.

OK, here is a version that evacutates all of fs/char_dev.c's functions out of ksyms.c. And that, probably, is about all the bandwidth this little patch is worth...

jon

diff -urN -X dontdiff test5-vanilla/fs/char_dev.c test5/fs/char_dev.c

fs/char_dev.c +0 -0

Need to modify export-objs line in fs/Makefile too.

Jeff

#7 lore raw
Quoted 1 line

Need to modify export-objs line in fs/Makefile too.

I do? In 2.5?? I thought that was old, obsolete stuff?

I sure don't find any export-objs lines in -test5...

jon

#8 lore raw
Quoted 5 lines · Jonathan Corbet
Quoted 1 line

Need to modify export-objs line in fs/Makefile too.

I do? In 2.5?? I thought that was old, obsolete stuff?

I sure don't find any export-objs lines in -test5...

Nope, you're correct. I was looking at 2.4...

Jeff

#9 lore raw
In reply to Jonathan Corbet
Quoted 8 lines · Jonathan Corbet
Quoted 2 lines

How about just exporting them in the files where they are declared? I do not think we want the ksyms.c file to grow anymore.

Hmm, I figured somebody would say something like that...grumble...mutter... ...complain...gripe...moan...new patch appended...

Of course, there are other exports from that file (i.e. register_chrdev()); are we actively trying to shrink ksyms.c?

I just think we aren't trying to grow it at this time :)

thanks,

greg k-h