take struct ns_common *, for now simply wrappers around proc_{alloc,free}_inum()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
static void free_mnt_ns(struct mnt_namespace *ns)
{
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
put_user_ns(ns->user_ns);
kfree(ns);
}
new_ns = kmalloc(sizeof(struct mnt_namespace), GFP_KERNEL);
if (!new_ns)
return ERR_PTR(-ENOMEM);
- ret = proc_alloc_inum(&new_ns->ns.inum);
+ ret = ns_alloc_inum(&new_ns->ns);
if (ret) {
kfree(new_ns);
return ERR_PTR(ret);
#endif /* CONFIG_PROC_FS */
+#define ns_alloc_inum(ns) proc_alloc_inum(&(ns)->inum)
+#define ns_free_inum(ns) proc_free_inum((ns)->inum)
+
#endif /* _LINUX_PROC_NS_H */
if (ns == NULL)
return ERR_PTR(-ENOMEM);
- err = proc_alloc_inum(&ns->ns.inum);
+ err = ns_alloc_inum(&ns->ns);
if (err) {
kfree(ns);
return ERR_PTR(err);
atomic_set(&ns->count, 1);
err = mq_init_ns(ns);
if (err) {
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
kfree(ns);
return ERR_PTR(err);
}
*/
ipcns_notify(IPCNS_REMOVED);
put_user_ns(ns->user_ns);
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
kfree(ns);
}
if (ns->pid_cachep == NULL)
goto out_free_map;
- err = proc_alloc_inum(&ns->ns.inum);
+ err = ns_alloc_inum(&ns->ns);
if (err)
goto out_free_map;
{
int i;
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
for (i = 0; i < PIDMAP_ENTRIES; i++)
kfree(ns->pidmap[i].page);
put_user_ns(ns->user_ns);
if (!ns)
return -ENOMEM;
- ret = proc_alloc_inum(&ns->ns.inum);
+ ret = ns_alloc_inum(&ns->ns);
if (ret) {
kmem_cache_free(user_ns_cachep, ns);
return ret;
#ifdef CONFIG_PERSISTENT_KEYRINGS
key_put(ns->persistent_keyring_register);
#endif
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
kmem_cache_free(user_ns_cachep, ns);
ns = parent;
} while (atomic_dec_and_test(&parent->count));
if (!ns)
return ERR_PTR(-ENOMEM);
- err = proc_alloc_inum(&ns->ns.inum);
+ err = ns_alloc_inum(&ns->ns);
if (err) {
kfree(ns);
return ERR_PTR(err);
ns = container_of(kref, struct uts_namespace, kref);
put_user_ns(ns->user_ns);
- proc_free_inum(ns->ns.inum);
+ ns_free_inum(&ns->ns);
kfree(ns);
}
static __net_init int net_ns_net_init(struct net *net)
{
- return proc_alloc_inum(&net->ns.inum);
+ return ns_alloc_inum(&net->ns);
}
static __net_exit void net_ns_net_exit(struct net *net)
{
- proc_free_inum(net->ns.inum);
+ ns_free_inum(&net->ns);
}
static struct pernet_operations __net_initdata net_ns_ops = {