Changeset b85c19a in mainline


Ignore:
Timestamp:
2011-06-20T18:52:36Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
563686b
Parents:
c6aca755
Message:
  1. Rewrite fat_match and fat_read through new functions.
  2. Rewrite fat_unlink to support delete operations with long names.
File:
1 edited

Legend:

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

    rc6aca755 rb85c19a  
    391391                        /* hit */
    392392                        fat_node_t *nodep;
    393                         aoff64_t o = (di.pos-1) % (BPS(di.bs) / sizeof(fat_dentry_t));
     393                        aoff64_t o = di.pos % (BPS(di.bs) / sizeof(fat_dentry_t));
    394394                        fat_idx_t *idx = fat_idx_get_by_pos(devmap_handle,
    395395                                parentp->firstc, di.bnum * DPS(di.bs) + o);
     
    413413                                (void) fat_node_put(*rfn);
    414414                        return rc;
     415                } else {
     416                        rc = fat_directory_next(&di);
     417                        if (rc != EOK)
     418                                break;
    415419                }
    416420        }
     
    757761        fat_node_t *parentp = FAT_NODE(pfn);
    758762        fat_node_t *childp = FAT_NODE(cfn);
    759         fat_bs_t *bs;
    760         fat_dentry_t *d;
    761         block_t *b;
    762763        bool has_children;
    763764        int rc;
     
    776777        assert(childp->lnkcnt == 1);
    777778        fibril_mutex_lock(&childp->idx->lock);
    778         bs = block_bb_get(childp->idx->devmap_handle);
    779 
    780         rc = _fat_block_get(&b, bs, childp->idx->devmap_handle, childp->idx->pfc,
    781             NULL, (childp->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
    782             BLOCK_FLAGS_NONE);
     779       
     780        fat_directory_t di;
     781        rc = fat_directory_open(parentp,&di);
    783782        if (rc != EOK)
    784783                goto error;
    785         d = (fat_dentry_t *)b->data +
    786             (childp->idx->pdi % (BPS(bs) / sizeof(fat_dentry_t)));
    787         /* mark the dentry as not-currently-used */
    788         d->name[0] = FAT_DENTRY_ERASED;
    789         b->dirty = true;                /* need to sync block */
    790         rc = block_put(b);
     784        rc = fat_directory_seek(&di, childp->idx->pdi);
     785        if (rc != EOK)
     786                goto error;
     787        rc = fat_directory_erase(&di);
     788        if (rc != EOK)
     789                goto error;
     790        rc = fat_directory_close(&di);
    791791        if (rc != EOK)
    792792                goto error;
     
    807807
    808808error:
    809         fibril_mutex_unlock(&parentp->idx->lock);
     809        (void) fat_directory_close(&di);
     810        fibril_mutex_unlock(&childp->idx->lock);
    810811        fibril_mutex_unlock(&childp->lock);
    811         fibril_mutex_unlock(&childp->idx->lock);
     812        fibril_mutex_unlock(&parentp->lock);
    812813        return rc;
    813814}
     
    12321233                        goto err;
    12331234                (void) async_data_read_finalize(callid, name, str_size(name) + 1);
    1234                 bytes = (pos - spos);
     1235                bytes = (pos - spos)+1;
    12351236        }
    12361237
Note: See TracChangeset for help on using the changeset viewer.