Block devices subtree

Overview

// global functions

te_errno tapi_cfg_block_initialize_loop(const char* ta);
te_errno tapi_cfg_block_grab(const char* ta, const char* block_dev);
bool tapi_cfg_block_is_loop(const char* ta, const char* block_dev);
te_errno tapi_cfg_block_loop_get_backing_file(const char* ta, const char* block_dev, char** filename);
te_errno tapi_cfg_block_loop_set_backing_file(const char* ta, const char* block_dev, const char* filename);

Detailed Documentation

Global Functions

te_errno tapi_cfg_block_initialize_loop(const char* ta)

Initialize loop block devices subsystem on the agent ta. In particular, it implies loading the required kernel modules.

Parameters:

ta

agent name

Returns:

status code

te_errno tapi_cfg_block_grab(const char* ta, const char* block_dev)

Grab a block device as a resource.

Parameters:

ta

agent name

block_dev

block device name

Returns:

status code

bool tapi_cfg_block_is_loop(const char* ta, const char* block_dev)

Check whether a block device is a loop device.

Parameters:

ta

Agent name

block_dev

Block device name

Returns:

true iff block_dev refers to a loop block device on ta

te_errno tapi_cfg_block_loop_get_backing_file(const char* ta, const char* block_dev, char** filename)

Get the name of a backing file for a loop device block_dev.

If there is no backing file, the value will be NULL.

Parameters:

ta

agent name

block_dev

block device name

filename

the name of the backing file or NULL (must be free()’d)

Returns:

status code

te_errno tapi_cfg_block_loop_set_backing_file(const char* ta, const char* block_dev, const char* filename)

Set the name of a backing file for a loop device block_dev.

If the name is NULL or empty, the loop device is detached from any backing file.

Parameters:

ta

agent name

block_dev

block device name

filename

the name of the backing file (may be NULL)

Returns:

status code