Skip to content

Commit 638b860

Browse files
committed
extmod/vfs_fat: Merge remaining vfs_fat_misc.c code into vfs_fat.c.
The only function left in vfs_fat_misc.c is fat_vfs_import_stat() which can logically go into vfs_fat.c, allowing to remove vfs_fat_misc.c.
1 parent ae4a077 commit 638b860

3 files changed

Lines changed: 14 additions & 50 deletions

File tree

extmod/vfs_fat.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@
4747

4848
#define mp_obj_fat_vfs_t fs_user_mount_t
4949

50+
mp_import_stat_t fat_vfs_import_stat(fs_user_mount_t *vfs, const char *path) {
51+
FILINFO fno;
52+
assert(vfs != NULL);
53+
FRESULT res = f_stat(&vfs->fatfs, path, &fno);
54+
if (res == FR_OK) {
55+
if ((fno.fattrib & AM_DIR) != 0) {
56+
return MP_IMPORT_STAT_DIR;
57+
} else {
58+
return MP_IMPORT_STAT_FILE;
59+
}
60+
}
61+
return MP_IMPORT_STAT_NO_EXIST;
62+
}
63+
5064
STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
5165
mp_arg_check_num(n_args, n_kw, 1, 1, false);
5266

extmod/vfs_fat_misc.c

Lines changed: 0 additions & 49 deletions
This file was deleted.

py/py.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ PY_EXTMOD_O_BASENAME = \
244244
extmod/vfs_fat.o \
245245
extmod/vfs_fat_diskio.o \
246246
extmod/vfs_fat_file.o \
247-
extmod/vfs_fat_misc.o \
248247
extmod/utime_mphal.o \
249248
extmod/uos_dupterm.o \
250249
lib/embed/abort_.o \

0 commit comments

Comments
 (0)