Skip to content

Commit b697c89

Browse files
committed
extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h.
vfs.h is for generic VFS declarations, and vfs_fat.h is for VfsFat specific things.
1 parent 9425bf5 commit b697c89

16 files changed

Lines changed: 42 additions & 76 deletions

File tree

cc3200/ftp/ftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "py/obj.h"
3333
#include "lib/oofatfs/ff.h"
3434
#include "extmod/vfs.h"
35-
#include "extmod/fsusermount.h"
35+
#include "extmod/vfs_fat.h"
3636
#include "inc/hw_types.h"
3737
#include "inc/hw_ints.h"
3838
#include "inc/hw_memmap.h"

cc3200/mods/pybflash.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "lib/oofatfs/ff.h"
3232
#include "lib/oofatfs/diskio.h"
3333
#include "extmod/vfs_fat.h"
34-
#include "extmod/fsusermount.h"
3534

3635
#include "fatfs/src/drivers/sflash_diskio.h"
3736
#include "mods/pybflash.h"

cc3200/mods/pybsd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "py/runtime.h"
3030
#include "lib/oofatfs/ff.h"
3131
#include "lib/oofatfs/diskio.h"
32-
#include "extmod/fsusermount.h"
32+
#include "extmod/vfs_fat.h"
3333
#include "inc/hw_types.h"
3434
#include "inc/hw_gpio.h"
3535
#include "inc/hw_ints.h"

cc3200/mptask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include "lib/oofatfs/ff.h"
3737
#include "lib/oofatfs/diskio.h"
3838
#include "extmod/vfs.h"
39-
#include "extmod/fsusermount.h"
39+
#include "extmod/vfs_fat.h"
4040
#include "inc/hw_memmap.h"
4141
#include "inc/hw_types.h"
4242
#include "inc/hw_ints.h"

extmod/fsusermount.h

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

extmod/vfs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
#include "py/objstr.h"
3232
#include "py/mperrno.h"
3333
#include "extmod/vfs.h"
34-
#include "extmod/vfs_fat.h"
3534

3635
#if MICROPY_VFS
3736

37+
#if MICROPY_VFS_FAT
38+
#include "extmod/vfs_fat.h"
39+
#endif
40+
3841
// path is the path to lookup and *path_out holds the path within the VFS
3942
// object (starts with / if an absolute path).
4043
// Returns MP_VFS_ROOT for root dir (and then path_out is undefined) and

extmod/vfs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
#define MP_VFS_NONE ((mp_vfs_mount_t*)1)
3636
#define MP_VFS_ROOT ((mp_vfs_mount_t*)0)
3737

38+
// constants for block protocol ioctl
39+
#define BP_IOCTL_INIT (1)
40+
#define BP_IOCTL_DEINIT (2)
41+
#define BP_IOCTL_SYNC (3)
42+
#define BP_IOCTL_SEC_COUNT (4)
43+
#define BP_IOCTL_SEC_SIZE (5)
44+
3845
typedef struct _mp_vfs_mount_t {
3946
const char *str; // mount point with leading /
4047
size_t len;

extmod/vfs_fat.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "py/mperrno.h"
3939
#include "lib/oofatfs/ff.h"
4040
#include "extmod/vfs_fat.h"
41-
#include "extmod/fsusermount.h"
4241
#include "timeutils.h"
4342

4443
#if _MAX_SS == _MIN_SS

extmod/vfs_fat.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,32 @@
2525
*/
2626

2727
#include "py/lexer.h"
28+
#include "py/obj.h"
29+
#include "lib/oofatfs/ff.h"
30+
#include "extmod/vfs.h"
2831

29-
struct _fs_user_mount_t;
32+
// these are the values for fs_user_mount_t.flags
33+
#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
34+
#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
35+
#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl
36+
37+
typedef struct _fs_user_mount_t {
38+
mp_obj_base_t base;
39+
const char *str;
40+
uint16_t len; // length of str
41+
uint16_t flags;
42+
mp_obj_t readblocks[4];
43+
mp_obj_t writeblocks[4];
44+
// new protocol uses just ioctl, old uses sync (optional) and count
45+
union {
46+
mp_obj_t ioctl[4];
47+
struct {
48+
mp_obj_t sync[2];
49+
mp_obj_t count[2];
50+
} old;
51+
} u;
52+
FATFS fatfs;
53+
} fs_user_mount_t;
3054

3155
extern const byte fresult_to_errno_table[20];
3256
extern const mp_obj_type_t mp_fat_vfs_type;

extmod/vfs_fat_diskio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "py/runtime.h"
3939
#include "lib/oofatfs/ff.h"
4040
#include "lib/oofatfs/diskio.h"
41-
#include "extmod/fsusermount.h"
41+
#include "extmod/vfs_fat.h"
4242

4343
#if _MAX_SS == _MIN_SS
4444
#define SECSIZE(fs) (_MIN_SS)

0 commit comments

Comments
 (0)