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


Ignore:
Timestamp:
2011-08-15T21:47:38Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a9b756e
Parents:
bca3eac
Message:

exFAT: allocate 1 cluster while creating directory similar to FAT server

File:
1 edited

Legend:

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

    rbca3eac r93e12f3  
    137137        exfat_directory_open_parent(&di, node->idx->devmap_handle, node->idx->pfc,
    138138            node->idx->parent_fragmented);
     139        rc = exfat_directory_seek(&di, node->idx->pdi);
     140        if (rc != EOK) {
     141                (void) exfat_directory_close(&di);
     142                return rc;
     143        }
     144
    139145        rc = exfat_directory_sync_file(&di, &df, &ds);
    140146        if (rc != EOK) {
     
    614620        exfat_idx_t *idxp;
    615621        exfat_node_t *nodep;
    616         int rc;
    617 
     622        exfat_bs_t *bs;
     623        int rc;
     624
     625        bs = block_bb_get(devmap_handle);
    618626        rc = exfat_node_get_new(&nodep);
    619627        if (rc != EOK)
     
    625633                return rc;
    626634        }
    627 
    628         if (flags & L_DIRECTORY)
    629                 nodep->type = EXFAT_DIRECTORY;
    630         else
    631                 nodep->type = EXFAT_FILE;
    632635
    633636        nodep->firstc = 0;
     
    640643        nodep->idx = idxp;
    641644        idxp->nodep = nodep;
    642 
    643645        fibril_mutex_unlock(&idxp->lock);
     646
     647        if (flags & L_DIRECTORY) {
     648                nodep->type = EXFAT_DIRECTORY;
     649                rc = exfat_node_expand(devmap_handle, nodep, 1);
     650                if (rc != EOK) {
     651                        (void) exfat_node_put(FS_NODE(nodep));
     652                        return rc;
     653                }
     654                nodep->size = BPC(bs);
     655        } else {
     656                nodep->type = EXFAT_FILE;
     657        }
     658
    644659        *rfn = FS_NODE(nodep);
    645660        return EOK;
     
    712727        if (rc != EOK)
    713728                return rc;
    714 
    715729        /*
    716730         * At this point we only establish the link between the parent and the
     
    735749        childp->idx->pfc = parentp->firstc;
    736750        childp->idx->parent_fragmented = parentp->fragmented;
    737         childp->idx->pdi = di.pos;      /* di.pos holds absolute position of SFN entry */
     751        childp->idx->pdi = di.pos;
    738752        fibril_mutex_unlock(&childp->idx->lock);
    739753
     
    932946        int i, rc;
    933947        exfat_cluster_t clst;
    934         for (i=0; i<=10; i++) {
     948        for (i=0; i<=7; i++) {
    935949                rc = exfat_get_cluster(bs, devmap_handle, i, &clst);
    936950                if (rc != EOK)
     
    11681182        return EOK;
    11691183}
    1170 
    1171 /*
    1172 int bitmap_is_allocated(exfat_bs_t *bs, devmap_handle_t devmap_handle,
    1173     exfat_cluster_t clst, bool *status)
    1174 {
    1175         fs_node_t *fn;
    1176         exfat_node_t *bitmap;
    1177         int rc;
    1178 
    1179         rc = exfat_bitmap_get(&fn, devmap_handle);
    1180         if (rc != EOK)
    1181                 return rc;
    1182 
    1183         nbitmap = EXFAT_NODE(fn);
    1184 
    1185        
    1186         return EOK;
    1187 }
    1188 */
    11891184
    11901185static int
     
    13641359
    13651360        boundary = ROUND_UP(nodep->size, BPC(bs));
    1366 
    13671361        if (pos >= boundary) {
    13681362                unsigned nclsts;
Note: See TracChangeset for help on using the changeset viewer.