|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Typedefs | |
| typedef uint32_t | zms_id_t |
| ID type used in the ZMS API. | |
Functions | |
| int | zms_mount (struct zms_fs *fs) |
| Mount a ZMS file system onto the device specified in fs. | |
| int | zms_mount_force (struct zms_fs *fs) |
| Mount a ZMS file system onto the device specified in fs, wiping the partition if mounting fails the first time. | |
| int | zms_clear (struct zms_fs *fs) |
| Clear the ZMS file system from device. | |
| ssize_t | zms_write (struct zms_fs *fs, zms_id_t id, const void *data, size_t len) |
| Write an entry to the file system. | |
| int | zms_delete (struct zms_fs *fs, zms_id_t id) |
| Delete an entry from the file system. | |
| ssize_t | zms_read (struct zms_fs *fs, zms_id_t id, void *data, size_t len) |
| Read an entry from the file system. | |
| ssize_t | zms_read_hist (struct zms_fs *fs, zms_id_t id, void *data, size_t len, uint32_t cnt) |
| Read a history entry from the file system. | |
| ssize_t | zms_get_data_length (struct zms_fs *fs, zms_id_t id) |
| Gets the length of the data that is stored in an entry with a given id. | |
| ssize_t | zms_calc_free_space (struct zms_fs *fs) |
| Calculate the available free space in the file system. | |
| ssize_t | zms_active_sector_free_space (struct zms_fs *fs) |
| Tell how much contiguous free space remains in the currently active ZMS sector. | |
| int | zms_sector_use_next (struct zms_fs *fs) |
| Close the currently active sector and switch to the next one. | |
| int | zms_get_num_cycles (struct zms_fs *fs, uint32_t *cycles) |
| Return the maximum sector recycle count across all sectors. | |
| int | zms_get_sector_num_cycles (struct zms_fs *fs, uint32_t sector, uint32_t *cycles) |
| Return the recycle count for a specific sector. | |
#include <zephyr/kvss/zms.h>
ID type used in the ZMS API.
CONFIG_ZMS_ID_64BIT. #include <zephyr/kvss/zms.h>
Tell how much contiguous free space remains in the currently active ZMS sector.
| fs | Pointer to the file system. |
| >=0 | Number of free bytes in the currently active sector. On success, it will be equal to the number of bytes that can be written without automatically advancing to the next sector. |
| -EACCES | if ZMS is still not initialized. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Calculate the available free space in the file system.
| fs | Pointer to the file system. |
| -EACCES | if ZMS is still not initialized. |
| -EIO | if there is a memory read/write error. |
| -EINVAL | if fs is NULL. |
| int zms_clear | ( | struct zms_fs * | fs | ) |
#include <zephyr/kvss/zms.h>
Clear the ZMS file system from device.
The ZMS file system must be re-mounted after this operation.
| fs | Pointer to the file system. |
| 0 | on success. |
| -EACCES | if fs is not mounted. |
| -ENXIO | if there is a device error. |
| -EIO | if there is a memory read/write error. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Delete an entry from the file system.
| fs | Pointer to the file system. |
| id | ID of the entry to be deleted. |
| 0 | on success. |
| -EACCES | if ZMS is still not initialized. |
| -ENXIO | if there is a device error. |
| -EIO | if there is a memory read/write error. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Gets the length of the data that is stored in an entry with a given id.
| fs | Pointer to the file system. |
| id | ID of the entry whose data length to retrieve. |
| -EACCES | if ZMS is still not initialized. |
| -EIO | if there is a memory read/write error. |
| -ENOENT | if there is no entry with the given id. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Return the maximum sector recycle count across all sectors.
Iterates all sectors and stores the highest 32-bit cycle counter found in each sector's empty ATE in cycles. This can be used to estimate write-cycle consumption during testing.
| fs | Pointer to the file system. |
| cycles | Pointer to store the maximum 32-bit cycle count across sectors. |
| 0 | on success. |
| -EINVAL | if fs or cycles is NULL. |
| -EACCES | if the file system is not mounted. |
#include <zephyr/kvss/zms.h>
Return the recycle count for a specific sector.
| fs | Pointer to the file system. |
| sector | Sector index (0-based, must be less than fs->sector_count). |
| cycles | Pointer to store the 32-bit cycle count. |
| 0 | on success. |
| -EINVAL | if fs or cycles is NULL, or sector is out of range. |
| -EACCES | if the file system is not mounted. |
| -ENOENT | if the sector has no valid empty ATE. |
| int zms_mount | ( | struct zms_fs * | fs | ) |
#include <zephyr/kvss/zms.h>
Mount a ZMS file system onto the device specified in fs.
If the flash area is erased and no valid ZMS header is found, mount will format the area and create a valid header by default. Set ZMS_MOUNT_FLAG_NO_FORMAT in fs->mount_flags to disable this auto-format behavior and fail the mount instead.
| fs | Pointer to the file system. |
| 0 | on success. |
| -ENOTSUP | if the detected file system is not ZMS. |
| -EPROTONOSUPPORT | if the ZMS version is not supported. |
| -EINVAL | if fs is NULL or any of the flash parameters or the sector layout is invalid. |
| -ENXIO | if there is a device error. |
| -EIO | if there is a memory read/write error. |
| int zms_mount_force | ( | struct zms_fs * | fs | ) |
#include <zephyr/kvss/zms.h>
Mount a ZMS file system onto the device specified in fs, wiping the partition if mounting fails the first time.
| fs | Pointer to the file system. |
| 0 | on success. |
| -ENOTSUP | if the detected file system is not ZMS. |
| -EPROTONOSUPPORT | if the ZMS version is not supported. |
| -EINVAL | if fs is NULL or any of the flash parameters or the sector layout is invalid. |
| -ENXIO | if there is a device error. |
| -EIO | if there is a memory read/write error. |
#include <zephyr/kvss/zms.h>
Read an entry from the file system.
| fs | Pointer to the file system. |
| id | ID of the entry to be read. |
| data | Pointer to data buffer. |
| len | Number of bytes to read at most. |
| -EACCES | if ZMS is still not initialized. |
| -EIO | if there is a memory read/write error. |
| -ENOENT | if there is no entry with the given id. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Read a history entry from the file system.
| fs | Pointer to the file system. |
| id | ID of the entry to be read. |
| data | Pointer to data buffer. |
| len | Number of bytes to be read. |
| cnt | History counter: 0: latest entry, 1: one before latest ... |
| -EACCES | if ZMS is still not initialized. |
| -EIO | if there is a memory read/write error. |
| -ENOENT | if there is no entry with the given id and history counter. |
| -EINVAL | if fs is NULL. |
| int zms_sector_use_next | ( | struct zms_fs * | fs | ) |
#include <zephyr/kvss/zms.h>
Close the currently active sector and switch to the next one.
| fs | Pointer to the file system. |
| 0 | on success. |
| -EACCES | if ZMS is still not initialized. |
| -EIO | if there is a memory read/write error. |
| -EINVAL | if fs is NULL. |
#include <zephyr/kvss/zms.h>
Write an entry to the file system.
| fs | Pointer to the file system. |
| id | ID of the entry to be written. |
| data | Pointer to the data to be written. |
| len | Number of bytes to be written (maximum 64 KiB). |
| -EACCES | if ZMS is still not initialized. |
| -ENXIO | if there is a device error. |
| -EIO | if there is a memory read/write error. |
| -EINVAL | if fs is NULL or len is invalid. |
| -ENOSPC | if no space is left on the device. |