Changeset 7a57269f in mainline


Ignore:
Timestamp:
2011-04-07T21:00:29Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88ccd8b8
Parents:
07dcec5
Message:

Fix bug in the read_directory_dentry(), the directory index was ignored

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/minixfs/mfs_dentry.c

    r07dcec5 r7a57269f  
    4545        block_t *b;
    4646
    47         struct mfs_dentry_info *d_info = malloc(sizeof *d_info);
     47        struct mfs_dentry_info *d_info = malloc(sizeof(*d_info));
    4848
    4949        if (!d_info)
     
    5151
    5252        int r = read_map(&block, mnode, index * sbi->dirsize);
    53 
    5453        if (r != EOK || block == 0)
    5554                goto out_err;
    5655
    5756        r = block_get(&b, inst->handle, block, BLOCK_FLAGS_NONE);
    58 
    5957        if (r != EOK)
    6058                goto out_err;
     59
     60        unsigned dentries_per_zone = sbi->block_size / sbi->dirsize;
     61        unsigned dentry_off = index % (dentries_per_zone - 1);
    6162
    6263        if (sbi->fs_version == MFS_VERSION_V3) {
     
    6465
    6566                d3 = b->data;
     67                d3 += dentry_off;
    6668                d_info->d_inum = conv32(sbi->native, d3->d_inum);
    6769                memcpy(d_info->d_name, d3->d_name, MFS3_MAX_NAME_LEN);
     
    7375
    7476                d = b->data;
     77                d += dentry_off;
    7578                d_info->d_inum = conv16(sbi->native, d->d_inum);
    7679                memcpy(d_info->d_name, d->d_name, namelen);
Note: See TracChangeset for help on using the changeset viewer.