Changeset 15f3c3f in mainline for uspace/srv/fs/fat


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.

Location:
uspace/srv/fs/fat
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat.h

    ref09a7a r15f3c3f  
    175175
    176176        fibril_mutex_t  lock;
    177         devmap_handle_t devmap_handle;
     177        service_id_t    service_id;
    178178        fs_index_t      index;
    179179        /**
     
    241241extern void fat_sync(ipc_callid_t, ipc_call_t *);
    242242
    243 extern int fat_idx_get_new(fat_idx_t **, devmap_handle_t);
    244 extern fat_idx_t *fat_idx_get_by_pos(devmap_handle_t, fat_cluster_t, unsigned);
    245 extern fat_idx_t *fat_idx_get_by_index(devmap_handle_t, fs_index_t);
     243extern int fat_idx_get_new(fat_idx_t **, service_id_t);
     244extern fat_idx_t *fat_idx_get_by_pos(service_id_t, fat_cluster_t, unsigned);
     245extern fat_idx_t *fat_idx_get_by_index(service_id_t, fs_index_t);
    246246extern void fat_idx_destroy(fat_idx_t *);
    247247extern void fat_idx_hashin(fat_idx_t *);
     
    250250extern int fat_idx_init(void);
    251251extern void fat_idx_fini(void);
    252 extern int fat_idx_init_by_devmap_handle(devmap_handle_t);
    253 extern void fat_idx_fini_by_devmap_handle(devmap_handle_t);
     252extern int fat_idx_init_by_service_id(service_id_t);
     253extern void fat_idx_fini_by_service_id(service_id_t);
    254254
    255255#endif
  • uspace/srv/fs/fat/fat_fat.c

    ref09a7a r15f3c3f  
    7171 *
    7272 * @param bs            Buffer holding the boot sector for the file.
    73  * @param devmap_handle Device handle of the device with the file.
     73 * @param service_id    Service ID of the device with the file.
    7474 * @param firstc        First cluster to start the walk with.
    7575 * @param lastc         If non-NULL, output argument hodling the last cluster
     
    8282 */
    8383int
    84 fat_cluster_walk(fat_bs_t *bs, devmap_handle_t devmap_handle, fat_cluster_t firstc,
     84fat_cluster_walk(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc,
    8585    fat_cluster_t *lastc, uint16_t *numc, uint16_t max_clusters)
    8686{
     
    109109                fidx = clst % (BPS(bs) / sizeof(fat_cluster_t));
    110110                /* read FAT1 */
    111                 rc = block_get(&b, devmap_handle, RSCNT(bs) + fsec,
     111                rc = block_get(&b, service_id, RSCNT(bs) + fsec,
    112112                    BLOCK_FLAGS_NONE);
    113113                if (rc != EOK)
     
    160160                 * when fortunately we have the last cluster number cached.
    161161                 */
    162                 return block_get(block, nodep->idx->devmap_handle,
     162                return block_get(block, nodep->idx->service_id,
    163163                    CLBN2PBN(bs, nodep->lastc_cached_value, bn), flags);
    164164        }
     
    174174
    175175fall_through:
    176         rc = _fat_block_get(block, bs, nodep->idx->devmap_handle, firstc,
     176        rc = _fat_block_get(block, bs, nodep->idx->service_id, firstc,
    177177            &currc, relbn, flags);
    178178        if (rc != EOK)
     
    193193 * @param block         Pointer to a block pointer for storing result.
    194194 * @param bs            Buffer holding the boot sector of the file system.
    195  * @param devmap_handle Device handle of the file system.
     195 * @param service_id    Service ID handle of the file system.
    196196 * @param fcl           First cluster used by the file. Can be zero if the file
    197197 *                      is empty.
     
    205205 */
    206206int
    207 _fat_block_get(block_t **block, fat_bs_t *bs, devmap_handle_t devmap_handle,
     207_fat_block_get(block_t **block, fat_bs_t *bs, service_id_t service_id,
    208208    fat_cluster_t fcl, fat_cluster_t *clp, aoff64_t bn, int flags)
    209209{
     
    222222                /* root directory special case */
    223223                assert(bn < RDS(bs));
    224                 rc = block_get(block, devmap_handle,
     224                rc = block_get(block, service_id,
    225225                    RSCNT(bs) + FATCNT(bs) * SF(bs) + bn, flags);
    226226                return rc;
     
    228228
    229229        max_clusters = bn / SPC(bs);
    230         rc = fat_cluster_walk(bs, devmap_handle, fcl, &c, &clusters, max_clusters);
     230        rc = fat_cluster_walk(bs, service_id, fcl, &c, &clusters, max_clusters);
    231231        if (rc != EOK)
    232232                return rc;
    233233        assert(clusters == max_clusters);
    234234
    235         rc = block_get(block, devmap_handle, CLBN2PBN(bs, c, bn), flags);
     235        rc = block_get(block, service_id, CLBN2PBN(bs, c, bn), flags);
    236236
    237237        if (clp)
     
    281281        /* zero out the initial part of the new cluster chain */
    282282        for (o = boundary; o < pos; o += BPS(bs)) {
    283                 rc = _fat_block_get(&b, bs, nodep->idx->devmap_handle, mcl,
     283                rc = _fat_block_get(&b, bs, nodep->idx->service_id, mcl,
    284284                    NULL, (o - boundary) / BPS(bs), BLOCK_FLAGS_NOREAD);
    285285                if (rc != EOK)
     
    298298 *
    299299 * @param bs            Buffer holding the boot sector for the file system.
    300  * @param devmap_handle Device handle for the file system.
     300 * @param service_id    Service ID for the file system.
    301301 * @param clst          Cluster which to get.
    302302 * @param value         Output argument holding the value of the cluster.
     
    305305 */
    306306int
    307 fat_get_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
     307fat_get_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
    308308    fat_cluster_t clst, fat_cluster_t *value)
    309309{
     
    312312        int rc;
    313313
    314         rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
     314        rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
    315315            (clst * sizeof(fat_cluster_t)) / BPS(bs), BLOCK_FLAGS_NONE);
    316316        if (rc != EOK)
     
    327327 *
    328328 * @param bs            Buffer holding the boot sector for the file system.
    329  * @param devmap_handle Device handle for the file system.
     329 * @param service_id    Device service ID for the file system.
    330330 * @param fatno         Number of the FAT instance where to make the change.
    331331 * @param clst          Cluster which is to be set.
     
    335335 */
    336336int
    337 fat_set_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno,
     337fat_set_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
    338338    fat_cluster_t clst, fat_cluster_t value)
    339339{
     
    343343
    344344        assert(fatno < FATCNT(bs));
    345         rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno +
     345        rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
    346346            (clst * sizeof(fat_cluster_t)) / BPS(bs), BLOCK_FLAGS_NONE);
    347347        if (rc != EOK)
     
    358358 *
    359359 * @param bs            Buffer holding the boot sector of the file system.
    360  * @param devmap_handle Device handle of the file system.
     360 * @param service_id    Service ID of the file system.
    361361 * @param lifo          Chain of allocated clusters.
    362362 * @param nclsts        Number of clusters in the lifo chain.
     
    364364 * @return              EOK on success or a negative error code.
    365365 */
    366 int fat_alloc_shadow_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle,
     366int fat_alloc_shadow_clusters(fat_bs_t *bs, service_id_t service_id,
    367367    fat_cluster_t *lifo, unsigned nclsts)
    368368{
     
    373373        for (fatno = FAT1 + 1; fatno < bs->fatcnt; fatno++) {
    374374                for (c = 0; c < nclsts; c++) {
    375                         rc = fat_set_cluster(bs, devmap_handle, fatno, lifo[c],
     375                        rc = fat_set_cluster(bs, service_id, fatno, lifo[c],
    376376                            c == 0 ? FAT_CLST_LAST1 : lifo[c - 1]);
    377377                        if (rc != EOK)
     
    391391 *
    392392 * @param bs            Buffer holding the boot sector of the file system.
    393  * @param devmap_handle Device handle of the file system.
     393 * @param service_id    Device service ID of the file system.
    394394 * @param nclsts        Number of clusters to allocate.
    395395 * @param mcl           Output parameter where the first cluster in the chain
     
    401401 */
    402402int
    403 fat_alloc_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned nclsts,
     403fat_alloc_clusters(fat_bs_t *bs, service_id_t service_id, unsigned nclsts,
    404404    fat_cluster_t *mcl, fat_cluster_t *lcl)
    405405{
     
    419419        fibril_mutex_lock(&fat_alloc_lock);
    420420        for (b = 0, cl = 0; b < SF(bs); b++) {
    421                 rc = block_get(&blk, devmap_handle, RSCNT(bs) + b,
     421                rc = block_get(&blk, service_id, RSCNT(bs) + b,
    422422                    BLOCK_FLAGS_NONE);
    423423                if (rc != EOK)
     
    458458                                        /* update the shadow copies of FAT */
    459459                                        rc = fat_alloc_shadow_clusters(bs,
    460                                             devmap_handle, lifo, nclsts);
     460                                            service_id, lifo, nclsts);
    461461                                        if (rc != EOK)
    462462                                                goto error;
     
    485485         */
    486486        while (found--) {
    487                 rc = fat_set_cluster(bs, devmap_handle, FAT1, lifo[found],
     487                rc = fat_set_cluster(bs, service_id, FAT1, lifo[found],
    488488                    FAT_CLST_RES0);
    489489                if (rc != EOK) {
     
    500500 *
    501501 * @param bs            Buffer hodling the boot sector of the file system.
    502  * @param devmap_handle Device handle of the file system.
     502 * @param service_id    Device service ID of the file system.
    503503 * @param firstc        First cluster in the chain which is to be freed.
    504504 *
     
    506506 */
    507507int
    508 fat_free_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle, fat_cluster_t firstc)
     508fat_free_clusters(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc)
    509509{
    510510        unsigned fatno;
     
    515515        while (firstc < FAT_CLST_LAST1) {
    516516                assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD);
    517                 rc = fat_get_cluster(bs, devmap_handle, FAT1, firstc, &nextc);
     517                rc = fat_get_cluster(bs, service_id, FAT1, firstc, &nextc);
    518518                if (rc != EOK)
    519519                        return rc;
    520520                for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
    521                         rc = fat_set_cluster(bs, devmap_handle, fatno, firstc,
     521                        rc = fat_set_cluster(bs, service_id, fatno, firstc,
    522522                            FAT_CLST_RES0);
    523523                        if (rc != EOK)
     
    544544    fat_cluster_t lcl)
    545545{
    546         devmap_handle_t devmap_handle = nodep->idx->devmap_handle;
     546        service_id_t service_id = nodep->idx->service_id;
    547547        fat_cluster_t lastc;
    548548        uint8_t fatno;
     
    558558                        nodep->lastc_cached_valid = false;
    559559                } else {
    560                         rc = fat_cluster_walk(bs, devmap_handle, nodep->firstc,
     560                        rc = fat_cluster_walk(bs, service_id, nodep->firstc,
    561561                            &lastc, NULL, (uint16_t) -1);
    562562                        if (rc != EOK)
     
    565565
    566566                for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
    567                         rc = fat_set_cluster(bs, nodep->idx->devmap_handle, fatno,
     567                        rc = fat_set_cluster(bs, nodep->idx->service_id, fatno,
    568568                            lastc, mcl);
    569569                        if (rc != EOK)
     
    591591{
    592592        int rc;
    593         devmap_handle_t devmap_handle = nodep->idx->devmap_handle;
     593        service_id_t service_id = nodep->idx->service_id;
    594594
    595595        /*
     
    602602        if (lcl == FAT_CLST_RES0) {
    603603                /* The node will have zero size and no clusters allocated. */
    604                 rc = fat_free_clusters(bs, devmap_handle, nodep->firstc);
     604                rc = fat_free_clusters(bs, service_id, nodep->firstc);
    605605                if (rc != EOK)
    606606                        return rc;
     
    611611                unsigned fatno;
    612612
    613                 rc = fat_get_cluster(bs, devmap_handle, FAT1, lcl, &nextc);
     613                rc = fat_get_cluster(bs, service_id, FAT1, lcl, &nextc);
    614614                if (rc != EOK)
    615615                        return rc;
     
    617617                /* Terminate the cluster chain in all copies of FAT. */
    618618                for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {
    619                         rc = fat_set_cluster(bs, devmap_handle, fatno, lcl,
     619                        rc = fat_set_cluster(bs, service_id, fatno, lcl,
    620620                            FAT_CLST_LAST1);
    621621                        if (rc != EOK)
     
    624624
    625625                /* Free all following clusters. */
    626                 rc = fat_free_clusters(bs, devmap_handle, nextc);
     626                rc = fat_free_clusters(bs, service_id, nextc);
    627627                if (rc != EOK)
    628628                        return rc;
     
    639639
    640640int
    641 fat_zero_cluster(struct fat_bs *bs, devmap_handle_t devmap_handle, fat_cluster_t c)
     641fat_zero_cluster(struct fat_bs *bs, service_id_t service_id, fat_cluster_t c)
    642642{
    643643        int i;
     
    646646
    647647        for (i = 0; i < SPC(bs); i++) {
    648                 rc = _fat_block_get(&b, bs, devmap_handle, c, NULL, i,
     648                rc = _fat_block_get(&b, bs, service_id, c, NULL, i,
    649649                    BLOCK_FLAGS_NOREAD);
    650650                if (rc != EOK)
     
    666666 * does not contain a fat file system.
    667667 */
    668 int fat_sanity_check(fat_bs_t *bs, devmap_handle_t devmap_handle)
     668int fat_sanity_check(fat_bs_t *bs, service_id_t service_id)
    669669{
    670670        fat_cluster_t e0, e1;
     
    707707
    708708        for (fat_no = 0; fat_no < bs->fatcnt; fat_no++) {
    709                 rc = fat_get_cluster(bs, devmap_handle, fat_no, 0, &e0);
     709                rc = fat_get_cluster(bs, service_id, fat_no, 0, &e0);
    710710                if (rc != EOK)
    711711                        return EIO;
    712712
    713                 rc = fat_get_cluster(bs, devmap_handle, fat_no, 1, &e1);
     713                rc = fat_get_cluster(bs, service_id, fat_no, 1, &e1);
    714714                if (rc != EOK)
    715715                        return EIO;
  • uspace/srv/fs/fat/fat_fat.h

    ref09a7a r15f3c3f  
    6161#define fat_clusters_get(numc, bs, dh, fc) \
    6262    fat_cluster_walk((bs), (dh), (fc), NULL, (numc), (uint16_t) -1)
    63 extern int fat_cluster_walk(struct fat_bs *, devmap_handle_t, fat_cluster_t,
     63extern int fat_cluster_walk(struct fat_bs *, service_id_t, fat_cluster_t,
    6464    fat_cluster_t *, uint16_t *, uint16_t);
    6565
    6666extern int fat_block_get(block_t **, struct fat_bs *, struct fat_node *,
    6767    aoff64_t, int);
    68 extern int _fat_block_get(block_t **, struct fat_bs *, devmap_handle_t,
     68extern int _fat_block_get(block_t **, struct fat_bs *, service_id_t,
    6969    fat_cluster_t, fat_cluster_t *, aoff64_t, int);
    7070
     
    7373extern int fat_chop_clusters(struct fat_bs *, struct fat_node *,
    7474    fat_cluster_t);
    75 extern int fat_alloc_clusters(struct fat_bs *, devmap_handle_t, unsigned,
     75extern int fat_alloc_clusters(struct fat_bs *, service_id_t, unsigned,
    7676    fat_cluster_t *, fat_cluster_t *);
    77 extern int fat_free_clusters(struct fat_bs *, devmap_handle_t, fat_cluster_t);
    78 extern int fat_alloc_shadow_clusters(struct fat_bs *, devmap_handle_t,
     77extern int fat_free_clusters(struct fat_bs *, service_id_t, fat_cluster_t);
     78extern int fat_alloc_shadow_clusters(struct fat_bs *, service_id_t,
    7979    fat_cluster_t *, unsigned);
    80 extern int fat_get_cluster(struct fat_bs *, devmap_handle_t, unsigned,
     80extern int fat_get_cluster(struct fat_bs *, service_id_t, unsigned,
    8181    fat_cluster_t, fat_cluster_t *);
    82 extern int fat_set_cluster(struct fat_bs *, devmap_handle_t, unsigned,
     82extern int fat_set_cluster(struct fat_bs *, service_id_t, unsigned,
    8383    fat_cluster_t, fat_cluster_t);
    8484extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
    8585    aoff64_t);
    86 extern int fat_zero_cluster(struct fat_bs *, devmap_handle_t, fat_cluster_t);
    87 extern int fat_sanity_check(struct fat_bs *, devmap_handle_t);
     86extern int fat_zero_cluster(struct fat_bs *, service_id_t, fat_cluster_t);
     87extern int fat_sanity_check(struct fat_bs *, service_id_t);
    8888
    8989#endif
  • uspace/srv/fs/fat/fat_idx.c

    ref09a7a r15f3c3f  
    5959typedef struct {
    6060        link_t          link;
    61         devmap_handle_t devmap_handle;
     61        service_id_t    service_id;
    6262
    6363        /** Next unassigned index. */
     
    7676static LIST_INITIALIZE(unused_list);
    7777
    78 static void unused_initialize(unused_t *u, devmap_handle_t devmap_handle)
     78static void unused_initialize(unused_t *u, service_id_t service_id)
    7979{
    8080        link_initialize(&u->link);
    81         u->devmap_handle = devmap_handle;
     81        u->service_id = service_id;
    8282        u->next = 0;
    8383        u->remaining = ((uint64_t)((fs_index_t)-1)) + 1;
     
    8585}
    8686
    87 static unused_t *unused_find(devmap_handle_t devmap_handle, bool lock)
     87static unused_t *unused_find(service_id_t service_id, bool lock)
    8888{
    8989        unused_t *u;
     
    9494        list_foreach(unused_list, l) {
    9595                u = list_get_instance(l, unused_t, link);
    96                 if (u->devmap_handle == devmap_handle)
     96                if (u->service_id == service_id)
    9797                        return u;
    9898        }
     
    108108/**
    109109 * Global hash table of all used fat_idx_t structures.
    110  * The index structures are hashed by the devmap_handle, parent node's first
     110 * The index structures are hashed by the service_id, parent node's first
    111111 * cluster and index within the parent directory.
    112112 */
     
    122122static hash_index_t pos_hash(unsigned long key[])
    123123{
    124         devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY];
     124        service_id_t service_id = (service_id_t)key[UPH_DH_KEY];
    125125        fat_cluster_t pfc = (fat_cluster_t)key[UPH_PFC_KEY];
    126126        unsigned pdi = (unsigned)key[UPH_PDI_KEY];
     
    142142        h |= (pdi & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
    143143            (UPH_BUCKETS_LOG / 2);
    144         h |= (devmap_handle & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
     144        h |= (service_id & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
    145145            (3 * (UPH_BUCKETS_LOG / 4));
    146146
     
    150150static int pos_compare(unsigned long key[], hash_count_t keys, link_t *item)
    151151{
    152         devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY];
     152        service_id_t service_id = (service_id_t)key[UPH_DH_KEY];
    153153        fat_cluster_t pfc;
    154154        unsigned pdi;
     
    157157        switch (keys) {
    158158        case 1:
    159                 return (devmap_handle == fidx->devmap_handle);
     159                return (service_id == fidx->service_id);
    160160        case 3:
    161161                pfc = (fat_cluster_t) key[UPH_PFC_KEY];
    162162                pdi = (unsigned) key[UPH_PDI_KEY];
    163                 return (devmap_handle == fidx->devmap_handle) && (pfc == fidx->pfc) &&
     163                return (service_id == fidx->service_id) && (pfc == fidx->pfc) &&
    164164                    (pdi == fidx->pdi);
    165165        default:
     
    183183/**
    184184 * Global hash table of all used fat_idx_t structures.
    185  * The index structures are hashed by the devmap_handle and index.
     185 * The index structures are hashed by the service_id and index.
    186186 */
    187187static hash_table_t ui_hash;
     
    195195static hash_index_t idx_hash(unsigned long key[])
    196196{
    197         devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY];
     197        service_id_t service_id = (service_id_t)key[UIH_DH_KEY];
    198198        fs_index_t index = (fs_index_t)key[UIH_INDEX_KEY];
    199199
    200200        hash_index_t h;
    201201
    202         h = devmap_handle & ((1 << (UIH_BUCKETS_LOG / 2)) - 1);
     202        h = service_id & ((1 << (UIH_BUCKETS_LOG / 2)) - 1);
    203203        h |= (index & ((1 << (UIH_BUCKETS_LOG / 2)) - 1)) <<
    204204            (UIH_BUCKETS_LOG / 2);
     
    209209static int idx_compare(unsigned long key[], hash_count_t keys, link_t *item)
    210210{
    211         devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY];
     211        service_id_t service_id = (service_id_t)key[UIH_DH_KEY];
    212212        fs_index_t index;
    213213        fat_idx_t *fidx = list_get_instance(item, fat_idx_t, uih_link);
     
    215215        switch (keys) {
    216216        case 1:
    217                 return (devmap_handle == fidx->devmap_handle);
     217                return (service_id == fidx->service_id);
    218218        case 2:
    219219                index = (fs_index_t) key[UIH_INDEX_KEY];
    220                 return (devmap_handle == fidx->devmap_handle) &&
     220                return (service_id == fidx->service_id) &&
    221221                    (index == fidx->index);
    222222        default:
     
    241241
    242242/** Allocate a VFS index which is not currently in use. */
    243 static bool fat_index_alloc(devmap_handle_t devmap_handle, fs_index_t *index)
     243static bool fat_index_alloc(service_id_t service_id, fs_index_t *index)
    244244{
    245245        unused_t *u;
    246246       
    247247        assert(index);
    248         u = unused_find(devmap_handle, true);
     248        u = unused_find(service_id, true);
    249249        if (!u)
    250250                return false;   
     
    303303
    304304/** Free a VFS index, which is no longer in use. */
    305 static void fat_index_free(devmap_handle_t devmap_handle, fs_index_t index)
     305static void fat_index_free(service_id_t service_id, fs_index_t index)
    306306{
    307307        unused_t *u;
    308308
    309         u = unused_find(devmap_handle, true);
     309        u = unused_find(service_id, true);
    310310        assert(u);
    311311
     
    365365}
    366366
    367 static int fat_idx_create(fat_idx_t **fidxp, devmap_handle_t devmap_handle)
     367static int fat_idx_create(fat_idx_t **fidxp, service_id_t service_id)
    368368{
    369369        fat_idx_t *fidx;
     
    372372        if (!fidx)
    373373                return ENOMEM;
    374         if (!fat_index_alloc(devmap_handle, &fidx->index)) {
     374        if (!fat_index_alloc(service_id, &fidx->index)) {
    375375                free(fidx);
    376376                return ENOSPC;
     
    380380        link_initialize(&fidx->uih_link);
    381381        fibril_mutex_initialize(&fidx->lock);
    382         fidx->devmap_handle = devmap_handle;
     382        fidx->service_id = service_id;
    383383        fidx->pfc = FAT_CLST_RES0;      /* no parent yet */
    384384        fidx->pdi = 0;
     
    389389}
    390390
    391 int fat_idx_get_new(fat_idx_t **fidxp, devmap_handle_t devmap_handle)
     391int fat_idx_get_new(fat_idx_t **fidxp, service_id_t service_id)
    392392{
    393393        fat_idx_t *fidx;
     
    395395
    396396        fibril_mutex_lock(&used_lock);
    397         rc = fat_idx_create(&fidx, devmap_handle);
     397        rc = fat_idx_create(&fidx, service_id);
    398398        if (rc != EOK) {
    399399                fibril_mutex_unlock(&used_lock);
     
    402402               
    403403        unsigned long ikey[] = {
    404                 [UIH_DH_KEY] = devmap_handle,
     404                [UIH_DH_KEY] = service_id,
    405405                [UIH_INDEX_KEY] = fidx->index,
    406406        };
     
    415415
    416416fat_idx_t *
    417 fat_idx_get_by_pos(devmap_handle_t devmap_handle, fat_cluster_t pfc, unsigned pdi)
     417fat_idx_get_by_pos(service_id_t service_id, fat_cluster_t pfc, unsigned pdi)
    418418{
    419419        fat_idx_t *fidx;
    420420        link_t *l;
    421421        unsigned long pkey[] = {
    422                 [UPH_DH_KEY] = devmap_handle,
     422                [UPH_DH_KEY] = service_id,
    423423                [UPH_PFC_KEY] = pfc,
    424424                [UPH_PDI_KEY] = pdi,
     
    432432                int rc;
    433433
    434                 rc = fat_idx_create(&fidx, devmap_handle);
     434                rc = fat_idx_create(&fidx, service_id);
    435435                if (rc != EOK) {
    436436                        fibril_mutex_unlock(&used_lock);
     
    439439               
    440440                unsigned long ikey[] = {
    441                         [UIH_DH_KEY] = devmap_handle,
     441                        [UIH_DH_KEY] = service_id,
    442442                        [UIH_INDEX_KEY] = fidx->index,
    443443                };
     
    458458{
    459459        unsigned long pkey[] = {
    460                 [UPH_DH_KEY] = idx->devmap_handle,
     460                [UPH_DH_KEY] = idx->service_id,
    461461                [UPH_PFC_KEY] = idx->pfc,
    462462                [UPH_PDI_KEY] = idx->pdi,
     
    471471{
    472472        unsigned long pkey[] = {
    473                 [UPH_DH_KEY] = idx->devmap_handle,
     473                [UPH_DH_KEY] = idx->service_id,
    474474                [UPH_PFC_KEY] = idx->pfc,
    475475                [UPH_PDI_KEY] = idx->pdi,
     
    482482
    483483fat_idx_t *
    484 fat_idx_get_by_index(devmap_handle_t devmap_handle, fs_index_t index)
     484fat_idx_get_by_index(service_id_t service_id, fs_index_t index)
    485485{
    486486        fat_idx_t *fidx = NULL;
    487487        link_t *l;
    488488        unsigned long ikey[] = {
    489                 [UIH_DH_KEY] = devmap_handle,
     489                [UIH_DH_KEY] = service_id,
    490490                [UIH_INDEX_KEY] = index,
    491491        };
     
    509509{
    510510        unsigned long ikey[] = {
    511                 [UIH_DH_KEY] = idx->devmap_handle,
     511                [UIH_DH_KEY] = idx->service_id,
    512512                [UIH_INDEX_KEY] = idx->index,
    513513        };
    514         devmap_handle_t devmap_handle = idx->devmap_handle;
     514        service_id_t service_id = idx->service_id;
    515515        fs_index_t index = idx->index;
    516516
     
    526526        fibril_mutex_unlock(&used_lock);
    527527        /* Release the VFS index. */
    528         fat_index_free(devmap_handle, index);
     528        fat_index_free(service_id, index);
    529529        /* The index structure itself is freed in idx_remove_callback(). */
    530530}
     
    548548}
    549549
    550 int fat_idx_init_by_devmap_handle(devmap_handle_t devmap_handle)
     550int fat_idx_init_by_service_id(service_id_t service_id)
    551551{
    552552        unused_t *u;
     
    556556        if (!u)
    557557                return ENOMEM;
    558         unused_initialize(u, devmap_handle);
     558        unused_initialize(u, service_id);
    559559        fibril_mutex_lock(&unused_lock);
    560         if (!unused_find(devmap_handle, false)) {
     560        if (!unused_find(service_id, false)) {
    561561                list_append(&u->link, &unused_list);
    562562        } else {
     
    568568}
    569569
    570 void fat_idx_fini_by_devmap_handle(devmap_handle_t devmap_handle)
     570void fat_idx_fini_by_service_id(service_id_t service_id)
    571571{
    572572        unsigned long ikey[] = {
    573                 [UIH_DH_KEY] = devmap_handle
     573                [UIH_DH_KEY] = service_id
    574574        };
    575575        unsigned long pkey[] = {
    576                 [UPH_DH_KEY] = devmap_handle
     576                [UPH_DH_KEY] = service_id
    577577        };
    578578
     
    590590         * Free the unused and freed structures for this instance.
    591591         */
    592         unused_t *u = unused_find(devmap_handle, true);
     592        unused_t *u = unused_find(service_id, true);
    593593        assert(u);
    594594        list_remove(&u->link);
  • uspace/srv/fs/fat/fat_ops.c

    ref09a7a r15f3c3f  
    4343#include <libblock.h>
    4444#include <ipc/services.h>
    45 #include <ipc/devmap.h>
     45#include <ipc/loc.h>
    4646#include <macros.h>
    4747#include <async.h>
     
    7272 * Forward declarations of FAT libfs operations.
    7373 */
    74 static int fat_root_get(fs_node_t **, devmap_handle_t);
     74static int fat_root_get(fs_node_t **, service_id_t);
    7575static int fat_match(fs_node_t **, fs_node_t *, const char *);
    76 static int fat_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
     76static int fat_node_get(fs_node_t **, service_id_t, fs_index_t);
    7777static int fat_node_open(fs_node_t *);
    7878static int fat_node_put(fs_node_t *);
    79 static int fat_create_node(fs_node_t **, devmap_handle_t, int);
     79static int fat_create_node(fs_node_t **, service_id_t, int);
    8080static int fat_destroy_node(fs_node_t *);
    8181static int fat_link(fs_node_t *, fs_node_t *, const char *);
     
    8888static bool fat_is_directory(fs_node_t *);
    8989static bool fat_is_file(fs_node_t *node);
    90 static devmap_handle_t fat_device_get(fs_node_t *node);
     90static service_id_t fat_device_get(fs_node_t *node);
    9191
    9292/*
     
    120120        assert(node->dirty);
    121121
    122         bs = block_bb_get(node->idx->devmap_handle);
     122        bs = block_bb_get(node->idx->service_id);
    123123       
    124124        /* Read the block that contains the dentry of interest. */
    125         rc = _fat_block_get(&b, bs, node->idx->devmap_handle, node->idx->pfc,
     125        rc = _fat_block_get(&b, bs, node->idx->service_id, node->idx->pfc,
    126126            NULL, (node->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
    127127            BLOCK_FLAGS_NONE);
     
    145145}
    146146
    147 static int fat_node_fini_by_devmap_handle(devmap_handle_t devmap_handle)
     147static int fat_node_fini_by_service_id(service_id_t service_id)
    148148{
    149149        fat_node_t *nodep;
     
    169169                        goto restart;
    170170                }
    171                 if (nodep->idx->devmap_handle != devmap_handle) {
     171                if (nodep->idx->service_id != service_id) {
    172172                        fibril_mutex_unlock(&nodep->idx->lock);
    173173                        fibril_mutex_unlock(&nodep->lock);
     
    299299                return rc;
    300300
    301         bs = block_bb_get(idxp->devmap_handle);
     301        bs = block_bb_get(idxp->service_id);
    302302
    303303        /* Read the block that contains the dentry of interest. */
    304         rc = _fat_block_get(&b, bs, idxp->devmap_handle, idxp->pfc, NULL,
     304        rc = _fat_block_get(&b, bs, idxp->service_id, idxp->pfc, NULL,
    305305            (idxp->pdi * sizeof(fat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE);
    306306        if (rc != EOK) {
     
    323323                 */
    324324                uint16_t clusters;
    325                 rc = fat_clusters_get(&clusters, bs, idxp->devmap_handle,
     325                rc = fat_clusters_get(&clusters, bs, idxp->service_id,
    326326                    uint16_t_le2host(d->firstc));
    327327                if (rc != EOK) {
     
    357357 */
    358358
    359 int fat_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
    360 {
    361         return fat_node_get(rfn, devmap_handle, 0);
     359int fat_root_get(fs_node_t **rfn, service_id_t service_id)
     360{
     361        return fat_node_get(rfn, service_id, 0);
    362362}
    363363
     
    370370        unsigned blocks;
    371371        fat_dentry_t *d;
    372         devmap_handle_t devmap_handle;
     372        service_id_t service_id;
    373373        block_t *b;
    374374        int rc;
    375375
    376376        fibril_mutex_lock(&parentp->idx->lock);
    377         devmap_handle = parentp->idx->devmap_handle;
     377        service_id = parentp->idx->service_id;
    378378        fibril_mutex_unlock(&parentp->idx->lock);
    379379
    380         bs = block_bb_get(devmap_handle);
     380        bs = block_bb_get(service_id);
    381381        blocks = parentp->size / BPS(bs);
    382382        for (i = 0; i < blocks; i++) {
     
    403403                                /* hit */
    404404                                fat_node_t *nodep;
    405                                 fat_idx_t *idx = fat_idx_get_by_pos(devmap_handle,
     405                                fat_idx_t *idx = fat_idx_get_by_pos(service_id,
    406406                                    parentp->firstc, i * DPS(bs) + j);
    407407                                if (!idx) {
     
    436436
    437437/** Instantiate a FAT in-core node. */
    438 int fat_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
     438int fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
    439439{
    440440        fat_node_t *nodep;
     
    442442        int rc;
    443443
    444         idxp = fat_idx_get_by_index(devmap_handle, index);
     444        idxp = fat_idx_get_by_index(service_id, index);
    445445        if (!idxp) {
    446446                *rfn = NULL;
     
    493493}
    494494
    495 int fat_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)
     495int fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
    496496{
    497497        fat_idx_t *idxp;
     
    501501        int rc;
    502502
    503         bs = block_bb_get(devmap_handle);
     503        bs = block_bb_get(service_id);
    504504        if (flags & L_DIRECTORY) {
    505505                /* allocate a cluster */
    506                 rc = fat_alloc_clusters(bs, devmap_handle, 1, &mcl, &lcl);
     506                rc = fat_alloc_clusters(bs, service_id, 1, &mcl, &lcl);
    507507                if (rc != EOK)
    508508                        return rc;
    509509                /* populate the new cluster with unused dentries */
    510                 rc = fat_zero_cluster(bs, devmap_handle, mcl);
     510                rc = fat_zero_cluster(bs, service_id, mcl);
    511511                if (rc != EOK) {
    512                         (void) fat_free_clusters(bs, devmap_handle, mcl);
     512                        (void) fat_free_clusters(bs, service_id, mcl);
    513513                        return rc;
    514514                }
     
    517517        rc = fat_node_get_new(&nodep);
    518518        if (rc != EOK) {
    519                 (void) fat_free_clusters(bs, devmap_handle, mcl);
     519                (void) fat_free_clusters(bs, service_id, mcl);
    520520                return rc;
    521521        }
    522         rc = fat_idx_get_new(&idxp, devmap_handle);
    523         if (rc != EOK) {
    524                 (void) fat_free_clusters(bs, devmap_handle, mcl);       
     522        rc = fat_idx_get_new(&idxp, service_id);
     523        if (rc != EOK) {
     524                (void) fat_free_clusters(bs, service_id, mcl); 
    525525                (void) fat_node_put(FS_NODE(nodep));
    526526                return rc;
     
    571571        assert(!has_children);
    572572
    573         bs = block_bb_get(nodep->idx->devmap_handle);
     573        bs = block_bb_get(nodep->idx->service_id);
    574574        if (nodep->firstc != FAT_CLST_RES0) {
    575575                assert(nodep->size);
    576576                /* Free all clusters allocated to the node. */
    577                 rc = fat_free_clusters(bs, nodep->idx->devmap_handle,
     577                rc = fat_free_clusters(bs, nodep->idx->service_id,
    578578                    nodep->firstc);
    579579        }
     
    621621       
    622622        fibril_mutex_lock(&parentp->idx->lock);
    623         bs = block_bb_get(parentp->idx->devmap_handle);
     623        bs = block_bb_get(parentp->idx->service_id);
    624624
    625625        blocks = parentp->size / BPS(bs);
     
    660660                return ENOSPC;
    661661        }
    662         rc = fat_alloc_clusters(bs, parentp->idx->devmap_handle, 1, &mcl, &lcl);
     662        rc = fat_alloc_clusters(bs, parentp->idx->service_id, 1, &mcl, &lcl);
    663663        if (rc != EOK) {
    664664                fibril_mutex_unlock(&parentp->idx->lock);
    665665                return rc;
    666666        }
    667         rc = fat_zero_cluster(bs, parentp->idx->devmap_handle, mcl);
    668         if (rc != EOK) {
    669                 (void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl);
     667        rc = fat_zero_cluster(bs, parentp->idx->service_id, mcl);
     668        if (rc != EOK) {
     669                (void) fat_free_clusters(bs, parentp->idx->service_id, mcl);
    670670                fibril_mutex_unlock(&parentp->idx->lock);
    671671                return rc;
     
    673673        rc = fat_append_clusters(bs, parentp, mcl, lcl);
    674674        if (rc != EOK) {
    675                 (void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl);
     675                (void) fat_free_clusters(bs, parentp->idx->service_id, mcl);
    676676                fibril_mutex_unlock(&parentp->idx->lock);
    677677                return rc;
     
    790790        assert(childp->lnkcnt == 1);
    791791        fibril_mutex_lock(&childp->idx->lock);
    792         bs = block_bb_get(childp->idx->devmap_handle);
    793 
    794         rc = _fat_block_get(&b, bs, childp->idx->devmap_handle, childp->idx->pfc,
     792        bs = block_bb_get(childp->idx->service_id);
     793
     794        rc = _fat_block_get(&b, bs, childp->idx->service_id, childp->idx->pfc,
    795795            NULL, (childp->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
    796796            BLOCK_FLAGS_NONE);
     
    842842       
    843843        fibril_mutex_lock(&nodep->idx->lock);
    844         bs = block_bb_get(nodep->idx->devmap_handle);
     844        bs = block_bb_get(nodep->idx->service_id);
    845845
    846846        blocks = nodep->size / BPS(bs);
     
    916916}
    917917
    918 devmap_handle_t fat_device_get(fs_node_t *node)
     918service_id_t fat_device_get(fs_node_t *node)
    919919{
    920920        return 0;
     
    948948void fat_mounted(ipc_callid_t rid, ipc_call_t *request)
    949949{
    950         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     950        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    951951        enum cache_mode cmode;
    952952        fat_bs_t *bs;
     
    970970
    971971        /* initialize libblock */
    972         rc = block_init(EXCHANGE_SERIALIZE, devmap_handle, BS_SIZE);
     972        rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE);
    973973        if (rc != EOK) {
    974974                async_answer_0(rid, rc);
     
    977977
    978978        /* prepare the boot block */
    979         rc = block_bb_read(devmap_handle, BS_BLOCK);
    980         if (rc != EOK) {
    981                 block_fini(devmap_handle);
     979        rc = block_bb_read(service_id, BS_BLOCK);
     980        if (rc != EOK) {
     981                block_fini(service_id);
    982982                async_answer_0(rid, rc);
    983983                return;
     
    985985
    986986        /* get the buffer with the boot sector */
    987         bs = block_bb_get(devmap_handle);
     987        bs = block_bb_get(service_id);
    988988       
    989989        if (BPS(bs) != BS_SIZE) {
    990                 block_fini(devmap_handle);
     990                block_fini(service_id);
    991991                async_answer_0(rid, ENOTSUP);
    992992                return;
     
    994994
    995995        /* Initialize the block cache */
    996         rc = block_cache_init(devmap_handle, BPS(bs), 0 /* XXX */, cmode);
    997         if (rc != EOK) {
    998                 block_fini(devmap_handle);
     996        rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode);
     997        if (rc != EOK) {
     998                block_fini(service_id);
    999999                async_answer_0(rid, rc);
    10001000                return;
     
    10021002
    10031003        /* Do some simple sanity checks on the file system. */
    1004         rc = fat_sanity_check(bs, devmap_handle);
    1005         if (rc != EOK) {
    1006                 (void) block_cache_fini(devmap_handle);
    1007                 block_fini(devmap_handle);
     1004        rc = fat_sanity_check(bs, service_id);
     1005        if (rc != EOK) {
     1006                (void) block_cache_fini(service_id);
     1007                block_fini(service_id);
    10081008                async_answer_0(rid, rc);
    10091009                return;
    10101010        }
    10111011
    1012         rc = fat_idx_init_by_devmap_handle(devmap_handle);
    1013         if (rc != EOK) {
    1014                 (void) block_cache_fini(devmap_handle);
    1015                 block_fini(devmap_handle);
     1012        rc = fat_idx_init_by_service_id(service_id);
     1013        if (rc != EOK) {
     1014                (void) block_cache_fini(service_id);
     1015                block_fini(service_id);
    10161016                async_answer_0(rid, rc);
    10171017                return;
     
    10211021        fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t));
    10221022        if (!rfn) {
    1023                 (void) block_cache_fini(devmap_handle);
    1024                 block_fini(devmap_handle);
    1025                 fat_idx_fini_by_devmap_handle(devmap_handle);
     1023                (void) block_cache_fini(service_id);
     1024                block_fini(service_id);
     1025                fat_idx_fini_by_service_id(service_id);
    10261026                async_answer_0(rid, ENOMEM);
    10271027                return;
     
    10311031        if (!rootp) {
    10321032                free(rfn);
    1033                 (void) block_cache_fini(devmap_handle);
    1034                 block_fini(devmap_handle);
    1035                 fat_idx_fini_by_devmap_handle(devmap_handle);
     1033                (void) block_cache_fini(service_id);
     1034                block_fini(service_id);
     1035                fat_idx_fini_by_service_id(service_id);
    10361036                async_answer_0(rid, ENOMEM);
    10371037                return;
     
    10391039        fat_node_initialize(rootp);
    10401040
    1041         fat_idx_t *ridxp = fat_idx_get_by_pos(devmap_handle, FAT_CLST_ROOTPAR, 0);
     1041        fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0);
    10421042        if (!ridxp) {
    10431043                free(rfn);
    10441044                free(rootp);
    1045                 (void) block_cache_fini(devmap_handle);
    1046                 block_fini(devmap_handle);
    1047                 fat_idx_fini_by_devmap_handle(devmap_handle);
     1045                (void) block_cache_fini(service_id);
     1046                block_fini(service_id);
     1047                fat_idx_fini_by_service_id(service_id);
    10481048                async_answer_0(rid, ENOMEM);
    10491049                return;
     
    10741074void fat_unmounted(ipc_callid_t rid, ipc_call_t *request)
    10751075{
    1076         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     1076        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    10771077        fs_node_t *fn;
    10781078        fat_node_t *nodep;
    10791079        int rc;
    10801080
    1081         rc = fat_root_get(&fn, devmap_handle);
     1081        rc = fat_root_get(&fn, service_id);
    10821082        if (rc != EOK) {
    10831083                async_answer_0(rid, rc);
     
    11071107         * stop using libblock for this instance.
    11081108         */
    1109         (void) fat_node_fini_by_devmap_handle(devmap_handle);
    1110         fat_idx_fini_by_devmap_handle(devmap_handle);
    1111         (void) block_cache_fini(devmap_handle);
    1112         block_fini(devmap_handle);
     1109        (void) fat_node_fini_by_service_id(service_id);
     1110        fat_idx_fini_by_service_id(service_id);
     1111        (void) block_cache_fini(service_id);
     1112        block_fini(service_id);
    11131113
    11141114        async_answer_0(rid, EOK);
     
    11271127void fat_read(ipc_callid_t rid, ipc_call_t *request)
    11281128{
    1129         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     1129        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    11301130        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    11311131        aoff64_t pos =
     
    11381138        int rc;
    11391139
    1140         rc = fat_node_get(&fn, devmap_handle, index);
     1140        rc = fat_node_get(&fn, service_id, index);
    11411141        if (rc != EOK) {
    11421142                async_answer_0(rid, rc);
     
    11581158        }
    11591159
    1160         bs = block_bb_get(devmap_handle);
     1160        bs = block_bb_get(service_id);
    11611161
    11621162        if (nodep->type == FAT_FILE) {
     
    12641264void fat_write(ipc_callid_t rid, ipc_call_t *request)
    12651265{
    1266         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     1266        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    12671267        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    12681268        aoff64_t pos =
     
    12771277        int rc;
    12781278       
    1279         rc = fat_node_get(&fn, devmap_handle, index);
     1279        rc = fat_node_get(&fn, service_id, index);
    12801280        if (rc != EOK) {
    12811281                async_answer_0(rid, rc);
     
    12971297        }
    12981298
    1299         bs = block_bb_get(devmap_handle);
     1299        bs = block_bb_get(service_id);
    13001300
    13011301        /*
     
    13591359                nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs);
    13601360                /* create an independent chain of nclsts clusters in all FATs */
    1361                 rc = fat_alloc_clusters(bs, devmap_handle, nclsts, &mcl, &lcl);
     1361                rc = fat_alloc_clusters(bs, service_id, nclsts, &mcl, &lcl);
    13621362                if (rc != EOK) {
    13631363                        /* could not allocate a chain of nclsts clusters */
     
    13701370                rc = fat_fill_gap(bs, nodep, mcl, pos);
    13711371                if (rc != EOK) {
    1372                         (void) fat_free_clusters(bs, devmap_handle, mcl);
     1372                        (void) fat_free_clusters(bs, service_id, mcl);
    13731373                        (void) fat_node_put(fn);
    13741374                        async_answer_0(callid, rc);
     
    13761376                        return;
    13771377                }
    1378                 rc = _fat_block_get(&b, bs, devmap_handle, lcl, NULL,
     1378                rc = _fat_block_get(&b, bs, service_id, lcl, NULL,
    13791379                    (pos / BPS(bs)) % SPC(bs), flags);
    13801380                if (rc != EOK) {
    1381                         (void) fat_free_clusters(bs, devmap_handle, mcl);
     1381                        (void) fat_free_clusters(bs, service_id, mcl);
    13821382                        (void) fat_node_put(fn);
    13831383                        async_answer_0(callid, rc);
     
    13901390                rc = block_put(b);
    13911391                if (rc != EOK) {
    1392                         (void) fat_free_clusters(bs, devmap_handle, mcl);
     1392                        (void) fat_free_clusters(bs, service_id, mcl);
    13931393                        (void) fat_node_put(fn);
    13941394                        async_answer_0(rid, rc);
     
    14011401                rc = fat_append_clusters(bs, nodep, mcl, lcl);
    14021402                if (rc != EOK) {
    1403                         (void) fat_free_clusters(bs, devmap_handle, mcl);
     1403                        (void) fat_free_clusters(bs, service_id, mcl);
    14041404                        (void) fat_node_put(fn);
    14051405                        async_answer_0(rid, rc);
     
    14161416void fat_truncate(ipc_callid_t rid, ipc_call_t *request)
    14171417{
    1418         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     1418        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    14191419        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    14201420        aoff64_t size =
     
    14251425        int rc;
    14261426
    1427         rc = fat_node_get(&fn, devmap_handle, index);
     1427        rc = fat_node_get(&fn, service_id, index);
    14281428        if (rc != EOK) {
    14291429                async_answer_0(rid, rc);
     
    14361436        nodep = FAT_NODE(fn);
    14371437
    1438         bs = block_bb_get(devmap_handle);
     1438        bs = block_bb_get(service_id);
    14391439
    14401440        if (nodep->size == size) {
     
    14631463                } else {
    14641464                        fat_cluster_t lastc;
    1465                         rc = fat_cluster_walk(bs, devmap_handle, nodep->firstc,
     1465                        rc = fat_cluster_walk(bs, service_id, nodep->firstc,
    14661466                            &lastc, NULL, (size - 1) / BPC(bs));
    14671467                        if (rc != EOK)
     
    14881488void fat_destroy(ipc_callid_t rid, ipc_call_t *request)
    14891489{
    1490         devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);
     1490        service_id_t service_id = (service_id_t)IPC_GET_ARG1(*request);
    14911491        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    14921492        fs_node_t *fn;
     
    14941494        int rc;
    14951495
    1496         rc = fat_node_get(&fn, devmap_handle, index);
     1496        rc = fat_node_get(&fn, service_id, index);
    14971497        if (rc != EOK) {
    14981498                async_answer_0(rid, rc);
     
    15271527void fat_sync(ipc_callid_t rid, ipc_call_t *request)
    15281528{
    1529         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     1529        service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    15301530        fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    15311531       
    15321532        fs_node_t *fn;
    1533         int rc = fat_node_get(&fn, devmap_handle, index);
     1533        int rc = fat_node_get(&fn, service_id, index);
    15341534        if (rc != EOK) {
    15351535                async_answer_0(rid, rc);
Note: See TracChangeset for help on using the changeset viewer.