Commit acec7ca3 authored by Steven Whitehouse's avatar Steven Whitehouse Committed by David S. Miller

[FS]: Add seq_release_private and proc_net_fops_create helpers.

parent ebaabbc2
...@@ -338,3 +338,13 @@ int single_release(struct inode *inode, struct file *file) ...@@ -338,3 +338,13 @@ int single_release(struct inode *inode, struct file *file)
kfree(op); kfree(op);
return res; return res;
} }
int seq_release_private(struct inode *inode, struct file *file)
{
struct seq_file *seq = file->private_data;
kfree(seq->private);
seq->private = NULL;
return seq_release(inode, file);
}
...@@ -163,6 +163,15 @@ static inline struct proc_dir_entry *proc_net_create(const char *name, ...@@ -163,6 +163,15 @@ static inline struct proc_dir_entry *proc_net_create(const char *name,
return create_proc_info_entry(name,mode,proc_net,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, 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) static inline void proc_net_remove(const char *name)
{ {
remove_proc_entry(name,proc_net); remove_proc_entry(name,proc_net);
...@@ -171,7 +180,7 @@ static inline void proc_net_remove(const char *name) ...@@ -171,7 +180,7 @@ static inline void proc_net_remove(const char *name)
#else #else
#define proc_root_driver NULL #define proc_root_driver NULL
#define proc_net_fops_create(name,mode,fops) do {} while(0)
static inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode, static inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode,
get_info_t *get_info) {return NULL;} get_info_t *get_info) {return NULL;}
static inline void proc_net_remove(const char *name) {} static inline void proc_net_remove(const char *name) {}
......
...@@ -60,5 +60,6 @@ int seq_printf(struct seq_file *, const char *, ...) ...@@ -60,5 +60,6 @@ int seq_printf(struct seq_file *, const char *, ...)
int single_open(struct file *, int (*)(struct seq_file *, void *), void *); int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
int single_release(struct inode *, struct file *); int single_release(struct inode *, struct file *);
int seq_release_private(struct inode *, struct file *);
#endif #endif
#endif #endif
...@@ -540,6 +540,7 @@ EXPORT_SYMBOL(seq_read); ...@@ -540,6 +540,7 @@ EXPORT_SYMBOL(seq_read);
EXPORT_SYMBOL(seq_lseek); EXPORT_SYMBOL(seq_lseek);
EXPORT_SYMBOL(single_open); EXPORT_SYMBOL(single_open);
EXPORT_SYMBOL(single_release); EXPORT_SYMBOL(single_release);
EXPORT_SYMBOL(seq_release_private);
/* Program loader interfaces */ /* Program loader interfaces */
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment