Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
net_namespace.c File Reference
#include <linux/workqueue.h>
#include <linux/rtnetlink.h>
#include <linux/cache.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/idr.h>
#include <linux/rculist.h>
#include <linux/nsproxy.h>
#include <linux/proc_fs.h>
#include <linux/file.h>
#include <linux/export.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define INITIAL_NET_GEN_PTRS   13 /* +1 for len +2 for rcu_head */
 

Functions

 LIST_HEAD (net_namespace_list)
 
 EXPORT_SYMBOL_GPL (net_namespace_list)
 
 EXPORT_SYMBOL (init_net)
 
struct netcopy_net_ns (unsigned long flags, struct net *old_net)
 
struct netget_net_ns_by_fd (int fd)
 
struct netget_net_ns_by_pid (pid_t pid)
 
 EXPORT_SYMBOL_GPL (get_net_ns_by_pid)
 
 pure_initcall (net_ns_init)
 
int register_pernet_subsys (struct pernet_operations *ops)
 
 EXPORT_SYMBOL_GPL (register_pernet_subsys)
 
void unregister_pernet_subsys (struct pernet_operations *ops)
 
 EXPORT_SYMBOL_GPL (unregister_pernet_subsys)
 
int register_pernet_device (struct pernet_operations *ops)
 
 EXPORT_SYMBOL_GPL (register_pernet_device)
 
void unregister_pernet_device (struct pernet_operations *ops)
 
 EXPORT_SYMBOL_GPL (unregister_pernet_device)
 

Variables

struct net init_net
 

Macro Definition Documentation

#define INITIAL_NET_GEN_PTRS   13 /* +1 for len +2 for rcu_head */

Definition at line 35 of file net_namespace.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 1 of file net_namespace.c.

Function Documentation

struct net* copy_net_ns ( unsigned long  flags,
struct net old_net 
)
read

Definition at line 350 of file net_namespace.c.

EXPORT_SYMBOL ( init_net  )
EXPORT_SYMBOL_GPL ( net_namespace_list  )
EXPORT_SYMBOL_GPL ( get_net_ns_by_pid  )
EXPORT_SYMBOL_GPL ( register_pernet_subsys  )
EXPORT_SYMBOL_GPL ( unregister_pernet_subsys  )
EXPORT_SYMBOL_GPL ( register_pernet_device  )
EXPORT_SYMBOL_GPL ( unregister_pernet_device  )
struct net* get_net_ns_by_fd ( int  fd)
read

Definition at line 357 of file net_namespace.c.

struct net* get_net_ns_by_pid ( pid_t  pid)
read

Definition at line 363 of file net_namespace.c.

LIST_HEAD ( net_namespace_list  )
pure_initcall ( net_ns_init  )
int register_pernet_device ( struct pernet_operations ops)
register_pernet_device - register a network namespace device

: pernet operations structure for the subsystem

Register a device which has init and exit functions that are called when network namespaces are created and destroyed respectively.

When registered all network namespace init functions are called for every existing network namespace. Allowing kernel modules to have a race free view of the set of network namespaces.

When a new network namespace is created all of the init methods are called in the order in which they were registered.

When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered.

Definition at line 579 of file net_namespace.c.

int register_pernet_subsys ( struct pernet_operations ops)
register_pernet_subsys - register a network namespace subsystem

: pernet operations structure for the subsystem

Register a subsystem which has init and exit functions that are called when network namespaces are created and destroyed respectively.

When registered all network namespace init functions are called for every existing network namespace. Allowing kernel modules to have a race free view of the set of network namespaces.

When a new network namespace is created all of the init methods are called in the order in which they were registered.

When a network namespace is destroyed all of the exit methods are called in the reverse of the order with which they were registered.

Definition at line 533 of file net_namespace.c.

void unregister_pernet_device ( struct pernet_operations ops)
unregister_pernet_device - unregister a network namespace netdevice

: pernet operations structure to manipulate

Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces.

Definition at line 600 of file net_namespace.c.

void unregister_pernet_subsys ( struct pernet_operations ops)
unregister_pernet_subsys - unregister a network namespace subsystem

: pernet operations structure to manipulate

Remove the pernet operations structure from the list to be used when network namespaces are created or destroyed. In addition run the exit method for all existing network namespaces.

Definition at line 552 of file net_namespace.c.

Variable Documentation

struct net init_net
Initial value:
= {
.dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
}

Definition at line 30 of file net_namespace.c.