/trunk/uspace/lib/libfs/libfs.c |
---|
42,6 → 42,7 |
#include <as.h> |
#include <assert.h> |
#include <dirent.h> |
#include <mem.h> |
/** Register file system server. |
* |
208,12 → 209,13 |
* The path passed in the PLB must be in the canonical file system path format |
* as returned by the canonify() function. |
* |
* @param ops libfs operations structure with function pointers to |
* file system implementation |
* @param fs_handle File system handle of the file system where to perform |
* the lookup. |
* @param rid Request ID of the VFS_LOOKUP request. |
* @param request VFS_LOOKUP request data itself. |
* @param ops libfs operations structure with function pointers to |
* file system implementation |
* @param fs_handle File system handle of the file system where to perform |
* the lookup. |
* @param rid Request ID of the VFS_LOOKUP request. |
* @param request VFS_LOOKUP request data itself. |
* |
*/ |
void libfs_lookup(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid, |
ipc_call_t *request) |
426,5 → 428,32 |
ops->node_put(tmp); |
} |
/** Open VFS triplet. |
* |
* @param ops libfs operations structure with function pointers to |
* file system implementation |
* @param rid Request ID of the VFS_OPEN_NODE request. |
* @param request VFS_OPEN_NODE request data itself. |
* |
*/ |
void libfs_open_node(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid, |
ipc_call_t *request) |
{ |
dev_handle_t dev_handle = IPC_GET_ARG1(*request); |
fs_index_t index = IPC_GET_ARG2(*request); |
fs_node_t *node = ops->node_get(dev_handle, index); |
if (node == NULL) { |
ipc_answer_0(rid, ENOENT); |
return; |
} |
ipc_answer_5(rid, EOK, fs_handle, dev_handle, index, |
ops->size_get(node), ops->lnkcnt_get(node)); |
ops->node_put(node); |
} |
/** @} |
*/ |
/trunk/uspace/lib/libfs/libfs.h |
---|
26,20 → 26,21 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup libfs |
/** @addtogroup libfs |
* @{ |
*/ |
*/ |
/** |
* @file |
*/ |
#ifndef LIBFS_LIBFS_H_ |
#define LIBFS_LIBFS_H_ |
#define LIBFS_LIBFS_H_ |
#include "../../srv/vfs/vfs.h" |
#include <ipc/vfs.h> |
#include <stdint.h> |
#include <ipc/ipc.h> |
#include <async.h> |
#include <devmap.h> |
typedef struct { |
bool mp_active; |
49,8 → 50,8 |
} mp_data_t; |
typedef struct { |
mp_data_t mp_data; /**< Mount point info. */ |
void *data; /**< Data of the file system implementation. */ |
mp_data_t mp_data; /**< Mount point info. */ |
void *data; /**< Data of the file system implementation. */ |
} fs_node_t; |
typedef struct { |
66,15 → 67,15 |
unsigned (* lnkcnt_get)(fs_node_t *); |
bool (* has_children)(fs_node_t *); |
fs_node_t *(* root_get)(dev_handle_t); |
char (* plb_get_char)(unsigned pos); |
char (* plb_get_char)(unsigned pos); |
bool (* is_directory)(fs_node_t *); |
bool (* is_file)(fs_node_t *); |
} libfs_ops_t; |
typedef struct { |
int fs_handle; /**< File system handle. */ |
ipcarg_t vfs_phonehash; /**< Initial VFS phonehash. */ |
uint8_t *plb_ro; /**< Read-only PLB view. */ |
int fs_handle; /**< File system handle. */ |
ipcarg_t vfs_phonehash; /**< Initial VFS phonehash. */ |
uint8_t *plb_ro; /**< Read-only PLB view. */ |
} fs_reg_t; |
extern int fs_register(int, fs_reg_t *, vfs_info_t *, async_client_conn_t); |
83,9 → 84,10 |
extern void libfs_mount(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *); |
extern void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *); |
extern void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_callid_t, |
ipc_call_t *); |
#endif |
/** @} |
*/ |