Changeset cd860fc in mainline for uspace/srv/fs/exfat/exfat_ops.c


Ignore:
Timestamp:
2011-08-14T17:36:57Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
151a4e2
Parents:
f061de75
Message:

exFAT: using exfat directory api in exfat_node_get_core instead of
explicit clusters access

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_ops.c

    rf061de75 rcd860fc  
    282282static int exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
    283283{
    284         block_t *b=NULL;
    285         exfat_bs_t *bs;
    286284        exfat_dentry_t *d;
    287285        exfat_node_t *nodep = NULL;
     286        exfat_directory_t di;
    288287        int rc;
    289288
     
    314313                return rc;
    315314
    316         bs = block_bb_get(idxp->devmap_handle);
    317 
    318         rc = exfat_block_get_by_clst(&b, bs, idxp->devmap_handle,
    319             idxp->parent_fragmented, idxp->pfc, NULL,
    320             (idxp->pdi * sizeof(exfat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE);
    321         if (rc != EOK) {
     315        exfat_directory_open_parent(&di, idxp->devmap_handle, idxp->pfc,
     316            idxp->parent_fragmented);
     317        rc = exfat_directory_seek(&di, idxp->pdi);
     318        if (rc != EOK) {
     319                (void) exfat_directory_close(&di);
    322320                (void) exfat_node_put(FS_NODE(nodep));
    323321                return rc;
    324322        }
    325 
    326         d = ((exfat_dentry_t *)b->data) + (idxp->pdi % DPS(bs));
     323        rc = exfat_directory_get(&di, &d);
     324        if (rc != EOK) {
     325                (void) exfat_directory_close(&di);
     326                (void) exfat_node_put(FS_NODE(nodep));
     327                return rc;
     328        }
     329
    327330        switch (exfat_classify_dentry(d)) {
    328331        case EXFAT_DENTRY_FILE:
    329332                nodep->type = (d->file.attr & EXFAT_ATTR_SUBDIR)?
    330333                    EXFAT_DIRECTORY : EXFAT_FILE;
    331                 rc = block_put(b);
     334                rc = exfat_directory_next(&di);
    332335                if (rc != EOK) {
     336                        (void) exfat_directory_close(&di);
    333337                        (void) exfat_node_put(FS_NODE(nodep));
    334338                        return rc;
    335339                }
    336                 rc = exfat_block_get_by_clst(&b, bs, idxp->devmap_handle,
    337                         idxp->parent_fragmented, idxp->pfc, NULL,
    338                         ((idxp->pdi+1) * sizeof(exfat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE);
     340                rc = exfat_directory_get(&di, &d);
    339341                if (rc != EOK) {
     342                        (void) exfat_directory_close(&di);
    340343                        (void) exfat_node_put(FS_NODE(nodep));
    341344                        return rc;
    342345                }
    343                 d = ((exfat_dentry_t *)b->data) + ((idxp->pdi+1) % DPS(bs));
    344                
    345346                nodep->firstc = d->stream.firstc;
    346347                nodep->size = d->stream.data_size;
     
    367368        case EXFAT_DENTRY_STREAM:
    368369        case EXFAT_DENTRY_NAME:
    369                 (void) block_put(b);
     370                (void) exfat_directory_close(&di);
    370371                (void) exfat_node_put(FS_NODE(nodep));
    371372                return ENOENT;
     
    375376        nodep->refcnt = 1;
    376377
    377         rc = block_put(b);
     378        rc = exfat_directory_close(&di);
    378379        if (rc != EOK) {
    379380                (void) exfat_node_put(FS_NODE(nodep));
Note: See TracChangeset for help on using the changeset viewer.