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


Ignore:
Timestamp:
2011-08-16T18:53:00Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
49160c4
Parents:
e0e922d (diff), 45058baa (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 mainline changes.

File:
1 edited

Legend:

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

    re0e922d rdb6e419  
    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
     
    114114}
    115115
    116 static devmap_handle_t tmpfs_device_get(fs_node_t *fn)
     116static service_id_t tmpfs_device_get(fs_node_t *fn)
    117117{
    118118        return 0;
     
    158158        switch (keys) {
    159159        case 1:
    160                 return (nodep->devmap_handle == key[NODES_KEY_DEV]);
     160                return (nodep->service_id == key[NODES_KEY_DEV]);
    161161        case 2:
    162                 return ((nodep->devmap_handle == key[NODES_KEY_DEV]) &&
     162                return ((nodep->service_id == key[NODES_KEY_DEV]) &&
    163163                    (nodep->index == key[NODES_KEY_INDEX]));
    164164        default:
     
    202202        nodep->bp = NULL;
    203203        nodep->index = 0;
    204         nodep->devmap_handle = 0;
     204        nodep->service_id = 0;
    205205        nodep->type = TMPFS_NONE;
    206206        nodep->lnkcnt = 0;
     
    226226}
    227227
    228 static bool tmpfs_instance_init(devmap_handle_t devmap_handle)
     228static bool tmpfs_instance_init(service_id_t service_id)
    229229{
    230230        fs_node_t *rfn;
    231231        int rc;
    232232       
    233         rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY);
     233        rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY);
    234234        if (rc != EOK || !rfn)
    235235                return false;
     
    238238}
    239239
    240 static void tmpfs_instance_done(devmap_handle_t devmap_handle)
    241 {
    242         unsigned long key[] = {
    243                 [NODES_KEY_DEV] = devmap_handle
     240static void tmpfs_instance_done(service_id_t service_id)
     241{
     242        unsigned long key[] = {
     243                [NODES_KEY_DEV] = service_id
    244244        };
    245245        /*
     
    270270}
    271271
    272 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
    273 {
    274         unsigned long key[] = {
    275                 [NODES_KEY_DEV] = devmap_handle,
     272int tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
     273{
     274        unsigned long key[] = {
     275                [NODES_KEY_DEV] = service_id,
    276276                [NODES_KEY_INDEX] = index
    277277        };
     
    299299}
    300300
    301 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag)
     301int tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
    302302{
    303303        fs_node_t *rootfn;
     
    318318        nodep->bp->data = nodep;        /* link the FS and TMPFS nodes */
    319319
    320         rc = tmpfs_root_get(&rootfn, devmap_handle);
     320        rc = tmpfs_root_get(&rootfn, service_id);
    321321        assert(rc == EOK);
    322322        if (!rootfn)
     
    324324        else
    325325                nodep->index = tmpfs_next_index++;
    326         nodep->devmap_handle = devmap_handle;
     326        nodep->service_id = service_id;
    327327        if (lflag & L_DIRECTORY)
    328328                nodep->type = TMPFS_DIRECTORY;
     
    332332        /* Insert the new node into the nodes hash table. */
    333333        unsigned long key[] = {
    334                 [NODES_KEY_DEV] = nodep->devmap_handle,
     334                [NODES_KEY_DEV] = nodep->service_id,
    335335                [NODES_KEY_INDEX] = nodep->index
    336336        };
     
    348348
    349349        unsigned long key[] = {
    350                 [NODES_KEY_DEV] = nodep->devmap_handle,
     350                [NODES_KEY_DEV] = nodep->service_id,
    351351                [NODES_KEY_INDEX] = nodep->index
    352352        };
     
    432432
    433433static int
    434 tmpfs_mounted(devmap_handle_t devmap_handle, const char *opts,
     434tmpfs_mounted(service_id_t service_id, const char *opts,
    435435    fs_index_t *index, aoff64_t *size, unsigned *lnkcnt)
    436436{
     
    439439       
    440440        /* Check if this device is not already mounted. */
    441         rc = tmpfs_root_get(&rootfn, devmap_handle);
     441        rc = tmpfs_root_get(&rootfn, service_id);
    442442        if ((rc == EOK) && (rootfn)) {
    443443                (void) tmpfs_node_put(rootfn);
     
    446446
    447447        /* Initialize TMPFS instance. */
    448         if (!tmpfs_instance_init(devmap_handle))
     448        if (!tmpfs_instance_init(service_id))
    449449                return ENOMEM;
    450450
    451         rc = tmpfs_root_get(&rootfn, devmap_handle);
     451        rc = tmpfs_root_get(&rootfn, service_id);
    452452        assert(rc == EOK);
    453453        tmpfs_node_t *rootp = TMPFS_NODE(rootfn);
    454454        if (str_cmp(opts, "restore") == 0) {
    455                 if (!tmpfs_restore(devmap_handle))
     455                if (!tmpfs_restore(service_id))
    456456                        return ELIMIT;
    457457        }
     
    464464}
    465465
    466 static int tmpfs_unmounted(devmap_handle_t devmap_handle)
    467 {
    468         tmpfs_instance_done(devmap_handle);
    469         return EOK;
    470 }
    471 
    472 static int tmpfs_read(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
     466static int tmpfs_unmounted(service_id_t service_id)
     467{
     468        tmpfs_instance_done(service_id);
     469        return EOK;
     470}
     471
     472static int tmpfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    473473    size_t *rbytes)
    474474{
     
    478478        link_t *hlp;
    479479        unsigned long key[] = {
    480                 [NODES_KEY_DEV] = devmap_handle,
     480                [NODES_KEY_DEV] = service_id,
    481481                [NODES_KEY_INDEX] = index
    482482        };
     
    532532
    533533static int
    534 tmpfs_write(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
     534tmpfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    535535    size_t *wbytes, aoff64_t *nsize)
    536536{
     
    540540        link_t *hlp;
    541541        unsigned long key[] = {
    542                 [NODES_KEY_DEV] = devmap_handle,
     542                [NODES_KEY_DEV] = service_id,
    543543                [NODES_KEY_INDEX] = index
    544544        };
     
    594594}
    595595
    596 static int tmpfs_truncate(devmap_handle_t devmap_handle, fs_index_t index,
     596static int tmpfs_truncate(service_id_t service_id, fs_index_t index,
    597597    aoff64_t size)
    598598{
     
    601601         */
    602602        unsigned long key[] = {
    603                 [NODES_KEY_DEV] = devmap_handle,
     603                [NODES_KEY_DEV] = service_id,
    604604                [NODES_KEY_INDEX] = index
    605605        };
     
    629629}
    630630
    631 static int tmpfs_close(devmap_handle_t devmap_handle, fs_index_t index)
    632 {
    633         return EOK;
    634 }
    635 
    636 static int tmpfs_destroy(devmap_handle_t devmap_handle, fs_index_t index)
     631static int tmpfs_close(service_id_t service_id, fs_index_t index)
     632{
     633        return EOK;
     634}
     635
     636static int tmpfs_destroy(service_id_t service_id, fs_index_t index)
    637637{
    638638        link_t *hlp;
    639639        unsigned long key[] = {
    640                 [NODES_KEY_DEV] = devmap_handle,
     640                [NODES_KEY_DEV] = service_id,
    641641                [NODES_KEY_INDEX] = index
    642642        };
     
    649649}
    650650
    651 static int tmpfs_sync(devmap_handle_t devmap_handle, fs_index_t index)
     651static int tmpfs_sync(service_id_t service_id, fs_index_t index)
    652652{
    653653        /*
Note: See TracChangeset for help on using the changeset viewer.