]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/proc_fs.h
r8169: make room for more phy init changes
[linux-2.6-omap-h63xx.git] / include / linux / proc_fs.h
index 3469f96bc8b2d0e11543d57246f4c4ae75f64115..20741f668f7bebbba1cd018a07bab5810ae93428 100644 (file)
@@ -7,6 +7,9 @@
 #include <linux/magic.h>
 #include <asm/atomic.h>
 
+struct net;
+struct completion;
+
 /*
  * The proc filesystem constants/structures
  */
@@ -56,6 +59,14 @@ struct proc_dir_entry {
        gid_t gid;
        loff_t size;
        const struct inode_operations *proc_iops;
+       /*
+        * NULL ->proc_fops means "PDE is going away RSN" or
+        * "PDE is just created". In either case, e.g. ->read_proc won't be
+        * called because it's too late or too early, respectively.
+        *
+        * If you're allocating ->proc_fops dynamically, save a pointer
+        * somewhere.
+        */
        const struct file_operations *proc_fops;
        get_info_t *get_info;
        struct module *owner;
@@ -65,7 +76,9 @@ struct proc_dir_entry {
        write_proc_t *write_proc;
        atomic_t count;         /* use count */
        int deleted;            /* delete flag */
-       void *set;
+       int pde_users;  /* number of callers into module in progress */
+       spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
+       struct completion *pde_unload_completion;
 };
 
 struct kcore_list {
@@ -85,8 +98,6 @@ struct vmcore {
 
 extern struct proc_dir_entry proc_root;
 extern struct proc_dir_entry *proc_root_fs;
-extern struct proc_dir_entry *proc_net;
-extern struct proc_dir_entry *proc_net_stat;
 extern struct proc_dir_entry *proc_bus;
 extern struct proc_dir_entry *proc_root_driver;
 extern struct proc_dir_entry *proc_root_kcore;
@@ -180,36 +191,21 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
        if (res) res->get_info=get_info;
        return res;
 }
-static inline struct proc_dir_entry *proc_net_create(const char *name,
-       mode_t mode, get_info_t *get_info)
-{
-       return create_proc_info_entry(name,mode,proc_net,get_info);
-}
-
-static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
-       mode_t mode, const struct file_operations *fops)
-{
-       struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
-       if (res)
-               res->proc_fops = fops;
-       return res;
-}
 
-static inline void proc_net_remove(const char *name)
-{
-       remove_proc_entry(name,proc_net);
-}
+extern struct proc_dir_entry *proc_net_create(struct net *net,
+       const char *name, mode_t mode, get_info_t *get_info);
+extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
+       const char *name, mode_t mode, const struct file_operations *fops);
+extern void proc_net_remove(struct net *net, const char *name);
 
 #else
 
 #define proc_root_driver NULL
-#define proc_net NULL
 #define proc_bus NULL
 
-#define proc_net_fops_create(name, mode, fops)  ({ (void)(mode), NULL; })
-#define proc_net_create(name, mode, info)      ({ (void)(mode), NULL; })
-static inline void proc_net_remove(const char *name) {}
+#define proc_net_fops_create(net, name, mode, fops)  ({ (void)(mode), NULL; })
+#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
+static inline void proc_net_remove(struct net *net, const char *name) {}
 
 static inline void proc_flush_task(struct task_struct *task) { }
 
@@ -269,6 +265,13 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
        return PROC_I(inode)->pde;
 }
 
+static inline struct net *PDE_NET(struct proc_dir_entry *pde)
+{
+       return pde->parent->data;
+}
+
+struct net *get_proc_net(const struct inode *inode);
+
 struct proc_maps_private {
        struct pid *pid;
        struct task_struct *task;