patch-2.3.18 linux/include/linux/proc_fs.h

Next file: linux/include/linux/sched.h
Previous file: linux/include/linux/pci.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.17/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
@@ -55,7 +55,8 @@
 	PROC_SOUND,
 	PROC_MTRR, /* whether enabled or not */
 	PROC_FS,
-	PROC_SYSVIPC
+	PROC_SYSVIPC,
+	PROC_DRIVER,
 };
 
 enum pid_directory_inos {
@@ -330,6 +331,7 @@
 extern struct proc_dir_entry proc_mca;
 extern struct proc_dir_entry *proc_bus;
 extern struct proc_dir_entry *proc_sysvipc;
+extern struct proc_dir_entry proc_root_driver;
 
 extern struct inode_operations proc_scsi_inode_operations;
 
@@ -339,6 +341,19 @@
 extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *);
 extern int proc_unregister(struct proc_dir_entry *, int);
 
+/*
+ * generic.c
+ */
+extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
+					        struct proc_dir_entry *parent);
+extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
+
+
+
+/*
+ * inlined /proc helper functions
+ */
+
 static inline int proc_net_register(struct proc_dir_entry * x)
 {
 	return proc_register(proc_net, x);
@@ -381,6 +396,50 @@
     }
 }
 
+
+/*
+ * retrieve the proc_dir_entry associated with /proc/driver/$module_name
+ */
+extern inline
+struct proc_dir_entry *proc_driver_find (const char *module_name)
+{
+        struct proc_dir_entry *p;
+        
+        p = proc_root_driver.subdir;
+        while (p != NULL) {
+                if (strcmp (p->name, module_name) == 0)
+                        return p;
+                
+                p = p->next;
+        }
+        return NULL;
+}
+
+
+/*
+ * remove /proc/driver/$module_name, and all its contents
+ */
+extern inline int proc_driver_unregister(const char *module_name)
+{
+        remove_proc_entry (module_name, &proc_root_driver);
+        return 0;
+}
+
+
+/*
+ * create driver-specific playground directory, /proc/driver/$module_name
+ */
+extern inline int proc_driver_register(const char *module_name)
+{
+        struct proc_dir_entry *p;
+
+        p = create_proc_entry (module_name, S_IFDIR, &proc_root_driver);
+
+        return (p == NULL) ? -1 : 0;
+}
+
+
+
 extern struct super_block *proc_super_blocks;
 extern struct dentry_operations proc_dentry_operations;
 extern struct super_block *proc_read_super(struct super_block *,void *,int);
@@ -443,13 +502,6 @@
 extern struct inode_operations proc_sysvipc_inode_operations;
 
 /*
- * generic.c
- */
-struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
-					 struct proc_dir_entry *parent);
-void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
-
-/*
  * proc_tty.c
  */
 extern void proc_tty_init(void);
@@ -481,6 +533,23 @@
 extern inline void proc_tty_register_driver(struct tty_driver *driver) {};
 extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
 
+extern inline
+struct proc_dir_entry *proc_driver_find (const char *module_name)
+{
+        return NULL;
+}
+
+extern inline int proc_driver_unregister(const char *module_name)
+{
+        return 0;
+}
+
+extern inline int proc_driver_register(const char *module_name)
+{
+        return 0;
+}
+
+
+#endif /* CONFIG_PROC_FS */
 
-#endif
 #endif /* _LINUX_PROC_FS_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)