/trunk/uspace/srv/vfs/vfs_ops.c |
---|
53,7 → 53,7 |
#include <vfs/canonify.h> |
/* Forward declarations of static functions. */ |
static int vfs_truncate_internal(int, int, unsigned long, size_t); |
static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t); |
/** |
* This rwlock prevents the race between a triplet-to-VFS-node resolution and a |
68,7 → 68,9 |
.index = 0, |
}; |
static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result) |
static int |
lookup_root(fs_handle_t fs_handle, dev_handle_t dev_handle, |
vfs_lookup_res_t *result) |
{ |
vfs_pair_t altroot = { |
.fs_handle = fs_handle, |
80,7 → 82,7 |
void vfs_mount(ipc_callid_t rid, ipc_call_t *request) |
{ |
int dev_handle; |
dev_handle_t dev_handle; |
vfs_node_t *mp_node = NULL; |
/* |
88,7 → 90,7 |
* translation for us, thus the device handle will arrive as ARG1 |
* in the request. |
*/ |
dev_handle = IPC_GET_ARG1(*request); |
dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); |
/* |
* For now, don't make use of ARG2 and ARG3, but they can be used to |
127,7 → 129,7 |
* Check if we know a file system with the same name as is in fs_name. |
* This will also give us its file system handle. |
*/ |
int fs_handle = fs_name_to_handle(fs_name, true); |
fs_handle_t fs_handle = fs_name_to_handle(fs_name, true); |
if (!fs_handle) { |
ipc_answer_0(rid, ENOENT); |
return; |
571,8 → 573,9 |
ipc_answer_0(rid, EINVAL); |
} |
int vfs_truncate_internal(int fs_handle, int dev_handle, unsigned long index, |
size_t size) |
int |
vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle, |
fs_index_t index, size_t size) |
{ |
ipcarg_t rc; |
int fs_phone; |
/trunk/uspace/srv/vfs/vfs_register.c |
---|
294,7 → 294,7 |
* In reply to the VFS_REGISTER request, we assign the client file |
* system a global file system handle. |
*/ |
fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); |
fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next); |
ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); |
fibril_dec_sercount(); |
311,7 → 311,7 |
* @return Phone over which a multi-call request can be safely |
* sent. Return 0 if no phone was found. |
*/ |
int vfs_grab_phone(int handle) |
int vfs_grab_phone(fs_handle_t handle) |
{ |
/* |
* For now, we don't try to be very clever and very fast. |
386,7 → 386,7 |
* |
* @return File system handle or zero if file system not found. |
*/ |
int fs_name_to_handle(char *name, bool lock) |
fs_handle_t fs_name_to_handle(char *name, bool lock) |
{ |
int handle = 0; |
/trunk/uspace/srv/vfs/vfs.h |
---|
46,6 → 46,11 |
#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) |
/* Basic types. */ |
typedef int16_t fs_handle_t; |
typedef int16_t dev_handle_t; |
typedef uint32_t fs_index_t; |
typedef enum { |
VFS_READ = VFS_FIRST, |
VFS_WRITE, |
106,7 → 111,7 |
typedef struct { |
link_t fs_link; |
vfs_info_t vfs_info; |
int fs_handle; |
fs_handle_t fs_handle; |
futex_t phone_futex; /**< Phone serializing futex. */ |
ipcarg_t phone; |
} fs_info_t; |
114,9 → 119,9 |
/** |
* VFS_PAIR uniquely represents a file system instance. |
*/ |
#define VFS_PAIR \ |
int fs_handle; \ |
int dev_handle; |
#define VFS_PAIR \ |
fs_handle_t fs_handle; \ |
dev_handle_t dev_handle; |
/** |
* VFS_TRIPLET uniquely identifies a file system node (e.g. directory, file) but |
127,7 → 132,7 |
*/ |
#define VFS_TRIPLET \ |
VFS_PAIR; \ |
uint64_t index; |
fs_index_t index; |
typedef struct { |
VFS_PAIR; |
256,10 → 261,10 |
/** Holding this rwlock prevents changes in file system namespace. */ |
extern rwlock_t namespace_rwlock; |
extern int vfs_grab_phone(int); |
extern int vfs_grab_phone(fs_handle_t); |
extern void vfs_release_phone(int); |
extern int fs_name_to_handle(char *, bool); |
extern fs_handle_t fs_name_to_handle(char *, bool); |
extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *, |
...); |
/trunk/uspace/srv/vfs/vfs_lookup.c |
---|
82,12 → 82,12 |
if (!path) |
return EINVAL; |
uint64_t index = 0; |
fs_index_t index = 0; |
if (lflag & L_LINK) { |
va_list ap; |
va_start(ap, altroot); |
index = va_arg(ap, uint64_t); |
index = va_arg(ap, fs_index_t); |
va_end(ap); |
} |
177,9 → 177,9 |
futex_up(&plb_futex); |
if ((rc == EOK) && result) { |
result->triplet.fs_handle = (int) IPC_GET_ARG1(answer); |
result->triplet.dev_handle = (int) IPC_GET_ARG2(answer); |
result->triplet.index = (uint64_t) IPC_GET_ARG3(answer); |
result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer); |
result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG2(answer); |
result->triplet.index = (fs_index_t) IPC_GET_ARG3(answer); |
result->size = (size_t) IPC_GET_ARG4(answer); |
result->lnkcnt = (unsigned) IPC_GET_ARG5(answer); |
} |