Adding a new file system

This section describes the common interface provided by any filesystem.



int fs_register(struct fs_ops * fops)

Registers a new filesystem interface.

0 on success, non-zero on failure
  • fops: filesystem operations table

struct fs_ops* fs_ops_try_unique(void)

Will look for the number of registered filesystems and will return the fops if there is only one.

fops if there’s only one registered filesystem, NULL otherwise.

struct fs_ops* fs_ops_for(const char * name)

Retrieve a filesystem’s operations table.

valid pointer on success, NULL on failure
  • name: Name of the filesystem to retrieve fs_ops for

struct fs_ops* fs_ops_from_container(struct fops_container * container)
struct fs_ops
#include <fs_if.h>

Public Functions


Public Members

intf_open)(const char *filename, uint8_t access_flags, struct fs_file **out_file)
intf_close)(struct fs_file *file)
intf_read)(struct fs_file *file, uint32_t len, void *out_data, uint32_t *out_len)
intf_write)(struct fs_file *file, const void *data, int len)
intf_seek)(struct fs_file *file, uint32_t offset)
uint32_tf_getpos)(const struct fs_file *file)
intf_filelen)(const struct fs_file *file, uint32_t *out_len)
intf_rename)(const char *from, const char *to)
intf_mkdir)(const char *path)
intf_opendir)(const char *path, struct fs_dir **out_dir)
intf_readdir)(struct fs_dir *dir, struct fs_dirent **out_dirent)
intf_closedir)(struct fs_dir *dir)
intf_dirent_name)(const struct fs_dirent *dirent, size_t max_len, char *out_name, uint8_t *out_name_len)
intf_dirent_is_dir)(const struct fs_dirent *dirent)
const char* f_name
struct fops_container
#include <fs_if.h>

Public Members

struct fs_ops* fops