mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
fs/littlefs: VFS wrapper improvement: (1) Support block device interface, (2) support ioctl, stat and sync file operation, (3) support forceformat and autoformat option, (4) update file->f_pos and dir->fd_position, (5)remote the internal struct from dir, and (6) emove mtd byte read/write requirement.
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ config FS_LITTLEFS
|
|||||||
default n
|
default n
|
||||||
select FS_READABLE
|
select FS_READABLE
|
||||||
select FS_WRITABLE
|
select FS_WRITABLE
|
||||||
depends on !DISABLE_MOUNTPOINT && MTD_BYTE_WRITE && EXPERIMENTAL
|
depends on !DISABLE_MOUNTPOINT
|
||||||
---help---
|
---help---
|
||||||
Build the LITTLEFS file system. https://github.com/ARMmbed/littlefs.
|
Build the LITTLEFS file system. https://github.com/ARMmbed/littlefs.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
## usage
|
## usage
|
||||||
|
|
||||||
depends on !DISABLE_MOUNTPOINT && MTD_BYTE_WRITE
|
depends on !DISABLE_MOUNTPOINT
|
||||||
|
|
||||||
1. register_mtddriver("/dev/w25", mtd, 0755, NULL);
|
1. register_mtddriver("/dev/w25", mtd, 0755, NULL);
|
||||||
2. mount("/dev/w25", "/w25", "littlefs", 0, NULL);
|
2. mount("/dev/w25", "/w25", "littlefs", 0, NULL);
|
||||||
|
|||||||
+932
-601
File diff suppressed because it is too large
Load Diff
+7
-1
@@ -72,7 +72,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS) || \
|
#if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS) || \
|
||||||
defined(CONFIG_FS_SMARTFS)
|
defined(CONFIG_FS_SMARTFS) || defined(CONFIG_FS_LITTLEFS)
|
||||||
# define BDFS_SUPPORT 1
|
# define BDFS_SUPPORT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -117,6 +117,9 @@ extern const struct mountpt_operations romfs_operations;
|
|||||||
#ifdef CONFIG_FS_SMARTFS
|
#ifdef CONFIG_FS_SMARTFS
|
||||||
extern const struct mountpt_operations smartfs_operations;
|
extern const struct mountpt_operations smartfs_operations;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_FS_LITTLEFS
|
||||||
|
extern const struct mountpt_operations littlefs_operations;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct fsmap_t g_bdfsmap[] =
|
static const struct fsmap_t g_bdfsmap[] =
|
||||||
{
|
{
|
||||||
@@ -128,6 +131,9 @@ static const struct fsmap_t g_bdfsmap[] =
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FS_SMARTFS
|
#ifdef CONFIG_FS_SMARTFS
|
||||||
{ "smartfs", &smartfs_operations },
|
{ "smartfs", &smartfs_operations },
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_FS_LITTLEFS
|
||||||
|
{ "littlefs", &littlefs_operations },
|
||||||
#endif
|
#endif
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -222,29 +222,6 @@ struct fs_hostfsdir_s
|
|||||||
|
|
||||||
#endif /* CONFIG_DISABLE_MOUNTPOINT */
|
#endif /* CONFIG_DISABLE_MOUNTPOINT */
|
||||||
|
|
||||||
#ifdef CONFIG_FS_LITTLEFS
|
|
||||||
typedef uint32_t _lfs_block_t;
|
|
||||||
typedef uint32_t _lfs_size_t;
|
|
||||||
typedef uint32_t _lfs_off_t;
|
|
||||||
|
|
||||||
typedef struct _lfs_dir
|
|
||||||
{
|
|
||||||
struct _lfs_dir *next;
|
|
||||||
_lfs_block_t pair[2];
|
|
||||||
_lfs_off_t off;
|
|
||||||
|
|
||||||
_lfs_block_t head[2];
|
|
||||||
_lfs_off_t pos;
|
|
||||||
|
|
||||||
struct _lfs_disk_dir
|
|
||||||
{
|
|
||||||
uint32_t rev;
|
|
||||||
_lfs_size_t size;
|
|
||||||
_lfs_block_t tail[2];
|
|
||||||
} d;
|
|
||||||
} _lfs_dir_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct fs_dirent_s
|
struct fs_dirent_s
|
||||||
{
|
{
|
||||||
/* This is the node that was opened by opendir. The type of the inode
|
/* This is the node that was opened by opendir. The type of the inode
|
||||||
@@ -313,7 +290,7 @@ struct fs_dirent_s
|
|||||||
struct fs_spiffsdir_s spiffs;
|
struct fs_spiffsdir_s spiffs;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FS_LITTLEFS
|
#ifdef CONFIG_FS_LITTLEFS
|
||||||
_lfs_dir_t littlefs;
|
FAR void *littlefs;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FS_UNIONFS
|
#ifdef CONFIG_FS_UNIONFS
|
||||||
struct fs_unionfsdir_s unionfs;
|
struct fs_unionfsdir_s unionfs;
|
||||||
|
|||||||
Reference in New Issue
Block a user