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

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

diff -u --recursive --new-file v1.3.27/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 #include <linux/fs.h>
+#include <linux/malloc.h>
 
 /*
  * The proc filesystem constants/structures
@@ -97,7 +98,7 @@
 	PROC_SCSI_AIC7XXX,
 	PROC_SCSI_BUSLOGIC,
 	PROC_SCSI_U14_34F,
-	PROC_SCSI_FUTURE_DOMAIN,
+	PROC_SCSI_FDOMAIN,
 	PROC_SCSI_GENERIC_NCR5380,
 	PROC_SCSI_IN2000,
 	PROC_SCSI_PAS16,
@@ -152,6 +153,8 @@
 extern struct proc_dir_entry proc_pid;
 extern struct proc_dir_entry proc_pid_fd;
 
+extern struct inode_operations proc_scsi_inode_operations;
+
 extern void proc_root_init(void);
 extern void proc_base_init(void);
 extern void proc_net_init(void);
@@ -167,6 +170,38 @@
 static inline int proc_net_unregister(int x)
 {
 	return proc_unregister(&proc_net, x);
+}
+
+static inline int proc_scsi_register(struct proc_dir_entry *driver, 
+				     struct proc_dir_entry *x)
+{
+    x->ops = &proc_scsi_inode_operations;
+    if(x->low_ino < PROC_SCSI_FILE){
+	return(proc_register(&proc_scsi, x));
+    }else{
+	return(proc_register(driver, x));
+    }
+}
+
+static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
+{
+    extern void scsi_init_free(char *ptr, unsigned int size);
+
+    if(x <= PROC_SCSI_FILE)
+	return(proc_unregister(&proc_scsi, x));
+    else {
+	struct proc_dir_entry **p = &driver->subdir, *dp;
+	int ret;
+
+	while ((dp = *p) != NULL) {
+		if (dp->low_ino == x) 
+		    break;
+		p = &dp->next;
+	}
+	ret = proc_unregister(driver, x);
+	scsi_init_free((char *) dp, sizeof(struct proc_dir_entry) + 4);
+	return(ret);
+    }
 }
 
 extern struct super_block *proc_read_super(struct super_block *,void *,int);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this