Skip to content

Commit 0bd61d2

Browse files
committed
extmod/vfs_fat: Remove MICROPY_FATFS_OO config option.
Everyone should now be using the new ooFatFs library. The old one is no longer supported and will be removed.
1 parent 95635ad commit 0bd61d2

8 files changed

Lines changed: 2 additions & 80 deletions

File tree

cc3200/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#define MICROPY_QSTR_BYTES_IN_HASH (1)
6565

6666
// fatfs configuration used in ffconf.h
67-
#define MICROPY_FATFS_OO (1)
6867
#define MICROPY_FATFS_ENABLE_LFN (2)
6968
#define MICROPY_FATFS_MAX_LFN (MICROPY_ALLOC_PATH_MAX)
7069
#define MICROPY_FATFS_LFN_CODE_PAGE (437) // 1=SFN/ANSI 437=LFN/U.S.(OEM)

esp8266/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
9696

9797
#define MICROPY_VFS (1)
98-
#define MICROPY_FATFS_OO (1)
9998
#define MICROPY_FATFS_ENABLE_LFN (1)
10099
#define MICROPY_FATFS_RPATH (2)
101100
#define MICROPY_FATFS_MAX_SS (4096)

extmod/vfs_fat.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
#error "with MICROPY_VFS_FAT enabled, must also enable MICROPY_VFS"
3333
#endif
3434

35-
#if !MICROPY_FATFS_OO
36-
#error "with MICROPY_VFS_FAT enabled, must also enable MICROPY_FATFS_OO"
37-
#endif
38-
3935
#include <string.h>
4036
#include "py/nlr.h"
4137
#include "py/runtime.h"

extmod/vfs_fat_diskio.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@
3636
#include "py/mphal.h"
3737

3838
#include "py/runtime.h"
39-
#if MICROPY_FATFS_OO
4039
#include "lib/oofatfs/ff.h"
4140
#include "lib/oofatfs/diskio.h"
42-
#else
43-
#include "lib/fatfs/ff.h" /* FatFs lower layer API */
44-
#include "lib/fatfs/diskio.h" /* FatFs lower layer API */
45-
#endif
4641
#include "extmod/fsusermount.h"
4742

4843
#if _MAX_SS == _MIN_SS
@@ -51,29 +46,16 @@
5146
#define SECSIZE(fs) ((fs)->ssize)
5247
#endif
5348

54-
#if MICROPY_FATFS_OO
5549
typedef void *bdev_t;
5650
STATIC fs_user_mount_t *disk_get_device(void *bdev) {
5751
return (fs_user_mount_t*)bdev;
5852
}
59-
#else
60-
typedef BYTE bdev_t;
61-
STATIC fs_user_mount_t *disk_get_device(uint id) {
62-
if (id < MP_ARRAY_SIZE(MP_STATE_PORT(fs_user_mount))) {
63-
return MP_STATE_PORT(fs_user_mount)[id];
64-
} else {
65-
return NULL;
66-
}
67-
}
68-
#endif
6953

7054
/*-----------------------------------------------------------------------*/
7155
/* Initialize a Drive */
7256
/*-----------------------------------------------------------------------*/
7357

