Skip to content

Commit

Permalink
extmod: Merge old fsusermount.h header into vfs.h and vfs_fat.h.
Browse files Browse the repository at this point in the history
vfs.h is for generic VFS declarations, and vfs_fat.h is for VfsFat
specific things.
  • Loading branch information
dpgeorge committed Jan 30, 2017
1 parent 9425bf5 commit b697c89
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 76 deletions.
2 changes: 1 addition & 1 deletion cc3200/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "py/obj.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
Expand Down
1 change: 0 additions & 1 deletion cc3200/mods/pybflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
#include "extmod/vfs_fat.h"
#include "extmod/fsusermount.h"

#include "fatfs/src/drivers/sflash_diskio.h"
#include "mods/pybflash.h"
Expand Down
2 changes: 1 addition & 1 deletion cc3200/mods/pybsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
Expand Down
2 changes: 1 addition & 1 deletion cc3200/mptask.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
#include "extmod/vfs.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
Expand Down
62 changes: 0 additions & 62 deletions extmod/fsusermount.h

This file was deleted.

5 changes: 4 additions & 1 deletion extmod/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
#include "py/objstr.h"
#include "py/mperrno.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"

#if MICROPY_VFS

#if MICROPY_VFS_FAT
#include "extmod/vfs_fat.h"
#endif

// path is the path to lookup and *path_out holds the path within the VFS
// object (starts with / if an absolute path).
// Returns MP_VFS_ROOT for root dir (and then path_out is undefined) and
Expand Down
7 changes: 7 additions & 0 deletions extmod/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
#define MP_VFS_NONE ((mp_vfs_mount_t*)1)
#define MP_VFS_ROOT ((mp_vfs_mount_t*)0)

// constants for block protocol ioctl
#define BP_IOCTL_INIT (1)
#define BP_IOCTL_DEINIT (2)
#define BP_IOCTL_SYNC (3)
#define BP_IOCTL_SEC_COUNT (4)
#define BP_IOCTL_SEC_SIZE (5)

typedef struct _mp_vfs_mount_t {
const char *str; // mount point with leading /
size_t len;
Expand Down
1 change: 0 additions & 1 deletion extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "py/mperrno.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "extmod/fsusermount.h"
#include "timeutils.h"

#if _MAX_SS == _MIN_SS
Expand Down
26 changes: 25 additions & 1 deletion extmod/vfs_fat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,32 @@
*/

#include "py/lexer.h"
#include "py/obj.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs.h"

struct _fs_user_mount_t;
// these are the values for fs_user_mount_t.flags
#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl

typedef struct _fs_user_mount_t {
mp_obj_base_t base;
const char *str;
uint16_t len; // length of str
uint16_t flags;
mp_obj_t readblocks[4];
mp_obj_t writeblocks[4];
// new protocol uses just ioctl, old uses sync (optional) and count
union {
mp_obj_t ioctl[4];
struct {
mp_obj_t sync[2];
mp_obj_t count[2];
} old;
} u;
FATFS fatfs;
} fs_user_mount_t;

extern const byte fresult_to_errno_table[20];
extern const mp_obj_type_t mp_fat_vfs_type;
Expand Down
2 changes: 1 addition & 1 deletion extmod/vfs_fat_diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "lib/oofatfs/diskio.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"

#if _MAX_SS == _MIN_SS
#define SECSIZE(fs) (_MIN_SS)
Expand Down
1 change: 0 additions & 1 deletion extmod/vfs_fat_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "py/stream.h"
#include "py/mperrno.h"
#include "lib/oofatfs/ff.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"

#if MICROPY_VFS_FAT
Expand Down
1 change: 0 additions & 1 deletion extmod/vfs_fat_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "extmod/fsusermount.h"
#include "py/lexer.h"

// TODO: actually, the core function should be ilistdir()
Expand Down
2 changes: 1 addition & 1 deletion stmhal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "lib/utils/pyexec.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"

#include "systick.h"
#include "pendsv.h"
Expand Down
2 changes: 1 addition & 1 deletion stmhal/modmachine.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "lib/utils/pyexec.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs.h"
#include "extmod/fsusermount.h"
#include "extmod/vfs_fat.h"
#include "gccollect.h"
#include "irq.h"
#include "rng.h"
Expand Down
1 change: 0 additions & 1 deletion stmhal/sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "extmod/fsusermount.h"
#include "mphalport.h"

#include "sdcard.h"
Expand Down
1 change: 0 additions & 1 deletion stmhal/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "extmod/vfs_fat.h"
#include "extmod/fsusermount.h"

#include "systick.h"
#include "led.h"
Expand Down

0 comments on commit b697c89

Please sign in to comment.