---
name: "allocate_resource"
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/allocate_resource"
---

# allocate\_resource(9)

allocate empty slot in the resource tree given range & alignment. The resource will be reallocated with a new size if it was already allocated

## NAME

allocate\_resource - allocate empty slot in the resource tree given range & alignment. The resource will be reallocated with a new size if it was already allocated

## SYNOPSIS

**int allocate\_resource(struct resource \*** *root***, struct resource \*** *new***, resource\_size\_t** *size***, resource\_size\_t** *min***, resource\_size\_t** *max***, resource\_size\_t** *align***, resource\_size\_t (\****alignf***) (void \*, const struct resource \*, resource\_size\_t, resource\_size\_t), void \*** *alignf\_data***);**

## ARGUMENTS

*root*

root resource descriptor

*new*

resource descriptor desired by caller

*size*

requested resource region size

*min*

minimum boundary to allocate

*max*

maximum boundary to allocate

*align*

alignment requested, in bytes

*alignf*

alignment function, optional, called if not NULL

*alignf\_data*

arbitrary data to pass to the *alignf* function

## COPYRIGHT
