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


Ignore:
Timestamp:
2010-11-18T18:23:43Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3f0a7971, a7811f17, cb569e6
Parents:
51a268f (diff), c63e70c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge changes that aim to do a better job in differentiating between
dev_handle_t and device_handle_t, respectively, by renaming these types to
devmap_handle_t and devman_handle_t, respectively.

File:
1 edited

Legend:

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

    r51a268f r45f04f8  
    7070/* Forward declarations of static functions. */
    7171static int tmpfs_match(fs_node_t **, fs_node_t *, const char *);
    72 static int tmpfs_node_get(fs_node_t **, dev_handle_t, fs_index_t);
     72static int tmpfs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
    7373static int tmpfs_node_open(fs_node_t *);
    7474static int tmpfs_node_put(fs_node_t *);
    75 static int tmpfs_create_node(fs_node_t **, dev_handle_t, int);
     75static int tmpfs_create_node(fs_node_t **, devmap_handle_t, int);
    7676static int tmpfs_destroy_node(fs_node_t *);
    7777static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
     
    7979
    8080/* Implementation of helper functions. */
    81 static int tmpfs_root_get(fs_node_t **rfn, dev_handle_t dev_handle)
    82 {
    83         return tmpfs_node_get(rfn, dev_handle, TMPFS_SOME_ROOT);
     81static int tmpfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
     82{
     83        return tmpfs_node_get(rfn, devmap_handle, TMPFS_SOME_ROOT);
    8484}
    8585
     
    120120}
    121121
    122 static dev_handle_t tmpfs_device_get(fs_node_t *fn)
     122static devmap_handle_t tmpfs_device_get(fs_node_t *fn)
    123123{
    124124        return 0;
     
    165165        switch (keys) {
    166166        case 1:
    167                 return (nodep->dev_handle == key[NODES_KEY_DEV]);
     167                return (nodep->devmap_handle == key[NODES_KEY_DEV]);
    168168        case 2:
    169                 return ((nodep->dev_handle == key[NODES_KEY_DEV]) &&
     169                return ((nodep->devmap_handle == key[NODES_KEY_DEV]) &&
    170170                    (nodep->index == key[NODES_KEY_INDEX]));
    171171        default:
     
    209209        nodep->bp = NULL;
    210210        nodep->index = 0;
    211         nodep->dev_handle = 0;
     211        nodep->devmap_handle = 0;
    212212        nodep->type = TMPFS_NONE;
    213213        nodep->lnkcnt = 0;
     
    233233}
    234234
    235 static bool tmpfs_instance_init(dev_handle_t dev_handle)
     235static bool tmpfs_instance_init(devmap_handle_t devmap_handle)
    236236{
    237237        fs_node_t *rfn;
    238238        int rc;
    239239       
    240         rc = tmpfs_create_node(&rfn, dev_handle, L_DIRECTORY);
     240        rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY);
    241241        if (rc != EOK || !rfn)
    242242                return false;
     
    245245}
    246246
    247 static void tmpfs_instance_done(dev_handle_t dev_handle)
     247static void tmpfs_instance_done(devmap_handle_t devmap_handle)
    248248{
    249249        unsigned long key[] = {
    250                 [NODES_KEY_DEV] = dev_handle
     250                [NODES_KEY_DEV] = devmap_handle
    251251        };
    252252        /*
     
    279279}
    280280
    281 int tmpfs_node_get(fs_node_t **rfn, dev_handle_t dev_handle, fs_index_t index)
     281int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
    282282{
    283283        unsigned long key[] = {
    284                 [NODES_KEY_DEV] = dev_handle,
     284                [NODES_KEY_DEV] = devmap_handle,
    285285                [NODES_KEY_INDEX] = index
    286286        };
     
    308308}
    309309
    310 int tmpfs_create_node(fs_node_t **rfn, dev_handle_t dev_handle, int lflag)
     310int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag)
    311311{
    312312        fs_node_t *rootfn;
     
    327327        nodep->bp->data = nodep;        /* link the FS and TMPFS nodes */
    328328
    329         rc = tmpfs_root_get(&rootfn, dev_handle);
     329        rc = tmpfs_root_get(&rootfn, devmap_handle);
    330330        assert(rc == EOK);
    331331        if (!rootfn)
     
    333333        else
    334334                nodep->index = tmpfs_next_index++;
    335         nodep->dev_handle = dev_handle;
     335        nodep->devmap_handle = devmap_handle;
    336336        if (lflag & L_DIRECTORY)
    337337                nodep->type = TMPFS_DIRECTORY;
     
    341341        /* Insert the new node into the nodes hash table. */
    342342        unsigned long key[] = {
    343                 [NODES_KEY_DEV] = nodep->dev_handle,
     343                [NODES_KEY_DEV] = nodep->devmap_handle,
    344344                [NODES_KEY_INDEX] = nodep->index
    345345        };
     
    357357
    358358        unsigned long key[] = {
    359                 [NODES_KEY_DEV] = nodep->dev_handle,
     359                [NODES_KEY_DEV] = nodep->devmap_handle,
    360360                [NODES_KEY_INDEX] = nodep->index
    361361        };
     
    442442void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request)
    443443{
    444         dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
     444        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    445445        fs_node_t *rootfn;
    446446        int rc;
     
    455455
    456456        /* Check if this device is not already mounted. */
    457         rc = tmpfs_root_get(&rootfn, dev_handle);
     457        rc = tmpfs_root_get(&rootfn, devmap_handle);
    458458        if ((rc == EOK) && (rootfn)) {
    459459                (void) tmpfs_node_put(rootfn);
     
    464464
    465465        /* Initialize TMPFS instance. */
    466         if (!tmpfs_instance_init(dev_handle)) {
     466        if (!tmpfs_instance_init(devmap_handle)) {
    467467                free(opts);
    468468                ipc_answer_0(rid, ENOMEM);
     
    470470        }
    471471
    472         rc = tmpfs_root_get(&rootfn, dev_handle);
     472        rc = tmpfs_root_get(&rootfn, devmap_handle);
    473473        assert(rc == EOK);
    474474        tmpfs_node_t *rootp = TMPFS_NODE(rootfn);
    475475        if (str_cmp(opts, "restore") == 0) {
    476                 if (tmpfs_restore(dev_handle))
     476                if (tmpfs_restore(devmap_handle))
    477477                        ipc_answer_3(rid, EOK, rootp->index, rootp->size,
    478478                            rootp->lnkcnt);
     
    493493void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    494494{
    495         dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
    496 
    497         tmpfs_instance_done(dev_handle);
     495        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     496
     497        tmpfs_instance_done(devmap_handle);
    498498        ipc_answer_0(rid, EOK);
    499499}
     
    511511void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
    512512{
    513         dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
     513        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    514514        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    515515        aoff64_t pos =
     
    521521        link_t *hlp;
    522522        unsigned long key[] = {
    523                 [NODES_KEY_DEV] = dev_handle,
     523                [NODES_KEY_DEV] = devmap_handle,
    524524                [NODES_KEY_INDEX] = index
    525525        };
     
    586586void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
    587587{
    588         dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
     588        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    589589        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    590590        aoff64_t pos =
     
    596596        link_t *hlp;
    597597        unsigned long key[] = {
    598                 [NODES_KEY_DEV] = dev_handle,
     598                [NODES_KEY_DEV] = devmap_handle,
    599599                [NODES_KEY_INDEX] = index
    600600        };
     
    651651void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    652652{
    653         dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
     653        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    654654        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    655655        aoff64_t size =
     
    660660         */
    661661        unsigned long key[] = {
    662                 [NODES_KEY_DEV] = dev_handle,
     662                [NODES_KEY_DEV] = devmap_handle,
    663663                [NODES_KEY_INDEX] = index
    664664        };
     
    704704void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
    705705{
    706         dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
     706        devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);
    707707        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    708708        int rc;
     
    710710        link_t *hlp;
    711711        unsigned long key[] = {
    712                 [NODES_KEY_DEV] = dev_handle,
     712                [NODES_KEY_DEV] = devmap_handle,
    713713                [NODES_KEY_INDEX] = index
    714714        };
Note: See TracChangeset for help on using the changeset viewer.