Defines Trusted Little Kernel (TLK) storage services declarations and functions.
|
te_error_t | te_create_storage_object (char *name, te_storage_flags_t flags, te_storage_object_t *obj) |
| Creates a persistent storage object handle. More...
|
|
te_error_t | te_open_storage_object (char *name, te_storage_flags_t flags, te_storage_object_t *obj) |
| Opens a persistent storage object. More...
|
|
te_error_t | te_read_storage_object (te_storage_object_t obj, void *buffer, uint32_t size, uint32_t *count) |
| Reads data from a persistent object. More...
|
|
te_error_t | te_write_storage_object (te_storage_object_t obj, const void *buffer, uint32_t size) |
| Writes data to the persistent object. More...
|
|
te_error_t | te_get_storage_object_size (te_storage_object_t obj, uint32_t *size) |
| Gets the size of the data stored in the persistent object. More...
|
|
te_error_t | te_seek_storage_object (te_storage_object_t obj, int32_t offset, te_storage_whence_t whence) |
| Seeks to the specified offset in the persistent object. More...
|
|
te_error_t | te_trunc_storage_object (te_storage_object_t obj, uint32_t size) |
| Truncates the data stored in the persistent object to the specified size. More...
|
|
te_error_t | te_delete_storage_object (te_storage_object_t obj) |
| Deletes a persistent object. More...
|
|
te_error_t | te_delete_named_storage_object (const char *name) |
| Deletes a persistent object by name. More...
|
|
te_error_t | te_close_storage_object (te_storage_object_t obj) |
| Closes the persistent object handle. More...
|
|
#define TE_STORAGE_OBJID_MAX_LEN 64 |
Defines the maximum file name length in bytes.
Definition at line 50 of file ote_storage.h.
Defines file access flags.
Enumerator |
---|
OTE_STORAGE_FLAG_ACCESS_READ |
Specifies read access.
|
OTE_STORAGE_FLAG_ACCESS_WRITE |
Specifies write access.
|
OTE_STORAGE_FLAG_ACCESS_WRITE_META |
Specifies delete access.
|
Definition at line 57 of file ote_storage.h.
Defines seek whence options.
Enumerator |
---|
OTE_STORAGE_SEEK_WHENCE_SET |
Apply specified offset to start of file.
|
OTE_STORAGE_SEEK_WHENCE_CUR |
Apply specified offset to current position in file.
|
OTE_STORAGE_SEEK_WHENCE_END |
Apply specified offset to current end of file.
|
Definition at line 129 of file ote_storage.h.
Closes the persistent object handle.
This must be called when a client is done using the handle. On completion the handle will be invalid and te_open_storage_object() must be used again to obtain a new handle.
- Parameters
-
[in] | obj | Handle returned by te_open_storage_object (). |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Creates a persistent storage object handle.
- Precondition
- This function must be called before accessing a file.
- Parameters
-
[in] | name | Name of the persistent storage object (file). |
[in] | flags | File access flags. |
[out] | obj | A pointer to persistent object handle. |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
te_error_t te_delete_named_storage_object |
( |
const char * |
name | ) |
|
Deletes a persistent object by name.
- Parameters
-
[in] | name | Name of the persistent storage object (file). |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Deletes a persistent object.
- Parameters
-
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Gets the size of the data stored in the persistent object.
- Parameters
-
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Opens a persistent storage object.
- Precondition
- This function must be called before accessing a file.
- Parameters
-
[in] | name | Name of the persistent storage object (file). |
[in] | flags | File access flags. |
[out] | obj | A pointer to a persistent object handle. |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Reads data from a persistent object.
The actual number of bytes read can be less than the requested value and does not necessarily mean a read failure.
- Parameters
-
[in] | obj | Handle returned by te_open_storage_object(). |
[in] | buffer | Data buffer. |
[in] | size | Size of the data buffer in bytes. |
[out] | count | Actual number of bytes read. |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful and count contains a non-zero value. |
Seeks to the specified offset in the persistent object.
- Parameters
-
[in] | obj | Handle returned by te_open_storage_object(). |
[in] | offset | Number of bytes by which to adjust the data position. A positive value specifies to adjust the data position forward while a negative value specifies to adjust it backward. |
[in] | whence | The position in the data from which to calculate the new position. |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Truncates the data stored in the persistent object to the specified size.
If the specified size is less than the current size then any residual data are lost.
- Parameters
-
[in] | obj | Handle to writable persistent storage object returned by te_open_storage_object(). |
[in] | size | The new size of the object's data in bytes. |
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |
Writes data to the persistent object.
- Parameters
-
- Return values
-
OTE_SUCCESS | Indicates the operation was successful. |