fs: make file system description const
There's no reason the table of pointers to file system functions needs to be mutable at runtime. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
parent
ddcc385586
commit
353336d632
5 changed files with 10 additions and 10 deletions
|
@ -16,9 +16,9 @@ pulled out through a file system registration API.
|
|||
|
||||
.. code-block:: c
|
||||
|
||||
int fs_register(enum fs_type type, struct fs_file_system_t *fs);
|
||||
int fs_register(enum fs_type type, const struct fs_file_system_t *fs);
|
||||
|
||||
int fs_unregister(enum fs_type type, struct fs_file_system_t *fs);
|
||||
int fs_unregister(enum fs_type type, const struct fs_file_system_t *fs);
|
||||
|
||||
Zephyr RTOS supports multiple instances of a file system by making use of
|
||||
the mount point as the disk volume name, which is used by the file system library
|
||||
|
|
|
@ -494,7 +494,7 @@ int fs_statvfs(const char *path, struct fs_statvfs *stat);
|
|||
* @retval 0 Success
|
||||
* @retval -ERRNO errno code if error
|
||||
*/
|
||||
int fs_register(enum fs_type type, struct fs_file_system_t *fs);
|
||||
int fs_register(enum fs_type type, const struct fs_file_system_t *fs);
|
||||
|
||||
/**
|
||||
* @brief Unregister a file system
|
||||
|
@ -507,7 +507,7 @@ int fs_register(enum fs_type type, struct fs_file_system_t *fs);
|
|||
* @retval 0 Success
|
||||
* @retval -ERRNO errno code if error
|
||||
*/
|
||||
int fs_unregister(enum fs_type type, struct fs_file_system_t *fs);
|
||||
int fs_unregister(enum fs_type type, const struct fs_file_system_t *fs);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -407,7 +407,7 @@ static int fatfs_unmount(struct fs_mount_t *mountp)
|
|||
}
|
||||
|
||||
/* File system interface */
|
||||
static struct fs_file_system_t fatfs_fs = {
|
||||
static const struct fs_file_system_t fatfs_fs = {
|
||||
.open = fatfs_open,
|
||||
.close = fatfs_close,
|
||||
.read = fatfs_read,
|
||||
|
|
|
@ -24,7 +24,7 @@ static sys_dlist_t fs_mnt_list;
|
|||
static struct k_mutex mutex;
|
||||
|
||||
/* file system map table */
|
||||
static struct fs_file_system_t *fs_map[FS_TYPE_END];
|
||||
static const struct fs_file_system_t *fs_map[FS_TYPE_END];
|
||||
|
||||
static int fs_get_mnt_point(struct fs_mount_t **mnt_pntp,
|
||||
const char *name, size_t *match_len)
|
||||
|
@ -526,7 +526,7 @@ int fs_statvfs(const char *abs_path, struct fs_statvfs *stat)
|
|||
int fs_mount(struct fs_mount_t *mp)
|
||||
{
|
||||
struct fs_mount_t *itr;
|
||||
struct fs_file_system_t *fs;
|
||||
const struct fs_file_system_t *fs;
|
||||
sys_dnode_t *node;
|
||||
int rc = -EINVAL;
|
||||
|
||||
|
@ -664,7 +664,7 @@ int fs_readmount(int *number, const char **name)
|
|||
}
|
||||
|
||||
/* Register File system */
|
||||
int fs_register(enum fs_type type, struct fs_file_system_t *fs)
|
||||
int fs_register(enum fs_type type, const struct fs_file_system_t *fs)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
@ -682,7 +682,7 @@ reg_err:
|
|||
}
|
||||
|
||||
/* Unregister File system */
|
||||
int fs_unregister(enum fs_type type, struct fs_file_system_t *fs)
|
||||
int fs_unregister(enum fs_type type, const struct fs_file_system_t *fs)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -722,7 +722,7 @@ static int littlefs_unmount(struct fs_mount_t *mountp)
|
|||
}
|
||||
|
||||
/* File system interface */
|
||||
static struct fs_file_system_t littlefs_fs = {
|
||||
static const struct fs_file_system_t littlefs_fs = {
|
||||
.open = littlefs_open,
|
||||
.close = littlefs_close,
|
||||
.read = littlefs_read,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue