Re: [PATCH] devfs v115 available

Tim Waugh (tim@cyberelk.demon.co.uk)
Sun, 18 Jul 1999 02:48:28 +0100 (GMT)


On Sun, 18 Jul 1999, Richard Gooch wrote:

> Send me a patch then ;-)

--- linux/drivers/char/ppdev.c~ Sun Jul 18 02:39:37 1999
+++ linux/drivers/char/ppdev.c Sun Jul 18 02:47:10 1999
@@ -36,6 +36,7 @@

#include <linux/module.h>
#include <linux/sched.h>
+#include <linux/devfs_fs_kernel.h>
#include <linux/ioctl.h>
#include <linux/parport.h>
#include <linux/ctype.h>
@@ -67,6 +68,9 @@
#define PP_BUFFER_SIZE 256
#define PARDEVICE_MAX 8

+#define DEVFS_PP_DIR "parports"
+static devfs_handle_t devfs_handle = NULL;
+
static inline void enable_irq (struct pp_struct *pp)
{
struct parport *port = pp->pdev->port;
@@ -542,12 +546,27 @@

int pp_init (void)
{
- if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
+ int i;
+
+ if (devfs_register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
PP_MAJOR);
return -EIO;
}

+ devfs_handle = devfs_mk_dir (DEVFS_PP_DIR, 0);
+ for (i = 0; i < PARPORT_MAX; i++) {
+ char name[16], old_name[16];
+ sprintf (name, DEVFS_PP_DIR "/%d", i);
+ sprintf (old_name, "parport%d", i);
+ devfs_register (name, 0, DEVFS_FL_NONE,
+ PP_MAJOR, i,
+ S_IFCHR | S_IRUGO | S_IWUGO, 0, 0,
+ &pp_fops, NULL);
+ devfs_mk_symlink (NULL, old_name, 0, DEVFS_FL_COMPAT,
+ name, 0, NULL);
+ }
+
printk (KERN_INFO PP_VERSION "\n");
return 0;
}
@@ -556,6 +575,7 @@
void cleanup_module (void)
{
/* Clean up all parport stuff */
- unregister_chrdev (PP_MAJOR, CHRDEV);
+ devfs_unregister_chrdev (PP_MAJOR, CHRDEV);
+ devfs_unregister (devfs_handle);
}
#endif /* MODULE */

-
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/