dev_alloc

Name

dev_alloc --  allocate a network device and name

Synopsis

struct net_device * dev_alloc (const char * name, int * err);

Arguments

name

name format string

err

error return pointer

Description

Passed a format string, eg. "ltd", it will allocate a network device and space for the name. NULL is returned if no memory is available. If the allocation succeeds then the name is assigned and the device pointer returned. NULL is returned if the name allocation failed. The cause of an error is returned as a negative errno code in the variable err points to.

The caller must hold the dev_base or RTNL locks when doing this in order to avoid duplicate name allocations.