00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00036 #ifndef LIBFS_LIBFS_H_
00037 #define LIBFS_LIBFS_H_
00038
00039 #include <ipc/vfs.h>
00040 #include <stdint.h>
00041 #include <async.h>
00042 #include <devmap.h>
00043
00044 typedef struct {
00045 bool mp_active;
00046 int phone;
00047 fs_handle_t fs_handle;
00048 devmap_handle_t devmap_handle;
00049 } mp_data_t;
00050
00051 typedef struct {
00052 mp_data_t mp_data;
00053 void *data;
00054 } fs_node_t;
00055
00056 typedef struct {
00057
00058
00059
00060
00061
00062 int (* root_get)(fs_node_t **, devmap_handle_t);
00063 int (* match)(fs_node_t **, fs_node_t *, const char *);
00064 int (* node_get)(fs_node_t **, devmap_handle_t, fs_index_t);
00065 int (* node_open)(fs_node_t *);
00066 int (* node_put)(fs_node_t *);
00067 int (* create)(fs_node_t **, devmap_handle_t, int);
00068 int (* destroy)(fs_node_t *);
00069 int (* link)(fs_node_t *, fs_node_t *, const char *);
00070 int (* unlink)(fs_node_t *, fs_node_t *, const char *);
00071 int (* has_children)(bool *, fs_node_t *);
00072
00073
00074
00075
00076 fs_index_t (* index_get)(fs_node_t *);
00077 aoff64_t (* size_get)(fs_node_t *);
00078 unsigned int (* lnkcnt_get)(fs_node_t *);
00079 char (* plb_get_char)(unsigned pos);
00080 bool (* is_directory)(fs_node_t *);
00081 bool (* is_file)(fs_node_t *);
00082 devmap_handle_t (* device_get)(fs_node_t *);
00083 } libfs_ops_t;
00084
00085 typedef struct {
00086 int fs_handle;
00087 uint8_t *plb_ro;
00088 } fs_reg_t;
00089
00090 extern int fs_register(int, fs_reg_t *, vfs_info_t *, async_client_conn_t);
00091
00092 extern void fs_node_initialize(fs_node_t *);
00093
00094 extern void libfs_mount(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
00095 extern void libfs_unmount(libfs_ops_t *, ipc_callid_t, ipc_call_t *);
00096 extern void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
00097 extern void libfs_stat(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *);
00098 extern void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t,
00099 ipc_call_t *);
00100
00101 #endif
00102