Test API to control the local storage device

Overview

Functions for convenient work with storage device. More…

// typedefs

typedef struct tapi_local_storage_device tapi_local_storage_device;
typedef te_errno (*tapi_local_storage_device_method_insert)(tapi_local_storage_device *device);
typedef te_errno (*tapi_local_storage_device_method_eject)(tapi_local_storage_device *device);
typedef struct tapi_local_storage_device_methods tapi_local_storage_device_methods;
typedef enum tapi_local_storage_device_type tapi_local_storage_device_type;
typedef struct tapi_local_storage_device_le tapi_local_storage_device_le;
typedef struct tapi_local_storage_device_list tapi_local_storage_device_list;

// enums

enum tapi_local_storage_device_type;

// structs

struct tapi_local_storage_device;
struct tapi_local_storage_device_le;
struct tapi_local_storage_device_methods;

// global functions

SLIST_HEAD(tapi_local_storage_device_list, tapi_local_storage_device_le);
static void tapi_local_storage_device_set_methods(tapi_local_storage_device* device, const tapi_local_storage_device_methods* methods);
static te_errno tapi_local_storage_device_insert(tapi_local_storage_device* device);
static te_errno tapi_local_storage_device_eject(tapi_local_storage_device* device);
te_errno tapi_local_storage_device_list_get(tapi_local_storage_device_list* devices);
void tapi_local_storage_device_list_free(tapi_local_storage_device_list* devices);
te_errno tapi_local_storage_device_get(const char* name, tapi_local_storage_device** device);
void tapi_local_storage_device_free(tapi_local_storage_device* device);
te_errno tapi_local_storage_device_init(const char* name, tapi_local_storage_device* device);
void tapi_local_storage_device_fini(tapi_local_storage_device* device);

Detailed Documentation

Functions for convenient work with storage device.

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

Typedefs

typedef te_errno (*tapi_local_storage_device_method_insert)(tapi_local_storage_device *device)

Insert device.

Parameters:

device

Device handle.

Returns:

Status code.

typedef te_errno (*tapi_local_storage_device_method_eject)(tapi_local_storage_device *device)

Eject device.

Parameters:

device

Device handle.

Returns:

Status code.

typedef struct tapi_local_storage_device_methods tapi_local_storage_device_methods

Methods to operate with device.

typedef enum tapi_local_storage_device_type tapi_local_storage_device_type

Devices types.

typedef struct tapi_local_storage_device_le tapi_local_storage_device_le

Devices list entry.

Global Functions

SLIST_HEAD(tapi_local_storage_device_list, tapi_local_storage_device_le)

Head of devices list.

static void tapi_local_storage_device_set_methods(tapi_local_storage_device* device, const tapi_local_storage_device_methods* methods)

Set methods to operate the device. device should be pre-initialized with, for example, tapi_local_storage_device_get

Parameters:

device

Device context.

methods

Methods to operate the device.

See also:

tapi_local_storage_device_get

static te_errno tapi_local_storage_device_insert(tapi_local_storage_device* device)

Insert device.

Parameters:

device

Device handle.

Returns:

Status code.

static te_errno tapi_local_storage_device_eject(tapi_local_storage_device* device)

Eject device.

Parameters:

device

Device handle.

Returns:

Status code.

te_errno tapi_local_storage_device_list_get(tapi_local_storage_device_list* devices)

Get all devices from configurator and read them properties. List of devices should be released with tapi_local_storage_device_list_free when it is no longer needed.

Parameters:

devices

Devices list.

Returns:

Status code.

See also:

tapi_local_storage_device_list_free

void tapi_local_storage_device_list_free(tapi_local_storage_device_list* devices)

Release devices list that was obtained with tapi_local_storage_device_list_get.

Parameters:

devices

Devices list.

See also:

tapi_local_storage_device_list_get

te_errno tapi_local_storage_device_get(const char* name, tapi_local_storage_device** device)

Get a certain device info from configurator. device should be released with tapi_local_storage_device_free when it is no longer needed.

Parameters:

name

Device name to find.

device

Device context.

Returns:

Status code.

See also:

tapi_local_storage_device_free

void tapi_local_storage_device_free(tapi_local_storage_device* device)

Release device context that was obtained with tapi_local_storage_device_get.

Parameters:

device

Device context.

See also:

tapi_local_storage_device_get

te_errno tapi_local_storage_device_init(const char* name, tapi_local_storage_device* device)

Initialize a device by information obtained from configurator. device should be released with tapi_local_storage_device_fini when it is no longer needed.

Parameters:

name

Device name to find.

device

Device context.

Returns:

Status code.

See also:

tapi_local_storage_device_fini

void tapi_local_storage_device_fini(tapi_local_storage_device* device)

Release device context which was initialized with tapi_local_storage_device_init.

Parameters:

device

Device context.

See also:

tapi_local_storage_device_init