1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/littlefs2: rename littlefs_desc_t -> littlefs2_desc_t

Allow to have both versions of the FS present at the same time.
This commit is contained in:
Benjamin Valentin 2020-06-30 16:09:40 +02:00 committed by Benjamin Valentin
parent e2ba95a901
commit a028102149
3 changed files with 23 additions and 23 deletions

View File

@ -66,7 +66,7 @@ static int littlefs_err_to_errno(ssize_t err)
static int _dev_read(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size)
{
littlefs_desc_t *fs = c->context;
littlefs2_desc_t *fs = c->context;
mtd_dev_t *mtd = fs->dev;
DEBUG("lfs_read: c=%p, block=%" PRIu32 ", off=%" PRIu32 ", buf=%p, size=%" PRIu32 "\n",
@ -78,7 +78,7 @@ static int _dev_read(const struct lfs_config *c, lfs_block_t block,
static int _dev_write(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size)
{
littlefs_desc_t *fs = c->context;
littlefs2_desc_t *fs = c->context;
mtd_dev_t *mtd = fs->dev;
DEBUG("lfs_write: c=%p, block=%" PRIu32 ", off=%" PRIu32 ", buf=%p, size=%" PRIu32 "\n",
@ -99,7 +99,7 @@ static int _dev_write(const struct lfs_config *c, lfs_block_t block,
static int _dev_erase(const struct lfs_config *c, lfs_block_t block)
{
littlefs_desc_t *fs = c->context;
littlefs2_desc_t *fs = c->context;
mtd_dev_t *mtd = fs->dev;
DEBUG("lfs_erase: c=%p, block=%" PRIu32 "\n", (void *)c, block);
@ -119,7 +119,7 @@ static int _dev_sync(const struct lfs_config *c)
return 0;
}
static int prepare(littlefs_desc_t *fs)
static int prepare(littlefs2_desc_t *fs)
{
mutex_init(&fs->lock);
mutex_lock(&fs->lock);
@ -172,7 +172,7 @@ static int prepare(littlefs_desc_t *fs)
static int _format(vfs_mount_t *mountp)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
DEBUG("littlefs: format: mountp=%p\n", (void *)mountp);
int ret = prepare(fs);
@ -193,7 +193,7 @@ static int _mount(vfs_mount_t *mountp)
BUILD_BUG_ON(VFS_DIR_BUFFER_SIZE < sizeof(lfs_dir_t));
BUILD_BUG_ON(VFS_FILE_BUFFER_SIZE < sizeof(lfs_file_t));
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
DEBUG("littlefs: mount: mountp=%p\n", (void *)mountp);
int ret = prepare(fs);
@ -209,7 +209,7 @@ static int _mount(vfs_mount_t *mountp)
static int _umount(vfs_mount_t *mountp)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -223,7 +223,7 @@ static int _umount(vfs_mount_t *mountp)
static int _unlink(vfs_mount_t *mountp, const char *name)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -238,7 +238,7 @@ static int _unlink(vfs_mount_t *mountp, const char *name)
static int _rename(vfs_mount_t *mountp, const char *from_path, const char *to_path)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -254,7 +254,7 @@ static int _rename(vfs_mount_t *mountp, const char *from_path, const char *to_pa
static int _mkdir(vfs_mount_t *mountp, const char *name, mode_t mode)
{
(void)mode;
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -269,7 +269,7 @@ static int _mkdir(vfs_mount_t *mountp, const char *name, mode_t mode)
static int _rmdir(vfs_mount_t *mountp, const char *name)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -284,7 +284,7 @@ static int _rmdir(vfs_mount_t *mountp, const char *name)
static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, const char *abs_path)
{
littlefs_desc_t *fs = filp->mp->private_data;
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = (lfs_file_t *)&filp->private_data.buffer;
(void) abs_path;
(void) mode;
@ -326,7 +326,7 @@ static int _open(vfs_file_t *filp, const char *name, int flags, mode_t mode, con
static int _close(vfs_file_t *filp)
{
littlefs_desc_t *fs = filp->mp->private_data;
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = (lfs_file_t *)&filp->private_data.buffer;
mutex_lock(&fs->lock);
@ -341,7 +341,7 @@ static int _close(vfs_file_t *filp)
static ssize_t _write(vfs_file_t *filp, const void *src, size_t nbytes)
{
littlefs_desc_t *fs = filp->mp->private_data;
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = (lfs_file_t *)&filp->private_data.buffer;
mutex_lock(&fs->lock);
@ -357,7 +357,7 @@ static ssize_t _write(vfs_file_t *filp, const void *src, size_t nbytes)
static ssize_t _read(vfs_file_t *filp, void *dest, size_t nbytes)
{
littlefs_desc_t *fs = filp->mp->private_data;
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = (lfs_file_t *)&filp->private_data.buffer;
mutex_lock(&fs->lock);
@ -373,7 +373,7 @@ static ssize_t _read(vfs_file_t *filp, void *dest, size_t nbytes)
static off_t _lseek(vfs_file_t *filp, off_t off, int whence)
{
littlefs_desc_t *fs = filp->mp->private_data;
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = (lfs_file_t *)&filp->private_data.buffer;
mutex_lock(&fs->lock);
@ -389,7 +389,7 @@ static off_t _lseek(vfs_file_t *filp, off_t off, int whence)
static int _stat(vfs_mount_t *mountp, const char *restrict path, struct stat *restrict buf)
{
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -425,7 +425,7 @@ static int _traverse_cb(void *param, lfs_block_t block)
static int _statvfs(vfs_mount_t *mountp, const char *restrict path, struct statvfs *restrict buf)
{
(void)path;
littlefs_desc_t *fs = mountp->private_data;
littlefs2_desc_t *fs = mountp->private_data;
mutex_lock(&fs->lock);
@ -450,7 +450,7 @@ static int _statvfs(vfs_mount_t *mountp, const char *restrict path, struct statv
static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
{
(void)abs_path;
littlefs_desc_t *fs = dirp->mp->private_data;
littlefs2_desc_t *fs = dirp->mp->private_data;
lfs_dir_t *dir = (lfs_dir_t *)&dirp->private_data.buffer;
mutex_lock(&fs->lock);
@ -466,7 +466,7 @@ static int _opendir(vfs_DIR *dirp, const char *dirname, const char *abs_path)
static int _readdir(vfs_DIR *dirp, vfs_dirent_t *entry)
{
littlefs_desc_t *fs = dirp->mp->private_data;
littlefs2_desc_t *fs = dirp->mp->private_data;
lfs_dir_t *dir = (lfs_dir_t *)&dirp->private_data.buffer;
mutex_lock(&fs->lock);
@ -489,7 +489,7 @@ static int _readdir(vfs_DIR *dirp, vfs_dirent_t *entry)
static int _closedir(vfs_DIR *dirp)
{
littlefs_desc_t *fs = dirp->mp->private_data;
littlefs2_desc_t *fs = dirp->mp->private_data;
lfs_dir_t *dir = (lfs_dir_t *)&dirp->private_data.buffer;
mutex_lock(&fs->lock);

View File

@ -105,7 +105,7 @@ typedef struct {
#endif
/** lookahead buffer to use internally */
uint8_t lookahead_buf[CONFIG_LITTLEFS2_LOOKAHEAD_SIZE];
} littlefs_desc_t;
} littlefs2_desc_t;
/** The littlefs vfs driver */
extern const vfs_file_system_t littlefs2_file_system;

View File

@ -117,7 +117,7 @@ static mtd_dev_t dev = {
static mtd_dev_t *_dev = (mtd_dev_t*) &dev;
#endif /* MTD_0 */
static littlefs_desc_t littlefs_desc;
static littlefs2_desc_t littlefs_desc;
static vfs_mount_t _test_littlefs_mount = {
.fs = &littlefs2_file_system,