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


Ignore:
Timestamp:
2011-06-22T22:00:52Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
86ffa27f
Parents:
ef09a7a
Message:

Rename devmap to loc, devfs to locfs.

File:
1 edited

Legend:

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

    ref09a7a r15f3c3f  
    6969/* Forward declarations of static functions. */
    7070static int tmpfs_match(fs_node_t **, fs_node_t *, const char *);
    71 static int tmpfs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
     71static int tmpfs_node_get(fs_node_t **, service_id_t, fs_index_t);
    7272static int tmpfs_node_open(fs_node_t *);
    7373static int tmpfs_node_put(fs_node_t *);
    74 static int tmpfs_create_node(fs_node_t **, devmap_handle_t, int);
     74static int tmpfs_create_node(fs_node_t **, service_id_t, int);
    7575static int tmpfs_destroy_node(fs_node_t *);
    7676static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
     
    7878
    7979/* Implementation of helper functions. */
    80 static int tmpfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
    81 {
    82         return tmpfs_node_get(rfn, devmap_handle, TMPFS_SOME_ROOT);
     80static int tmpfs_root_get(fs_node_t **rfn, service_id_t service_id)
     81{
     82        return tmpfs_node_get(rfn, service_id, TMPFS_SOME_ROOT);
    8383}
    8484
     
    119119}
    120120
    121 static devmap_handle_t tmpfs_device_get(fs_node_t *fn)
     121static service_id_t tmpfs_device_get(fs_node_t *fn)
    122122{
    123123        return 0;
     
    164164        switch (keys) {
    165165        case 1:
    166                 return (nodep->devmap_handle == key[NODES_KEY_DEV]);
     166                return (nodep->service_id == key[NODES_KEY_DEV]);
    167167        case 2:
    168                 return ((nodep->devmap_handle == key[NODES_KEY_DEV]) &&
     168                return ((nodep->service_id == key[NODES_KEY_DEV]) &&
    169169                    (nodep->index == key[NODES_KEY_INDEX]));
    170170        default:
     
    208208        nodep->bp = NULL;
    209209        nodep->index = 0;
    210         nodep->devmap_handle = 0;
     210        nodep->service_id = 0;
    211211        nodep->type = TMPFS_NONE;
    212212        nodep->lnkcnt = 0;
     
    232232}
    233233
    234 static bool tmpfs_instance_init(devmap_handle_t devmap_handle)
     234static bool tmpfs_instance_init(service_id_t service_id)
    235235{
    236236        fs_node_t *rfn;
    237237        int rc;
    238238       
    239         rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY);
     239        rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY);
    240240        if (rc != EOK || !rfn)
    241241                return false;
     
    244244}
    245245
    246 static void tmpfs_instance_done(devmap_handle_t devmap_handle)
     246static void tmpfs_instance_done(service_id_t service_id)
    247247{
    248248        unsigned long key[] = {
    249                 [NODES_KEY_DEV] = devmap_handle
     249                [NODES_KEY_DEV] = service_id
    250250        };
    251251        /*
     
    276276}
    277277
    278 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
     278int tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
    279279{
    280280        unsigned long key[] = {
    281                 [NODES_KEY_DEV] = devmap_handle,
     281                [NODES_KEY_DEV] = service_id,
    282282                [NODES_KEY_INDEX] = index
    283283        };
     
    305305}
    306306
    307 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag)
     307int tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
    308308{
    309309        fs_node_t *rootfn;
     
    324324        nodep->bp->data = nodep;        /* link the FS and TMPFS nodes */
    325325
    326         rc = tmpfs_root_get(&rootfn, devmap_handle);
     326        rc = tmpfs_root_get(&rootfn, service_id);
    327327        assert(rc == EOK);
    328328        if (!rootfn)
     
    330330        else
    331331                nodep->index = tmpfs_next_index++;
    332         nodep->devmap_handle = devmap_handle;
     332        nodep->service_id = service_id;
    333333        if (lflag & L_DIRECTORY)
    334334                nodep->type = TMPFS_DIRECTORY;
     
    338338        /* Insert the new node into the nodes hash table. */
    339339        unsigned long key[] = {
    340                 [NODES_KEY_DEV] = nodep->devmap_handle,
     340                [NODES_KEY_DEV] = nodep->service_id,
    341341                [NODES_KEY_INDEX] = nodep->index
    342342        };
     
    354354
    355355        unsigned long key[] = {
    356                 [NODES_KEY_DEV] = nodep->devmap_handle,
     356                [NODES_KEY_DEV] = nodep->service_id,
    357357                [NODES_KEY_INDEX] = nodep->index
    358358        };
     
    435435void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request)
    436436{
    437         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     437        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    438438        fs_node_t *rootfn;
    439439        int rc;
     
    448448
    449449        /* Check if this device is not already mounted. */
    450         rc = tmpfs_root_get(&rootfn, devmap_handle);
     450        rc = tmpfs_root_get(&rootfn, service_id);
    451451        if ((rc == EOK) && (rootfn)) {
    452452                (void) tmpfs_node_put(rootfn);
     
    457457
    458458        /* Initialize TMPFS instance. */
    459         if (!tmpfs_instance_init(devmap_handle)) {
     459        if (!tmpfs_instance_init(service_id)) {
    460460                free(opts);
    461461                async_answer_0(rid, ENOMEM);
     
    463463        }
    464464
    465         rc = tmpfs_root_get(&rootfn, devmap_handle);
     465        rc = tmpfs_root_get(&rootfn, service_id);
    466466        assert(rc == EOK);
    467467        tmpfs_node_t *rootp = TMPFS_NODE(rootfn);
    468468        if (str_cmp(opts, "restore") == 0) {
    469                 if (tmpfs_restore(devmap_handle))
     469                if (tmpfs_restore(service_id))
    470470                        async_answer_3(rid, EOK, rootp->index, rootp->size,
    471471                            rootp->lnkcnt);
     
    486486void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    487487{
    488         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    489 
    490         tmpfs_instance_done(devmap_handle);
     488        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
     489
     490        tmpfs_instance_done(service_id);
    491491        async_answer_0(rid, EOK);
    492492}
     
    504504void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
    505505{
    506         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     506        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    507507        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    508508        aoff64_t pos =
     
    514514        link_t *hlp;
    515515        unsigned long key[] = {
    516                 [NODES_KEY_DEV] = devmap_handle,
     516                [NODES_KEY_DEV] = service_id,
    517517                [NODES_KEY_INDEX] = index
    518518        };
     
    575575void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
    576576{
    577         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     577        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    578578        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    579579        aoff64_t pos =
     
    585585        link_t *hlp;
    586586        unsigned long key[] = {
    587                 [NODES_KEY_DEV] = devmap_handle,
     587                [NODES_KEY_DEV] = service_id,
    588588                [NODES_KEY_INDEX] = index
    589589        };
     
    640640void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    641641{
    642         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     642        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    643643        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    644644        aoff64_t size =
     
    649649         */
    650650        unsigned long key[] = {
    651                 [NODES_KEY_DEV] = devmap_handle,
     651                [NODES_KEY_DEV] = service_id,
    652652                [NODES_KEY_INDEX] = index
    653653        };
     
    693693void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
    694694{
    695         devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);
     695        service_id_t service_id = (service_id_t)IPC_GET_ARG1(*request);
    696696        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    697697        int rc;
     
    699699        link_t *hlp;
    700700        unsigned long key[] = {
    701                 [NODES_KEY_DEV] = devmap_handle,
     701                [NODES_KEY_DEV] = service_id,
    702702                [NODES_KEY_INDEX] = index
    703703        };
Note: See TracChangeset for help on using the changeset viewer.