Lines Matching full:net
3 * linux/fs/proc/net.c
9 * proc net directory handling functions
24 #include <net/net_namespace.h>
29 static inline struct net *PDE_NET(struct proc_dir_entry *pde) in PDE_NET()
34 static struct net *get_proc_net(const struct inode *inode) in get_proc_net()
43 struct net *net; in seq_open_net() local
50 net = get_proc_net(inode); in seq_open_net()
51 if (!net) in seq_open_net()
56 put_net(net); in seq_open_net()
60 p->net = net; in seq_open_net()
61 netns_tracker_alloc(net, &p->ns_tracker, GFP_KERNEL); in seq_open_net()
71 put_net_track(priv->net, &priv->ns_tracker); in seq_file_net_put_net()
99 p->net = get_net_track(current->nsproxy->net_ns, &p->ns_tracker, in bpf_iter_init_seq_net()
110 put_net_track(p->net, &p->ns_tracker); in bpf_iter_fini_seq_net()
180 struct net *net; in single_open_net() local
183 net = get_proc_net(inode); in single_open_net()
184 if (!net) in single_open_net()
187 err = single_open(file, de->single_show, net); in single_open_net()
189 put_net(net); in single_open_net()
268 static struct net *get_proc_task_net(struct inode *dir) in get_proc_task_net()
272 struct net *net = NULL; in get_proc_task_net() local
280 net = get_net(ns->net_ns); in get_proc_task_net()
285 return net; in get_proc_task_net()
292 struct net *net; in proc_tgid_net_lookup() local
295 net = get_proc_task_net(dir); in proc_tgid_net_lookup()
296 if (net != NULL) { in proc_tgid_net_lookup()
297 de = proc_lookup_de(dir, dentry, net->proc_net); in proc_tgid_net_lookup()
298 put_net(net); in proc_tgid_net_lookup()
308 struct net *net; in proc_tgid_net_getattr() local
310 net = get_proc_task_net(inode); in proc_tgid_net_getattr()
314 if (net != NULL) { in proc_tgid_net_getattr()
315 stat->nlink = net->proc_net->nlink; in proc_tgid_net_getattr()
316 put_net(net); in proc_tgid_net_getattr()
331 struct net *net; in proc_tgid_net_readdir() local
334 net = get_proc_task_net(file_inode(file)); in proc_tgid_net_readdir()
335 if (net != NULL) { in proc_tgid_net_readdir()
336 ret = proc_readdir_de(file, ctx, net->proc_net); in proc_tgid_net_readdir()
337 put_net(net); in proc_tgid_net_readdir()
348 static __net_init int proc_net_ns_init(struct net *net) in proc_net_ns_init() argument
356 * This PDE acts only as an anchor for /proc/${pid}/net hierarchy. in proc_net_ns_init()
357 * Corresponding inode (PDE(inode) == net->proc_net) is never in proc_net_ns_init()
359 * net->proc_net_stat inode is instantiated normally. in proc_net_ns_init()
367 netd->data = net; in proc_net_ns_init()
372 memcpy(netd->name, "net", 4); in proc_net_ns_init()
374 uid = make_kuid(net->user_ns, 0); in proc_net_ns_init()
378 gid = make_kgid(net->user_ns, 0); in proc_net_ns_init()
384 /* Seed dentry revalidation for /proc/${pid}/net */ in proc_net_ns_init()
388 net_statd = proc_net_mkdir(net, "stat", netd); in proc_net_ns_init()
392 net->proc_net = netd; in proc_net_ns_init()
393 net->proc_net_stat = net_statd; in proc_net_ns_init()
402 static __net_exit void proc_net_ns_exit(struct net *net) in proc_net_ns_exit() argument
404 remove_proc_entry("stat", net->proc_net); in proc_net_ns_exit()
405 pde_free(net->proc_net); in proc_net_ns_exit()
415 proc_symlink("net", NULL, "self/net"); in proc_net_init()