summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extmod/vfs_fat.h2
-rw-r--r--extmod/vfs_fat_file.c16
-rw-r--r--ports/cc3200/mpconfigport.h4
-rw-r--r--ports/esp32/mpconfigport.h4
-rw-r--r--ports/esp8266/mpconfigport.h4
-rw-r--r--ports/stm32/mpconfigport.h4
6 files changed, 15 insertions, 19 deletions
diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h
index da56a9077..e0836a555 100644
--- a/extmod/vfs_fat.h
+++ b/extmod/vfs_fat.h
@@ -55,6 +55,8 @@ typedef struct _fs_user_mount_t {
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_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_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj);
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index cbd013f16..f7b9331b8 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -35,12 +35,6 @@
#include "lib/oofatfs/ff.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
const byte fresult_to_errno_table[20] = {
[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;
#if MICROPY_PY_IO_FILEIO
case 'b':
- type = &mp_type_fileio;
+ type = &mp_type_vfs_fat_fileio;
break;
#endif
case 't':
- type = &mp_type_textio;
+ type = &mp_type_vfs_fat_textio;
break;
}
}
@@ -249,7 +243,7 @@ STATIC const mp_stream_p_t fileio_stream_p = {
.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 },
.name = MP_QSTR_FileIO,
.print = file_obj_print,
@@ -268,7 +262,7 @@ STATIC const mp_stream_p_t textio_stream_p = {
.is_text = true,
};
-const mp_obj_type_t mp_type_textio = {
+const mp_obj_type_t mp_type_vfs_fat_textio = {
{ &mp_type_type },
.name = MP_QSTR_TextIOWrapper,
.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[1].u_obj = mode;
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);
diff --git a/ports/cc3200/mpconfigport.h b/ports/cc3200/mpconfigport.h
index 29ae9092b..ee9a226e5 100644
--- a/ports/cc3200/mpconfigport.h
+++ b/ports/cc3200/mpconfigport.h
@@ -131,8 +131,8 @@
X(ETIMEDOUT) \
// TODO these should be generic, not bound to fatfs
-#define mp_type_fileio fatfs_type_fileio
-#define mp_type_textio fatfs_type_textio
+#define mp_type_fileio mp_type_vfs_fat_fileio
+#define mp_type_textio mp_type_vfs_fat_textio
// use vfs's functions for import stat and builtin open
#define mp_import_stat mp_vfs_import_stat
diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h
index c7a87e3af..24034ba16 100644
--- a/ports/esp32/mpconfigport.h
+++ b/ports/esp32/mpconfigport.h
@@ -152,8 +152,8 @@
#define MICROPY_FATFS_RPATH (2)
#define MICROPY_FATFS_MAX_SS (4096)
#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_textio fatfs_type_textio
+#define mp_type_fileio mp_type_vfs_fat_fileio
+#define mp_type_textio mp_type_vfs_fat_textio
// use vfs's functions for import stat and builtin open
#define mp_import_stat mp_vfs_import_stat
diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h
index f29dbe5c0..ff45f86ae 100644
--- a/ports/esp8266/mpconfigport.h
+++ b/ports/esp8266/mpconfigport.h
@@ -141,8 +141,8 @@ typedef uint32_t sys_prot_t; // for modlwip
void *esp_native_code_commit(void*, size_t);
#define MP_PLAT_COMMIT_EXEC(buf, len) esp_native_code_commit(buf, len)
-#define mp_type_fileio fatfs_type_fileio
-#define mp_type_textio fatfs_type_textio
+#define mp_type_fileio mp_type_vfs_fat_fileio
+#define mp_type_textio mp_type_vfs_fat_textio
// use vfs's functions for import stat and builtin open
#define mp_import_stat mp_vfs_import_stat
diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h
index 7bd944213..ecb3596ff 100644
--- a/ports/stm32/mpconfigport.h
+++ b/ports/stm32/mpconfigport.h
@@ -161,8 +161,8 @@
#define MICROPY_FATFS_MULTI_PARTITION (1)
// TODO these should be generic, not bound to fatfs
-#define mp_type_fileio fatfs_type_fileio
-#define mp_type_textio fatfs_type_textio
+#define mp_type_fileio mp_type_vfs_fat_fileio
+#define mp_type_textio mp_type_vfs_fat_textio
// use vfs's functions for import stat and builtin open
#define mp_import_stat mp_vfs_import_stat