Kernel modules configuration

Overview

Definition of API to configure kernel modules and their parameters. More…

// global functions

te_errno tapi_cfg_module_add(const char* ta_name, const char* mod_name, bool load);
te_errno tapi_cfg_module_load(const char* ta_name, const char* mod_name);
te_errno tapi_cfg_module_unload(const char* ta_name, const char* mod_name);
te_errno tapi_cfg_module_filename_set(const char* ta_name, const char* mod_name, const char* filename);
te_errno tapi_cfg_module_param_add(const char* ta_name, const char* mod_name, const char* param, const char* param_value);
te_errno tapi_cfg_module_int_param_add(const char* ta_name, const char* mod_name, const char* param, int param_value);
te_errno tapi_cfg_module_params_add(const char* ta_name, const char* mod_name, ...);
te_errno tapi_cfg_module_int_params_add(const char* ta_name, const char* mod_name, ...);
te_errno tapi_cfg_module_param_get(const char* ta_name, const char* mod_name, const char* param_name, char** param_value);
te_errno tapi_cfg_module_param_get_int(const char* ta_name, const char* mod_name, const char* param_name, int* param_value);
te_errno tapi_cfg_module_add_from_ta_dir(const char* ta_name, const char* module_name, bool load_dependencies);
te_errno tapi_cfg_module_add_from_ta_dir_or_fallback(const char* ta_name, const char* module_name, bool load_dependencies);
te_errno tapi_cfg_module_change_finish(const char* ta_name, const char* mod_name);
te_errno tapi_cfg_module_version_get(const char* ta_name, const char* module_name, char** version);
te_errno tapi_cfg_module_check_devices(const char* ta_name, const char* module_name, bool* all_grabbed);

Detailed Documentation

Definition of API to configure kernel modules and their parameters.

Copyright (C) 2004-2022 OKTET Labs Ltd. All rights reserved.

Global Functions

te_errno tapi_cfg_module_add(const char* ta_name, const char* mod_name, bool load)

Add module into the list of the agent modules. Load if asked. No error is returned if module is already added or loaded. Check it beforehand if needed.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

load

Load it (applicable only if no parameters are needed.)

Returns:

0 or error

te_errno tapi_cfg_module_load(const char* ta_name, const char* mod_name)

Load module with pre-configured parameters.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

Returns:

0 or error

te_errno tapi_cfg_module_unload(const char* ta_name, const char* mod_name)

Unload module with pre-configured parameters.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

Returns:

0 or error

te_errno tapi_cfg_module_filename_set(const char* ta_name, const char* mod_name, const char* filename)

Set filename of the module to be loaded

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

filename

Filesystem path

Returns:

0 or error

te_errno tapi_cfg_module_param_add(const char* ta_name, const char* mod_name, const char* param, const char* param_value)

Add module parameter with specified value.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

param

Name of the parameter

param_value

Value of the parameter

Returns:

0 or error

te_errno tapi_cfg_module_int_param_add(const char* ta_name, const char* mod_name, const char* param, int param_value)

Add module parameter with specified integer value. Convenient wrapper around tapi_cfg_module_param_add().

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

param

Name of the parameter

param_value

Value of the parameter

Returns:

0 or error

te_errno tapi_cfg_module_params_add(const char* ta_name, const char* mod_name, ...)

Add a number of string params that go in pairs terminated by NULL.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

Param name, param value, NULL list.

Returns:

0 or error

te_errno tapi_cfg_module_int_params_add(const char* ta_name, const char* mod_name, ...)

Add a number of int params that go in pairs terminated by NULL.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

Param name, param value (int), NULL list.

Returns:

0 or error

te_errno tapi_cfg_module_param_get(const char* ta_name, const char* mod_name, const char* param_name, char** param_value)

Get value of the module parameter (as string).

Parameters:

ta_name

Name of the agent

mod_name

Name of the kernel module

param_name

Name of the module parameter

param_value

Where to save pointer to string value of the parameter (to be released by the caller)

Returns:

Status code.

te_errno tapi_cfg_module_param_get_int(const char* ta_name, const char* mod_name, const char* param_name, int* param_value)

Get value of the module parameter (as integer number).

Parameters:

ta_name

Name of the agent

mod_name

Name of the kernel module

param_name

Name of the module parameter

param_value

Where to save parameter value

Returns:

Status code.

te_errno tapi_cfg_module_add_from_ta_dir(const char* ta_name, const char* module_name, bool load_dependencies)

Given a module file in a TA modules directory, insert the former. Take care of the module dependencies if required.

Parameters:

ta_name

The TA name

module_name

The filename without “.ko” extension

load_dependencies

Take care of dependencies

Status

code.

te_errno tapi_cfg_module_add_from_ta_dir_or_fallback(const char* ta_name, const char* module_name, bool load_dependencies)

Same as tapi_cfg_module_add_from_ta_dir(), but in case of a module file absence in a TA directory, module addition falls back on loading module shipped with the currently running kernel.

Parameters:

ta_name

The TA name

module_name

The filename without “.ko” extension

load_dependencies

Take care of dependencies

Status

code.

te_errno tapi_cfg_module_change_finish(const char* ta_name, const char* mod_name)

Finish changing a module. The resource is set to shared and other agents can access the module in shared mode. After this, module load/unload, parameters manipulation are prohibited.

Parameters:

ta_name

Name of the agent

mod_name

Name of the module

te_errno tapi_cfg_module_version_get(const char* ta_name, const char* module_name, char** version)

Get version of a module.

Parameters:

ta_name

Name of the agent

module_name

Name of the kernel module

version

Where to save pointer to the version string (memory should be released by the caller)

Returns:

Status code.

te_errno tapi_cfg_module_check_devices(const char* ta_name, const char* module_name, bool* all_grabbed)

Check that all the devices related to a given module are grabbed.

Parameters:

ta_name

Name of the agent

module_name

Name of the kernel module

all_grabbed

Will be set to true if all devices are grabbed and to false otherwise.

Returns:

Status code.