Rev 3634 | Rev 3660 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3634 | Rev 3638 | ||
---|---|---|---|
Line 477... | Line 477... | ||
477 | return EOK; |
477 | return EOK; |
478 | } |
478 | } |
479 | 479 | ||
480 | int fat_unlink(void *prnt, void *chld) |
480 | int fat_unlink(void *prnt, void *chld) |
481 | { |
481 | { |
- | 482 | fat_node_t *parentp = (fat_node_t *)prnt; |
|
- | 483 | fat_node_t *childp = (fat_node_t *)chld; |
|
- | 484 | fat_bs_t *bs; |
|
- | 485 | fat_dentry_t *d; |
|
- | 486 | uint16_t bps; |
|
- | 487 | block_t *b; |
|
- | 488 | ||
- | 489 | futex_down(&parentp->lock); |
|
- | 490 | futex_down(&childp->lock); |
|
- | 491 | assert(childp->lnkcnt == 1); |
|
- | 492 | futex_down(&childp->idx->lock); |
|
- | 493 | bs = block_bb_get(childp->idx->dev_handle); |
|
- | 494 | bps = uint16_t_le2host(bs->bps); |
|
- | 495 | ||
- | 496 | b = _fat_block_get(bs, childp->idx->dev_handle, childp->idx->pfc, |
|
- | 497 | (childp->idx->pdi * sizeof(fat_dentry_t)) / bps, |
|
- | 498 | BLOCK_FLAGS_NONE); |
|
- | 499 | d = (fat_dentry_t *)b->data + |
|
- | 500 | (childp->idx->pdi % (bps / sizeof(fat_dentry_t))); |
|
- | 501 | /* mark the dentry as not-currently-used */ |
|
- | 502 | d->name[0] = FAT_DENTRY_ERASED; |
|
482 | return ENOTSUP; /* not supported at the moment */ |
503 | b->dirty = true; /* need to sync block */ |
- | 504 | block_put(b); |
|
- | 505 | ||
- | 506 | /* remove the index structure from the position hash */ |
|
- | 507 | fat_idx_hashout(childp->idx); |
|
- | 508 | /* clear position information */ |
|
- | 509 | childp->idx->pfc = FAT_CLST_RES0; |
|
- | 510 | childp->idx->pdi = 0; |
|
- | 511 | futex_up(&childp->idx->lock); |
|
- | 512 | childp->lnkcnt = 0; |
|
- | 513 | childp->dirty = true; |
|
- | 514 | futex_up(&childp->lock); |
|
- | 515 | futex_up(&parentp->lock); |
|
- | 516 | ||
- | 517 | return EOK; |
|
483 | } |
518 | } |
484 | 519 | ||
485 | void *fat_match(void *prnt, const char *component) |
520 | void *fat_match(void *prnt, const char *component) |
486 | { |
521 | { |
487 | fat_bs_t *bs; |
522 | fat_bs_t *bs; |