---
name: "dev_alloc_name"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/dev_alloc_name"
---

# dev\_alloc\_name(9)

allocate a name for a device

## NAME

dev\_alloc\_name - allocate a name for a device

## SYNOPSIS

**int dev\_alloc\_name(struct net\_device \*** *dev***, const char \*** *name***);**

## ARGUMENTS

*dev*

device

*name*

name format string

## DESCRIPTION

Passed a format string - eg “lt**d**” it will try and find a suitable id. It scans list of devices to build up a free map, then chooses the first empty slot. The caller must hold the dev\_base or rtnl lock while allocating the name and adding the device in order to avoid duplicates. Limited to bits\_per\_byte \* page size devices (ie 32K on most platforms). Returns the number of the unit assigned or a negative errno code.

## COPYRIGHT
