40,12 → 40,13 |
#include <sys/types.h> |
#include <bool.h> |
|
#define dprintf(...) printf(__VA_ARGS__) |
// FIXME: according to CONFIG_DEBUG |
// #define dprintf(...) printf(__VA_ARGS__) |
|
#define dprintf(...) |
|
#define VFS_FIRST IPC_FIRST_USER_METHOD |
|
#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) |
|
/* Basic types. */ |
typedef int16_t fs_handle_t; |
typedef int16_t dev_handle_t; |
62,6 → 63,7 |
|
typedef enum { |
VFS_LOOKUP = VFS_LAST_CMN, |
VFS_MOUNTED, |
VFS_DESTROY, |
VFS_LAST_CLNT, /* keep this the last member of this enum */ |
} vfs_request_clnt_t; |
77,32 → 79,16 |
VFS_LAST_SRV, /* keep this the last member of this enum */ |
} vfs_request_srv_t; |
|
|
/** |
* An instance of this structure is associated with a particular FS operation. |
* It tells VFS if the FS supports the operation or maybe if a default one |
* should be used. |
*/ |
typedef enum { |
VFS_OP_NULL = 0, |
VFS_OP_DEFAULT, |
VFS_OP_DEFINED |
} vfs_op_t; |
|
#define FS_NAME_MAXLEN 20 |
|
/** |
* A structure like this is passed to VFS by each individual FS upon its |
* registration. It assosiates a human-readable identifier with each |
* registered FS. More importantly, through this structure, the FS announces |
* what operations it supports. |
* registered FS. |
*/ |
typedef struct { |
/** Unique identifier of the fs. */ |
char name[FS_NAME_MAXLEN + 1]; |
|
/** Operations. */ |
vfs_op_t ops[VFS_LAST_CLNT - VFS_FIRST]; |
} vfs_info_t; |
|
/** |
186,8 → 172,15 |
*/ |
#define L_PARENT 64 |
|
typedef enum vfs_node_type { |
VFS_NODE_UNKNOWN, |
VFS_NODE_FILE, |
VFS_NODE_DIRECTORY, |
} vfs_node_type_t; |
|
typedef struct { |
vfs_triplet_t triplet; |
vfs_node_type_t type; |
size_t size; |
unsigned lnkcnt; |
} vfs_lookup_res_t; |
209,6 → 202,9 |
unsigned lnkcnt; |
|
link_t nh_link; /**< Node hash-table link. */ |
|
vfs_node_type_t type; /**< Partial info about the node type. */ |
|
size_t size; /**< Cached size if the node is a file. */ |
|
/** |
241,7 → 237,7 |
|
extern link_t fs_head; /**< List of registered file systems. */ |
|
extern vfs_triplet_t rootfs; /**< Root node of the root file system. */ |
extern vfs_pair_t rootfs; /**< Root file system. */ |
|
#define MAX_PATH_LEN (64 * 1024) |
|
278,7 → 274,7 |
extern bool vfs_files_init(void); |
extern vfs_file_t *vfs_file_get(int); |
extern int vfs_fd_alloc(void); |
extern void vfs_fd_free(int); |
extern int vfs_fd_free(int); |
|
extern void vfs_file_addref(vfs_file_t *); |
extern void vfs_file_delref(vfs_file_t *); |
286,6 → 282,7 |
extern void vfs_node_addref(vfs_node_t *); |
extern void vfs_node_delref(vfs_node_t *); |
|
extern void vfs_process_pending_mount(void); |
extern void vfs_register(ipc_callid_t, ipc_call_t *); |
extern void vfs_mount(ipc_callid_t, ipc_call_t *); |
extern void vfs_open(ipc_callid_t, ipc_call_t *); |