Subversion Repositories HelenOS

Rev

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

Rev 3638 Rev 3660
Line 318... Line 318...
318
        int i;
318
        int i;
319
        block_t *b;
319
        block_t *b;
320
 
320
 
321
        /*
321
        /*
322
         * Populate the new cluster with unused dentries.
322
         * Populate the new cluster with unused dentries.
323
         * We don't create the '.' and '..' entries, since they are
-
 
324
         * optional and HelenOS VFS does not need them.
-
 
325
         */
323
         */
326
        for (i = 0; i < bs->spc; i++) {
324
        for (i = 0; i < bs->spc; i++) {
327
            b = _fat_block_get(bs, dev_handle, mcl, i,
325
            b = _fat_block_get(bs, dev_handle, mcl, i,
328
                BLOCK_FLAGS_NOREAD);
326
                BLOCK_FLAGS_NOREAD);
329
            /* mark all dentries as never-used */
327
            /* mark all dentries as never-used */
Line 458... Line 456...
458
    b->dirty = true;        /* need to sync block */
456
    b->dirty = true;        /* need to sync block */
459
    block_put(b);
457
    block_put(b);
460
    futex_up(&parentp->idx->lock);
458
    futex_up(&parentp->idx->lock);
461
 
459
 
462
    futex_down(&childp->idx->lock);
460
    futex_down(&childp->idx->lock);
-
 
461
   
-
 
462
    /*
-
 
463
     * If possible, create the Sub-directory Identifier Entry and the
-
 
464
     * Sub-directory Parent Pointer Entry (i.e. "." and ".."). These entries
-
 
465
     * are not mandatory according to Standard ECMA-107 and HelenOS VFS does
-
 
466
     * not use them anyway, so this is rather a sign of our good will.
-
 
467
     */
-
 
468
    b = fat_block_get(bs, childp, 0, BLOCK_FLAGS_NONE);
-
 
469
    d = (fat_dentry_t *)b->data;
-
 
470
    if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
-
 
471
        strcmp(d->name, FAT_NAME_DOT) == 0) {
-
 
472
        memset(d, 0, sizeof(fat_dentry_t));
-
 
473
        strcpy(d->name, FAT_NAME_DOT);
-
 
474
        strcpy(d->ext, FAT_EXT_PAD);
-
 
475
        d->attr = FAT_ATTR_SUBDIR;
-
 
476
        d->firstc = host2uint16_t_le(childp->firstc);
-
 
477
        /* TODO: initialize also the date/time members. */
-
 
478
    }
-
 
479
    d++;
-
 
480
    if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
-
 
481
        strcmp(d->name, FAT_NAME_DOT_DOT) == 0) {
-
 
482
        memset(d, 0, sizeof(fat_dentry_t));
-
 
483
        strcpy(d->name, FAT_NAME_DOT_DOT);
-
 
484
        strcpy(d->ext, FAT_EXT_PAD);
-
 
485
        d->attr = FAT_ATTR_SUBDIR;
-
 
486
        d->firstc = (parentp->firstc == FAT_CLST_ROOT) ?
-
 
487
            host2uint16_t_le(FAT_CLST_RES0) :
-
 
488
            host2uint16_t_le(parentp->firstc);
-
 
489
        /* TODO: initialize also the date/time members. */
-
 
490
    }
-
 
491
    b->dirty = true;        /* need to sync block */
-
 
492
    block_put(b);
-
 
493
 
463
    childp->idx->pfc = parentp->firstc;
494
    childp->idx->pfc = parentp->firstc;
464
    childp->idx->pdi = i * dps + j;
495
    childp->idx->pdi = i * dps + j;
465
    futex_up(&childp->idx->lock);
496
    futex_up(&childp->idx->lock);
466
 
497
 
467
    futex_down(&childp->lock);
498
    futex_down(&childp->lock);