Changeset f2ec8c8 in mainline for uspace/srv/vfs


Ignore:
Timestamp:
2008-03-11T20:33:53Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
923c39e
Parents:
8ad8e49
Message:

Introduce fs_handle_t, dev_handle_t and fs_index_t.

Location:
uspace/srv/vfs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    r8ad8e49 rf2ec8c8  
    4747#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST)       
    4848
     49/* Basic types. */
     50typedef int16_t fs_handle_t;
     51typedef int16_t dev_handle_t;
     52typedef uint32_t fs_index_t;
     53
    4954typedef enum {
    5055        VFS_READ = VFS_FIRST,
     
    107112        link_t fs_link;
    108113        vfs_info_t vfs_info;
    109         int fs_handle;
     114        fs_handle_t fs_handle;
    110115        futex_t phone_futex;    /**< Phone serializing futex. */
    111116        ipcarg_t phone;
     
    115120 * VFS_PAIR uniquely represents a file system instance.
    116121 */
    117 #define VFS_PAIR        \
    118         int fs_handle;  \
    119         int dev_handle;
     122#define VFS_PAIR                \
     123        fs_handle_t fs_handle;  \
     124        dev_handle_t dev_handle;
    120125
    121126/**
     
    128133#define VFS_TRIPLET     \
    129134        VFS_PAIR;       \
    130         uint64_t index;
     135        fs_index_t index;
    131136
    132137typedef struct {
     
    257262extern rwlock_t namespace_rwlock;
    258263
    259 extern int vfs_grab_phone(int);
     264extern int vfs_grab_phone(fs_handle_t);
    260265extern void vfs_release_phone(int);
    261266
    262 extern int fs_name_to_handle(char *, bool);
     267extern fs_handle_t fs_name_to_handle(char *, bool);
    263268
    264269extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *,
  • uspace/srv/vfs/vfs_lookup.c

    r8ad8e49 rf2ec8c8  
    8383                return EINVAL;
    8484       
    85         uint64_t index = 0;
     85        fs_index_t index = 0;
    8686        if (lflag & L_LINK) {
    8787                va_list ap;
    8888
    8989                va_start(ap, altroot);
    90                 index = va_arg(ap, uint64_t);
     90                index = va_arg(ap, fs_index_t);
    9191                va_end(ap);
    9292        }
     
    178178
    179179        if ((rc == EOK) && result) {
    180                 result->triplet.fs_handle = (int) IPC_GET_ARG1(answer);
    181                 result->triplet.dev_handle = (int) IPC_GET_ARG2(answer);
    182                 result->triplet.index = (uint64_t) IPC_GET_ARG3(answer);
     180                result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer);
     181                result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG2(answer);
     182                result->triplet.index = (fs_index_t) IPC_GET_ARG3(answer);
    183183                result->size = (size_t) IPC_GET_ARG4(answer);
    184184                result->lnkcnt = (unsigned) IPC_GET_ARG5(answer);
  • uspace/srv/vfs/vfs_ops.c

    r8ad8e49 rf2ec8c8  
    5454
    5555/* Forward declarations of static functions. */
    56 static int vfs_truncate_internal(int, int, unsigned long, size_t);
     56static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t);
    5757
    5858/**
     
    6969};
    7070
    71 static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result)
     71static int
     72lookup_root(fs_handle_t fs_handle, dev_handle_t dev_handle,
     73    vfs_lookup_res_t *result)
    7274{
    7375        vfs_pair_t altroot = {
     
    8183void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
    8284{
    83         int dev_handle;
     85        dev_handle_t dev_handle;
    8486        vfs_node_t *mp_node = NULL;
    8587
     
    8991         * in the request.
    9092         */
    91         dev_handle = IPC_GET_ARG1(*request);
     93        dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
    9294
    9395        /*
     
    128130         * This will also give us its file system handle.
    129131         */
    130         int fs_handle = fs_name_to_handle(fs_name, true);
     132        fs_handle_t fs_handle = fs_name_to_handle(fs_name, true);
    131133        if (!fs_handle) {
    132134                ipc_answer_0(rid, ENOENT);
     
    572574}
    573575
    574 int vfs_truncate_internal(int fs_handle, int dev_handle, unsigned long index,
    575     size_t size)
     576int
     577vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle,
     578    fs_index_t index, size_t size)
    576579{
    577580        ipcarg_t rc;
  • uspace/srv/vfs/vfs_register.c

    r8ad8e49 rf2ec8c8  
    295295         * system a global file system handle.
    296296         */
    297         fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next);
     297        fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
    298298        ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);
    299299       
     
    312312 *                      sent. Return 0 if no phone was found.
    313313 */
    314 int vfs_grab_phone(int handle)
     314int vfs_grab_phone(fs_handle_t handle)
    315315{
    316316        /*
     
    387387 * @return              File system handle or zero if file system not found.
    388388 */
    389 int fs_name_to_handle(char *name, bool lock)
     389fs_handle_t fs_name_to_handle(char *name, bool lock)
    390390{
    391391        int handle = 0;
Note: See TracChangeset for help on using the changeset viewer.