Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Header file for the Zephyr Memory Storage (ZMS) API. More...

#include <sys/types.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/toolchain.h>

Go to the source code of this file.

Data Structures

struct  zms_fs
 Zephyr Memory Storage file system structure. More...
struct  zms_iter_config
 Iterator configuration for zms_iter_init_with_config. More...
struct  zms_iter
 Opaque iterator state for zms_iter_next and zms_iter_next_all. More...

Macros

#define ZMS_DATA_IN_ATE_SIZE   8
 Maximum data size in bytes that ZMS stores directly inside an ATE.
#define ZMS_ITER_ID_MIN   ((zms_id_t)0)
 Default minimum ID accepted by iterator range filtering.
#define ZMS_ITER_ID_MAX   ((zms_id_t)~(zms_id_t)0)
 Default maximum ID accepted by iterator range filtering.
#define ZMS_ITER_MASK_ALL   ZMS_ITER_ID_MAX
 Default mask that accepts all IDs during iterator filtering.
#define ZMS_ITER_CONFIG_DEFAULT
 Default initializer for zms_iter_config.

Typedefs

typedef uint32_t zms_id_t
 ID type used in the ZMS API.
typedef bool(* zms_iter_predicate_t) (zms_id_t id)
 Iterator predicate callback type used by zms_iter_init_with_config.

Enumerations

enum  zms_mount_flags { ZMS_MOUNT_FLAG_NO_FORMAT = BIT(0) }
 Mount options for zms_mount and zms_mount_force. More...

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.
int zms_iter_init_with_config (const struct zms_fs *fs, struct zms_iter *iter, const struct zms_iter_config *config)
 Initialise a ZMS iterator with filtering configuration.
int zms_iter_init (const struct zms_fs *fs, struct zms_iter *iter)
 Initialise a ZMS iterator.
int zms_iter_next (struct zms_fs *fs, struct zms_iter *iter, zms_id_t *id, size_t *len, void *data, size_t data_len)
 Advance the iterator to the next live entry.
int zms_iter_next_all (struct zms_fs *fs, struct zms_iter *iter, zms_id_t *id, size_t *len, void *data, size_t data_len)
 Advance the iterator to the next matching ATE.

Detailed Description

Header file for the Zephyr Memory Storage (ZMS) API.