Loading...
Searching...
No Matches
file.h File Reference

file operation functions More...

Functions

void * spdk_posix_file_load (FILE *file, size_t *size)
 Load the input file content into a data buffer.
 
void * spdk_posix_file_load_from_name (const char *file_name, size_t *size)
 Load content of a given file name into a data buffer.
 
int spdk_read_sysfs_attribute (char **attribute, const char *path_format,...)
 Get the string value for a given sysfs attribute path.
 
int spdk_read_sysfs_attribute_uint32 (uint32_t *attribute, const char *path_format,...)
 Get the uint32 value for a given sysfs attribute path.
 

Detailed Description

file operation functions

Function Documentation

◆ spdk_posix_file_load()

void * spdk_posix_file_load ( FILE * file,
size_t * size )

Load the input file content into a data buffer.

Parameters
fileFile handle.
sizeSize of bytes read from the file.
Returns
data contains the content on success, NULL on failure.

◆ spdk_posix_file_load_from_name()

void * spdk_posix_file_load_from_name ( const char * file_name,
size_t * size )

Load content of a given file name into a data buffer.

Parameters
file_nameFile name.
sizeSize of bytes read from the file.
Returns
data containing the content on success, NULL on failure.

◆ spdk_read_sysfs_attribute()

int spdk_read_sysfs_attribute ( char ** attribute,
const char * path_format,
... )

Get the string value for a given sysfs attribute path.

When successful, the returned string will be null-terminated, without a trailing newline.

Parameters
attributeoutput parameter for contents of the attribute; caller must free() the buffer pointed to by attribute at some point after a successful call
path_formatformat string for constructing patch to sysfs file
Returns
0 on success negative errno if unable to read the attribute

◆ spdk_read_sysfs_attribute_uint32()

int spdk_read_sysfs_attribute_uint32 ( uint32_t * attribute,
const char * path_format,
... )

Get the uint32 value for a given sysfs attribute path.

Parameters
attributeoutput parameter for contents of the attribute
path_formatformat string for constructing patch to sysfs file
Returns
0 on success negative errno if unable to read the attribute or it is not a uint32