Changeset 1baec4b in mainline


Ignore:
Timestamp:
2008-11-30T18:03:02Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50b3d30
Parents:
36b8c5a6
Message:

Create "." and ".." entries on FAT.

Location:
uspace/srv/fs/fat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_dentry.h

    r36b8c5a6 r1baec4b  
    3939#define FAT_NAME_LEN            8
    4040#define FAT_EXT_LEN             3
     41
     42#define FAT_NAME_DOT            ".       "
     43#define FAT_NAME_DOT_DOT        "..      "
     44#define FAT_EXT_PAD             "   "
    4145
    4246#define FAT_ATTR_RDONLY         (1 << 0)
  • uspace/srv/fs/fat/fat_ops.c

    r36b8c5a6 r1baec4b  
    321321                /*
    322322                 * 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.
    325323                 */
    326324                for (i = 0; i < bs->spc; i++) {
     
    461459
    462460        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
    463494        childp->idx->pfc = parentp->firstc;
    464495        childp->idx->pdi = i * dps + j;
Note: See TracChangeset for help on using the changeset viewer.