28 #include <sys/unistd.h> 35 #define FS_MAX_MOUNTS 2 42 #ifndef FS_MAX_FILENAME 43 #define FS_MAX_FILENAME 32 46 #define FS_RETURN_ERR(r__, e__) do { \ 60 int (*mount)(
struct fs_mount_s *mnt);
61 int (*unmount)(
struct fs_mount_s *mnt);
62 int (*open)(
struct _reent *r,
const char *path,
int flags,
int mode,
struct fs_fd_s *fd_out);
63 int (*close)(
struct _reent *r,
struct fs_fd_s *fd);
64 long (*write)(
struct _reent *r,
struct fs_fd_s *fd,
const char *ptr,
int len);
65 long (*read)(
struct _reent *r,
struct fs_fd_s *fd,
char *ptr,
int len);
66 _off_t (*lseek)(
struct _reent *r,
struct fs_fd_s *fd, _off_t pos,
int dir);
67 int (*sync)(
struct _reent *r,
struct fs_fd_s *fd);
68 int (*fstat)(
struct _reent *r,
struct fs_fd_s *fd,
struct stat *st);
69 int (*stat)(
struct _reent *r,
char *path,
struct stat *st);
70 int (*unlink)(
struct _reent *r,
char *path);
71 int (*opendir)(
struct fs_dir_s *out,
const char *path);
72 int (*readdir)(
struct fs_dir_s *dir,
struct fs_info_s *info);
73 int (*closedir)(
struct fs_dir_s *dir);
76 typedef struct fs_mount_s {
82 typedef struct fs_fd_s {
89 typedef struct fs_dir_s {
94 #define FS_ATTR_DIR 0x01 95 #define FS_ATTR_READONLY 0x02 96 #define FS_ATTR_HIDDEN 0x04 98 typedef struct fs_info_s {
100 char name[FS_MAX_FILENAME];
106 int fs_mount(
const char *mount, fs_dev_t *dev);
107 int fs_open(
struct _reent *r,
const char *path,
int flags,
int mode);
108 long fs_read(
struct _reent *r,
int fd,
void *buffer,
unsigned int count);
109 long fs_write(
struct _reent *r,
int fd,
const void *data,
unsigned int count);
110 int fs_close(
struct _reent *r,
int fd);
111 _off_t fs_lseek(
struct _reent *r,
int fd, _off_t pos,
int dir);
112 int fs_sync(
struct _reent *r,
int fd);
113 int fs_fstat(
struct _reent *r,
int fd,
struct stat *st);
114 int fs_stat(
struct _reent *r,
char *path,
struct stat *st);
115 int fs_unlink(
struct _reent *r,
char *path);
116 int fs_unmount(
const char *mount);
117 int fs_next_fd(
void);
119 int fs_opendir(fs_dir_t *out,
const char *path);
120 int fs_readdir(fs_dir_t *dir, fs_info_t *info);
121 int fs_closedir(fs_dir_t *dir);