proc: Add proc_mkdir_data()
Add proc_mkdir_data() to allow procfs directories to be created that are annotated at the time of creation with private data rather than doing this post-creation. This means no access is then required to the proc_dir_entry struct to set this. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: Neela Syam Kolli <megaraidlinux@lsi.com> cc: Jerry Chuang <jerry-chuang@realtek.com> cc: linux-scsi@vger.kernel.org cc: devel@driverdev.osuosl.org cc: linux-wireless@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
34db8aaf0f
commit
270b5ac215
6 changed files with 30 additions and 35 deletions
|
@ -73,6 +73,8 @@ extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
|
|||
extern struct proc_dir_entry *proc_symlink(const char *,
|
||||
struct proc_dir_entry *, const char *);
|
||||
extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
|
||||
extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
|
||||
struct proc_dir_entry *, void *);
|
||||
extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
|
||||
struct proc_dir_entry *parent);
|
||||
|
||||
|
@ -82,9 +84,6 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
|
|||
return proc_create_data(name, mode, parent, proc_fops, NULL);
|
||||
}
|
||||
|
||||
extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
|
||||
struct proc_dir_entry *parent);
|
||||
|
||||
extern void proc_set_size(struct proc_dir_entry *, loff_t);
|
||||
extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
|
||||
#else
|
||||
|
@ -108,6 +107,8 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
|
|||
struct proc_dir_entry *parent,const char *dest) {return NULL;}
|
||||
static inline struct proc_dir_entry *proc_mkdir(const char *name,
|
||||
struct proc_dir_entry *parent) {return NULL;}
|
||||
static inline struct proc_dir_entry *proc_mkdir_data(const char *name,
|
||||
umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }
|
||||
static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
|
||||
umode_t mode, struct proc_dir_entry *parent) { return NULL; }
|
||||
static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {}
|
||||
|
@ -153,4 +154,10 @@ static inline void *PDE_DATA(const struct inode *inode)
|
|||
return PROC_I(inode)->pde->data;
|
||||
}
|
||||
|
||||
static inline struct proc_dir_entry *proc_net_mkdir(
|
||||
struct net *net, const char *name, struct proc_dir_entry *parent)
|
||||
{
|
||||
return proc_mkdir_data(name, 0, parent, net);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_PROC_FS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue