Changeset f2ec8c8 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2008-03-11T20:33:53Z (16 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r8ad8e49 rf2ec8c8  
    7171/* Forward declarations of static functions. */
    7272static bool tmpfs_match(void *, void *, const char *);
    73 static void *tmpfs_node_get(int, int, unsigned long);
     73static void *tmpfs_node_get(fs_handle_t, dev_handle_t, fs_index_t);
    7474static void *tmpfs_create_node(int);
    7575static bool tmpfs_link_node(void *, void *, const char *);
     
    7878
    7979/* Implementation of helper functions. */
    80 static unsigned long tmpfs_index_get(void *nodep)
     80static fs_index_t tmpfs_index_get(void *nodep)
    8181{
    8282        return ((tmpfs_dentry_t *) nodep)->index;
    8383}
    8484
    85 static unsigned long tmpfs_size_get(void *nodep)
     85static size_t tmpfs_size_get(void *nodep)
    8686{
    8787        return ((tmpfs_dentry_t *) nodep)->size;
     
    170170};
    171171
    172 unsigned tmpfs_next_index = 1;
     172fs_index_t tmpfs_next_index = 1;
    173173
    174174typedef struct {
     
    263263}
    264264
    265 void *tmpfs_node_get(int fs_handle, int dev_handle, unsigned long index)
    266 {
    267         link_t *lnk = hash_table_find(&dentries, &index);
     265void *
     266tmpfs_node_get(fs_handle_t fs_handle, dev_handle_t dev_handle, fs_index_t index)
     267{
     268        unsigned long key = index;
     269        link_t *lnk = hash_table_find(&dentries, &key);
    268270        if (!lnk)
    269271                return NULL;
     
    290292
    291293        /* Insert the new node into the dentry hash table. */
    292         hash_table_insert(&dentries, &node->index, &node->dh_link);
     294        unsigned long key = node->index;
     295        hash_table_insert(&dentries, &key, &node->dh_link);
    293296        return (void *) node;
    294297}
     
    370373        assert(!dentry->sibling);
    371374
    372         unsigned long index = dentry->index;
    373         hash_table_remove(&dentries, &index, 1);
     375        unsigned long key = dentry->index;
     376        hash_table_remove(&dentries, &key, 1);
    374377
    375378        hash_table_destroy(&dentry->names);
     
    392395void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
    393396{
    394         int dev_handle = IPC_GET_ARG1(*request);
    395         unsigned long index = IPC_GET_ARG2(*request);
    396         off_t pos = IPC_GET_ARG3(*request);
     397        dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
     398        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
     399        off_t pos = (off_t)IPC_GET_ARG3(*request);
    397400
    398401        /*
     
    400403         */
    401404        link_t *hlp;
    402         hlp = hash_table_find(&dentries, &index);
     405        unsigned long key = index;
     406        hlp = hash_table_find(&dentries, &key);
    403407        if (!hlp) {
    404408                ipc_answer_0(rid, ENOENT);
     
    464468void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
    465469{
    466         int dev_handle = IPC_GET_ARG1(*request);
    467         unsigned long index = IPC_GET_ARG2(*request);
    468         off_t pos = IPC_GET_ARG3(*request);
     470        dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
     471        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
     472        off_t pos = (off_t)IPC_GET_ARG3(*request);
    469473
    470474        /*
     
    472476         */
    473477        link_t *hlp;
    474         hlp = hash_table_find(&dentries, &index);
     478        unsigned long key = index;
     479        hlp = hash_table_find(&dentries, &key);
    475480        if (!hlp) {
    476481                ipc_answer_0(rid, ENOENT);
     
    524529void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    525530{
    526         int dev_handle = IPC_GET_ARG1(*request);
    527         unsigned long index = IPC_GET_ARG2(*request);
    528         size_t size = IPC_GET_ARG3(*request);
     531        dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
     532        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
     533        size_t size = (off_t)IPC_GET_ARG3(*request);
    529534
    530535        /*
     
    532537         */
    533538        link_t *hlp;
    534         hlp = hash_table_find(&dentries, &index);
     539        unsigned long key = index;
     540        hlp = hash_table_find(&dentries, &key);
    535541        if (!hlp) {
    536542                ipc_answer_0(rid, ENOENT);
     
    561567void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
    562568{
    563         int dev_handle = IPC_GET_ARG1(*request);
    564         unsigned long index = IPC_GET_ARG2(*request);
     569        dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
     570        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    565571
    566572        link_t *hlp;
    567         hlp = hash_table_find(&dentries, &index);
     573        unsigned long key = index;
     574        hlp = hash_table_find(&dentries, &key);
    568575        if (!hlp) {
    569576                ipc_answer_0(rid, ENOENT);
Note: See TracChangeset for help on using the changeset viewer.