Subversion Repositories HelenOS

Rev

Rev 3660 | Rev 3701 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3660 Rev 3700
Line 387... Line 387...
387
    block_t *b;
387
    block_t *b;
388
    int i, j;
388
    int i, j;
389
    uint16_t bps;
389
    uint16_t bps;
390
    unsigned dps;
390
    unsigned dps;
391
    unsigned blocks;
391
    unsigned blocks;
-
 
392
    fat_cluster_t mcl, lcl;
-
 
393
    int rc;
392
 
394
 
393
    futex_down(&childp->lock);
395
    futex_down(&childp->lock);
394
    if (childp->lnkcnt == 1) {
396
    if (childp->lnkcnt == 1) {
395
        /*
397
        /*
396
         * On FAT, we don't support multiple hard links.
398
         * On FAT, we don't support multiple hard links.
Line 439... Line 441...
439
    }
441
    }
440
   
442
   
441
    /*
443
    /*
442
     * We need to grow the parent in order to create a new unused dentry.
444
     * We need to grow the parent in order to create a new unused dentry.
443
     */
445
     */
-
 
446
    if (parentp->idx->pfc == FAT_CLST_ROOT) {
-
 
447
        /* Can't grow the root directory. */
444
    futex_up(&parentp->idx->lock);
448
        futex_up(&parentp->idx->lock);
445
    return ENOTSUP; /* XXX */
449
        return ENOSPC;
-
 
450
    }
-
 
451
    rc = fat_alloc_clusters(bs, parentp->idx->dev_handle, 1, &mcl, &lcl);
-
 
452
    if (rc != EOK) {
-
 
453
        futex_up(&parentp->idx->lock);
-
 
454
        return rc;
-
 
455
    }
-
 
456
    fat_append_clusters(bs, parentp, mcl);
-
 
457
    b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NOREAD);
-
 
458
    d = (fat_dentry_t *)b->data;
-
 
459
    /*
-
 
460
     * Clear all dentries in the block except for the first one (the first
-
 
461
     * dentry will be cleared in the next step).
-
 
462
     */
-
 
463
    memset(d + 1, 0, bps - sizeof(fat_dentry_t));
446
 
464
 
447
hit:
465
hit:
448
    /*
466
    /*
449
     * At this point we only establish the link between the parent and the
467
     * At this point we only establish the link between the parent and the
450
     * child.  The dentry, except of the name and the extension, will remain
468
     * child.  The dentry, except of the name and the extension, will remain
451
     * uninitialized until the the corresponding node is synced. Thus the
469
     * uninitialized until the corresponding node is synced. Thus the valid
452
     * valid dentry data is kept in the child node structure.
470
     * dentry data is kept in the child node structure.
453
     */
471
     */
454
    memset(d, 0, sizeof(fat_dentry_t));
472
    memset(d, 0, sizeof(fat_dentry_t));
455
    fat_dentry_name_set(d, name);
473
    fat_dentry_name_set(d, name);
456
    b->dirty = true;        /* need to sync block */
474
    b->dirty = true;        /* need to sync block */
457
    block_put(b);
475
    block_put(b);