74-
#if MICROPY_FATFS_OO
7558
STATIC
76-
#endif
7759
DSTATUS disk_initialize (
7860
bdev_t pdrv /* Physical drive nmuber (0..) */
7961
)
@@ -105,9 +87,7 @@ DSTATUS disk_initialize (
10587
/* Get Disk Status */
10688
/*-----------------------------------------------------------------------*/
10789

108-
#if MICROPY_FATFS_OO
10990
STATIC
110-
#endif
11191
DSTATUS disk_status (
11292
bdev_t pdrv /* Physical drive nmuber (0..) */
11393
)
@@ -159,7 +139,6 @@ DRESULT disk_read (
159139
/* Write Sector(s) */
160140
/*-----------------------------------------------------------------------*/
161141

162-
#if MICROPY_FATFS_OO || _USE_WRITE
163142
DRESULT disk_write (
164143
bdev_t pdrv, /* Physical drive nmuber (0..) */
165144
const BYTE *buff, /* Data to be written */
@@ -191,14 +170,12 @@ DRESULT disk_write (
191170

192171
return RES_OK;
193172
}
194-
#endif
195173

196174

197175
/*-----------------------------------------------------------------------*/
198176
/* Miscellaneous Functions */
199177
/*-----------------------------------------------------------------------*/
200178

201-
#if MICROPY_FATFS_OO || _USE_IOCTL
202179
DRESULT disk_ioctl (
203180
bdev_t pdrv, /* Physical drive nmuber (0..) */
204181
BYTE cmd, /* Control code */
@@ -237,7 +214,7 @@ DRESULT disk_ioctl (
237214
} else {
238215
*((WORD*)buff) = mp_obj_get_int(ret);
239216
}
240-
#if MICROPY_FATFS_OO && _MAX_SS != _MIN_SS
217+
#if _MAX_SS != _MIN_SS
241218
// need to store ssize because we use it in disk_read/disk_write
242219
vfs->fatfs.ssize = *((WORD*)buff);
243220
#endif
@@ -248,15 +225,13 @@ DRESULT disk_ioctl (
248225
*((DWORD*)buff) = 1; // erase block size in units of sector size
249226
return RES_OK;
250227

251-
#if MICROPY_FATFS_OO
252228
case IOCTL_INIT:
253229
*((DSTATUS*)buff) = disk_initialize(pdrv);
254230
return RES_OK;
255231

256232
case IOCTL_STATUS:
257233
*((DSTATUS*)buff) = disk_status(pdrv);
258234
return RES_OK;
259-
#endif
260235

261236
default:
262237
return RES_PARERR;
@@ -278,7 +253,7 @@ DRESULT disk_ioctl (
278253

279254
case GET_SECTOR_SIZE:
280255
*((WORD*)buff) = 512; // old protocol had fixed sector size
281-
#if MICROPY_FATFS_OO && _MAX_SS != _MIN_SS
256+
#if _MAX_SS != _MIN_SS
282257
// need to store ssize because we use it in disk_read/disk_write
283258
vfs->fatfs.ssize = 512;
284259
#endif
@@ -288,21 +263,18 @@ DRESULT disk_ioctl (
288263
*((DWORD*)buff) = 1; // erase block size in units of sector size
289264
return RES_OK;
290265

291-
#if MICROPY_FATFS_OO
292266
case IOCTL_INIT:
293267
*((DSTATUS*)buff) = disk_initialize(pdrv);
294268
return RES_OK;
295269

296270
case IOCTL_STATUS:
297271
*((DSTATUS*)buff) = disk_status(pdrv);
298272
return RES_OK;
299-
#endif
300273

301274
default:
302275
return RES_PARERR;
303276
}
304277
}
305278
}
306-
#endif
307279

308280
#endif // MICROPY_VFS

extmod/vfs_fat_file.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@
3434
#include "py/runtime.h"
3535
#include "py/stream.h"
3636
#include "py/mperrno.h"
37-
#if MICROPY_FATFS_OO
3837
#include "lib/oofatfs/ff.h"
39-
#else
40-
#include "lib/fatfs/ff.h"
41-
#endif
4238
#include "extmod/fsusermount.h"
4339
#include "extmod/vfs_fat.h"
4440

@@ -115,11 +111,7 @@ STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t siz
115111
STATIC mp_obj_t file_obj_close(mp_obj_t self_in) {
116112
pyb_file_obj_t *self = MP_OBJ_TO_PTR(self_in);
117113
// if fs==NULL then the file is closed and in that case this method is a no-op
118-
#if MICROPY_FATFS_OO
119114
if (self->fp.obj.fs != NULL) {
120-
#else
121-
if (self->fp.fs != NULL) {
122-
#endif
123115
FRESULT res = f_close(&self->fp);
124116
if (res != FR_OK) {
125117
mp_raise_OSError(fresult_to_errno_table[res]);
@@ -221,13 +213,8 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
221213
o->base.type = type;
222214

223215
const char *fname = mp_obj_str_get_str(args[0].u_obj);
224-
#if MICROPY_FATFS_OO
225216
assert(vfs != NULL);
226217
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
227-
#else
228-
(void)vfs;
229-
FRESULT res = f_open(&o->fp, fname, mode);
230-
#endif
231218
if (res != FR_OK) {
232219
m_del_obj(pyb_file_obj_t, o);
233220
mp_raise_OSError(fresult_to_errno_table[res]);

extmod/vfs_fat_misc.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,11 @@
3030
#include <string.h>
3131
#include "py/nlr.h"
3232
#include "py/runtime.h"
33-
#if MICROPY_FATFS_OO
3433
#include "lib/oofatfs/ff.h"
35-
#else
36-
#include "lib/fatfs/ff.h"
37-
#endif
3834
#include "extmod/vfs_fat.h"
3935
#include "extmod/fsusermount.h"
4036
#include "py/lexer.h"
4137

42-
#if !MICROPY_FATFS_OO && _USE_LFN
43-
STATIC char lfn[_MAX_LFN + 1]; /* Buffer to store the LFN */
44-
#endif
45-
4638
// TODO: actually, the core function should be ilistdir()
4739

4840
mp_obj_t fat_vfs_listdir(const char *path, bool is_str_type) {
@@ -53,16 +45,8 @@ mp_obj_t fat_vfs_listdir2(fs_user_mount_t *vfs, const char *path, bool is_str_ty
5345
FRESULT res;
5446
FILINFO fno;
5547
FF_DIR dir;
56-
#if !MICROPY_FATFS_OO && _USE_LFN
57-
fno.lfname = lfn;
58-
fno.lfsize = sizeof lfn;
59-
#endif
6048

61-
#if MICROPY_FATFS_OO
6249
res = f_opendir(&vfs->fatfs, &dir, path);
63-
#else
64-
res = f_opendir(&dir, path); /* Open the directory */
65-
#endif
6650
if (res != FR_OK) {
6751
mp_raise_OSError(fresult_to_errno_table[res]);
6852
}
@@ -75,11 +59,7 @@ mp_obj_t fat_vfs_listdir2(fs_user_mount_t *vfs, const char *path, bool is_str_ty
7559
if (fno.fname[0] == '.' && fno.fname[1] == 0) continue; /* Ignore . entry */
7660
if (fno.fname[0] == '.' && fno.fname[1] == '.' && fno.fname[2] == 0) continue; /* Ignore .. entry */
7761

78-
#if !MICROPY_FATFS_OO && _USE_LFN
79-
char *fn = *fno.lfname ? fno.lfname : fno.fname;
80-
#else
8162
char *fn = fno.fname;
82-
#endif
8363

8464
/*
8565
if (fno.fattrib & AM_DIR) {
@@ -108,17 +88,8 @@ mp_obj_t fat_vfs_listdir2(fs_user_mount_t *vfs, const char *path, bool is_str_ty
10888

10989
mp_import_stat_t fat_vfs_import_stat(fs_user_mount_t *vfs, const char *path) {
11090
FILINFO fno;
111-
#if !MICROPY_FATFS_OO && _USE_LFN
112-
fno.lfname = NULL;
113-
fno.lfsize = 0;
114-
#endif
115-
#if MICROPY_FATFS_OO
11691
assert(vfs != NULL);
11792
FRESULT res = f_stat(&vfs->fatfs, path, &fno);
118-
#else
119-
(void)vfs;
120-
FRESULT res = f_stat(path, &fno);
121-
#endif
12293
if (res == FR_OK) {
12394
if ((fno.fattrib & AM_DIR) != 0) {
12495
return MP_IMPORT_STAT_DIR;

stmhal/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
#endif
136136

137137
// fatfs configuration used in ffconf.h
138-
#define MICROPY_FATFS_OO (1)
139138
#define MICROPY_FATFS_ENABLE_LFN (1)
140139
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
141140
#define MICROPY_FATFS_USE_LABEL (1)

unix/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
#define MICROPY_MACHINE_MEM_GET_READ_ADDR mod_machine_mem_get_addr
132132
#define MICROPY_MACHINE_MEM_GET_WRITE_ADDR mod_machine_mem_get_addr
133133

134-
#define MICROPY_FATFS_OO (1)
135134
#define MICROPY_FATFS_ENABLE_LFN (1)
136135
#define MICROPY_FATFS_RPATH (2)
137136
#define MICROPY_FATFS_MAX_SS (4096)

0 commit comments

Comments
 (0)