Data Structures | Functions

Data storage device interface

Data Structures

struct  sa_data_storage

Functions

SA_EXPORT int sa_open_data_storage (void)
SA_EXPORT int sa_close_data_storage (void)
SA_EXPORT int sa_count_data_storages (uint16_t *number)
SA_EXPORT int sa_get_data_storage (char *name, struct sa_data_storage *dst)
SA_EXPORT int sa_get_data_storages (struct sa_data_storage *dst, uint16_t dst_size, uint16_t *written)

Function Documentation

SA_EXPORT int sa_open_data_storage ( void   ) 

Prepares the resources needed for retrieving data storage statistics. This function exists (and is needed) only when SA_OPEN_DATA_STORAGE is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned. If the operative system is not supported the return value will be ENOTSUP.
See also:
sa_close_data_storage()
SA_EXPORT int sa_close_data_storage ( void   ) 

This function closes the resources used for retrieving data storage statistics. You should call it even when there was a previous error in another function of this API. This function exists (and is needed) only when SA_CLOSE_DATA_STORAGE is defined.

Returns:
If successful 0 is returned, otherwise an error code is returned.
See also:
sa_open_data_storage()
SA_EXPORT int sa_count_data_storages ( uint16_t *  number  ) 

Gives the total number of data storage devices.

Parameters:
number The number will be stored here
Returns:
If successful 0 is returned, otherwise an error code is returned.
SA_EXPORT int sa_get_data_storage ( char *  name,
struct sa_data_storage dst 
)

Retrieves statistics from a data storage device identified by its name.

Parameters:
name The name of the data storage device.
dst Where the statistics will be stored.
Returns:
If successful 0 is returned, otherwise an error code is returned. ENODEV is returned when the requested device was not found.
SA_EXPORT int sa_get_data_storages ( struct sa_data_storage dst,
uint16_t  dst_size,
uint16_t *  written 
)

Retrieves statistics about all the storage devices' activity.

Parameters:
dst A buffer where the statistics will be stored.
dst_size The number of devices that fits in the dst buffer. If it's not big enough dst will be filled but ENOMEM will be returned.
written The amount of device statistics written.
Returns:
If successful 0 is returned, otherwise an error code is returned.
 All Data Structures Variables