The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after ark-5.14 ------> commit 9cfcd841fd72ac62d601c96151091c12f60f7009 Author: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com> Date: Fri Sep 24 15:48:53 2021 +0300
proc/net: proc_net_*() helpers introduced Will be used to make per-net sysfs files visible in CT. Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com> Rebase to RHEL8 beta kernel notes: more helpers added: proc_net_{seq*,single*,net*} TODO: rename helpers - proc_net_create_net() does not look good. Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com> (cherry picked from vz8 commit 22bdd5751b471489c5c71127abf63933c3d1dd2b) Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- include/linux/proc_fs.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 069c7fd95396..e89d4bfc48a0 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -206,9 +206,67 @@ struct net; static inline struct proc_dir_entry *proc_net_mkdir( struct net *net, const char *name, struct proc_dir_entry *parent) { - return _proc_mkdir(name, 0, parent, net, true); + return _proc_mkdir(name, S_IRUGO | S_IXUGO | S_ISVTX, parent, net, true); } +static inline struct proc_dir_entry *proc_net_create_data(const char *name, + umode_t mode, struct proc_dir_entry *parent, + const struct file_operations *fops, void *data) +{ + return proc_create_data(name, S_ISVTX | mode, parent, fops, data); +} + +static inline struct proc_dir_entry *proc_net_create(const char *name, + umode_t mode, struct proc_dir_entry *parent, + const struct file_operations *fops) +{ + return proc_net_create_data(name, mode, parent, fops, NULL); +} + +static inline struct proc_dir_entry *proc_net_create_seq_private( + const char *name, umode_t mode, + struct proc_dir_entry *parent, const struct seq_operations *ops, + unsigned int state_size, void *data) +{ + return proc_create_seq_private(name, S_ISVTX | mode, parent, ops, + state_size, data); +} +#define proc_net_create_seq_data(name, mode, parent, ops, data) \ + proc_net_create_seq_private(name, mode, parent, ops, 0, data) +#define proc_net_create_seq(name, mode, parent, ops) \ + proc_net_create_seq_private(name, mode, parent, ops, 0, NULL) + +static inline struct proc_dir_entry *proc_net_create_net_data( + const char *name, umode_t mode, + struct proc_dir_entry *parent, const struct seq_operations *ops, + unsigned int state_size, void *data) +{ + return proc_create_net_data(name, S_ISVTX | mode, parent, + ops, state_size, data); +} +#define proc_net_create_net(name, mode, parent, state_size, ops) \ + proc_net_create_net_data(name, mode, parent, state_size, ops, NULL) + +static inline struct proc_dir_entry *proc_net_create_net_single( + const char *name, umode_t mode, + struct proc_dir_entry *parent, + int (*show)(struct seq_file *, void *), void *data) +{ + return proc_create_net_single(name, S_ISVTX | mode, parent, + show, data); +} + +static inline struct proc_dir_entry *proc_net_create_single_data( + const char *name, umode_t mode, + struct proc_dir_entry *parent, + int (*show)(struct seq_file *, void *), void *data) +{ + return proc_create_single_data(name, S_ISVTX | mode, parent, + show, data); +} +#define proc_net_create_single(name, mode, parent, show) \ + proc_net_create_single_data(name, mode, parent, show, NULL) + struct ns_common; int open_related_ns(struct ns_common *ns, struct ns_common *(*get_ns)(struct ns_common *ns)); _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel