extmod/vfs_fat: Rename FileIO/TextIO types to mp_type_vfs_fat_XXX.
So they don't clash with other VFS implementations.
This commit is contained in:
parent
172c23fe5d
commit
f35aae366c
@ -55,6 +55,8 @@ typedef struct _fs_user_mount_t {
|
|||||||
|
|
||||||
extern const byte fresult_to_errno_table[20];
|
extern const byte fresult_to_errno_table[20];
|
||||||
extern const mp_obj_type_t mp_fat_vfs_type;
|
extern const mp_obj_type_t mp_fat_vfs_type;
|
||||||
|
extern const mp_obj_type_t mp_type_vfs_fat_fileio;
|
||||||
|
extern const mp_obj_type_t mp_type_vfs_fat_textio;
|
||||||
|
|
||||||
mp_import_stat_t fat_vfs_import_stat(struct _fs_user_mount_t *vfs, const char *path);
|
mp_import_stat_t fat_vfs_import_stat(struct _fs_user_mount_t *vfs, const char *path);
|
||||||
MP_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj);
|
MP_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj);
|
||||||
|
@ -35,12 +35,6 @@
|
|||||||
#include "lib/oofatfs/ff.h"
|
#include "lib/oofatfs/ff.h"
|
||||||
#include "extmod/vfs_fat.h"
|
#include "extmod/vfs_fat.h"
|
||||||
|
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
|
||||||
#define mp_type_textio fatfs_type_textio
|
|
||||||
|
|
||||||
extern const mp_obj_type_t mp_type_fileio;
|
|
||||||
extern const mp_obj_type_t mp_type_textio;
|
|
||||||
|
|
||||||
// this table converts from FRESULT to POSIX errno
|
// this table converts from FRESULT to POSIX errno
|
||||||
const byte fresult_to_errno_table[20] = {
|
const byte fresult_to_errno_table[20] = {
|
||||||
[FR_OK] = 0,
|
[FR_OK] = 0,
|
||||||
@ -189,11 +183,11 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
|
|||||||
break;
|
break;
|
||||||
#if MICROPY_PY_IO_FILEIO
|
#if MICROPY_PY_IO_FILEIO
|
||||||
case 'b':
|
case 'b':
|
||||||
type = &mp_type_fileio;
|
type = &mp_type_vfs_fat_fileio;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 't':
|
case 't':
|
||||||
type = &mp_type_textio;
|
type = &mp_type_vfs_fat_textio;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,7 +243,7 @@ STATIC const mp_stream_p_t fileio_stream_p = {
|
|||||||
.ioctl = file_obj_ioctl,
|
.ioctl = file_obj_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mp_obj_type_t mp_type_fileio = {
|
const mp_obj_type_t mp_type_vfs_fat_fileio = {
|
||||||
{ &mp_type_type },
|
{ &mp_type_type },
|
||||||
.name = MP_QSTR_FileIO,
|
.name = MP_QSTR_FileIO,
|
||||||
.print = file_obj_print,
|
.print = file_obj_print,
|
||||||
@ -268,7 +262,7 @@ STATIC const mp_stream_p_t textio_stream_p = {
|
|||||||
.is_text = true,
|
.is_text = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mp_obj_type_t mp_type_textio = {
|
const mp_obj_type_t mp_type_vfs_fat_textio = {
|
||||||
{ &mp_type_type },
|
{ &mp_type_type },
|
||||||
.name = MP_QSTR_TextIOWrapper,
|
.name = MP_QSTR_TextIOWrapper,
|
||||||
.print = file_obj_print,
|
.print = file_obj_print,
|
||||||
@ -287,7 +281,7 @@ STATIC mp_obj_t fatfs_builtin_open_self(mp_obj_t self_in, mp_obj_t path, mp_obj_
|
|||||||
arg_vals[0].u_obj = path;
|
arg_vals[0].u_obj = path;
|
||||||
arg_vals[1].u_obj = mode;
|
arg_vals[1].u_obj = mode;
|
||||||
arg_vals[2].u_obj = mp_const_none;
|
arg_vals[2].u_obj = mp_const_none;
|
||||||
return file_open(self, &mp_type_textio, arg_vals);
|
return file_open(self, &mp_type_vfs_fat_textio, arg_vals);
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_open_obj, fatfs_builtin_open_self);
|
MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_open_obj, fatfs_builtin_open_self);
|
||||||
|
|
||||||
|
@ -131,8 +131,8 @@
|
|||||||
X(ETIMEDOUT) \
|
X(ETIMEDOUT) \
|
||||||
|
|
||||||
// TODO these should be generic, not bound to fatfs
|
// TODO these should be generic, not bound to fatfs
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||||
#define mp_type_textio fatfs_type_textio
|
#define mp_type_textio mp_type_vfs_fat_textio
|
||||||
|
|
||||||
// use vfs's functions for import stat and builtin open
|
// use vfs's functions for import stat and builtin open
|
||||||
#define mp_import_stat mp_vfs_import_stat
|
#define mp_import_stat mp_vfs_import_stat
|
||||||
|
@ -152,8 +152,8 @@
|
|||||||
#define MICROPY_FATFS_RPATH (2)
|
#define MICROPY_FATFS_RPATH (2)
|
||||||
#define MICROPY_FATFS_MAX_SS (4096)
|
#define MICROPY_FATFS_MAX_SS (4096)
|
||||||
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||||
#define mp_type_textio fatfs_type_textio
|
#define mp_type_textio mp_type_vfs_fat_textio
|
||||||
|
|
||||||
// use vfs's functions for import stat and builtin open
|
// use vfs's functions for import stat and builtin open
|
||||||
#define mp_import_stat mp_vfs_import_stat
|
#define mp_import_stat mp_vfs_import_stat
|
||||||
|
@ -141,8 +141,8 @@ typedef uint32_t sys_prot_t; // for modlwip
|
|||||||
void *esp_native_code_commit(void*, size_t);
|
void *esp_native_code_commit(void*, size_t);
|
||||||
#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
|
#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
|
||||||
|
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||||
#define mp_type_textio fatfs_type_textio
|
#define mp_type_textio mp_type_vfs_fat_textio
|
||||||
|
|
||||||
// use vfs's functions for import stat and builtin open
|
// use vfs's functions for import stat and builtin open
|
||||||
#define mp_import_stat mp_vfs_import_stat
|
#define mp_import_stat mp_vfs_import_stat
|
||||||
|
@ -161,8 +161,8 @@
|
|||||||
#define MICROPY_FATFS_MULTI_PARTITION (1)
|
#define MICROPY_FATFS_MULTI_PARTITION (1)
|
||||||
|
|
||||||
// TODO these should be generic, not bound to fatfs
|
// TODO these should be generic, not bound to fatfs
|
||||||
#define mp_type_fileio fatfs_type_fileio
|
#define mp_type_fileio mp_type_vfs_fat_fileio
|
||||||
#define mp_type_textio fatfs_type_textio
|
#define mp_type_textio mp_type_vfs_fat_textio
|
||||||
|
|
||||||
// use vfs's functions for import stat and builtin open
|
// use vfs's functions for import stat and builtin open
|
||||||
#define mp_import_stat mp_vfs_import_stat
|
#define mp_import_stat mp_vfs_import_stat
|
||||||
|
Loading…
x
Reference in New Issue
Block a user