Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    rd44aabd ra405563  
    332332        /* idxp->lock held */
    333333        if (flags & L_DIRECTORY) {
    334                 /* Populate the new cluster with unused dentries. */
    335                 fat_zero_cluster(bs, dev_handle, mcl);
     334                int i;
     335                block_t *b;
     336
     337                /*
     338                 * Populate the new cluster with unused dentries.
     339                 */
     340                for (i = 0; i < bs->spc; i++) {
     341                        b = _fat_block_get(bs, dev_handle, mcl, i,
     342                            BLOCK_FLAGS_NOREAD);
     343                        /* mark all dentries as never-used */
     344                        memset(b->data, 0, bps);
     345                        b->dirty = false;
     346                        block_put(b);
     347                }
    336348                nodep->type = FAT_DIRECTORY;
    337349                nodep->firstc = mcl;
     
    450462         * We need to grow the parent in order to create a new unused dentry.
    451463         */
    452         if (parentp->firstc == FAT_CLST_ROOT) {
     464        if (parentp->idx->pfc == FAT_CLST_ROOT) {
    453465                /* Can't grow the root directory. */
    454466                fibril_mutex_unlock(&parentp->idx->lock);
     
    460472                return rc;
    461473        }
    462         fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
    463474        fat_append_clusters(bs, parentp, mcl);
    464         parentp->size += bps * bs->spc;
    465         parentp->dirty = true;          /* need to sync node */
    466         b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NONE);
     475        b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NOREAD);
    467476        d = (fat_dentry_t *)b->data;
     477        /*
     478         * Clear all dentries in the block except for the first one (the first
     479         * dentry will be cleared in the next step).
     480         */
     481        memset(d + 1, 0, bps - sizeof(fat_dentry_t));
    468482
    469483hit:
Note: See TracChangeset for help on using the changeset viewer.