Changeset b84175a in mainline


Ignore:
Timestamp:
2011-03-11T18:33: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:
14c29ba
Parents:
0dd2717
Message:

Fix wrong use of block_write_direct(), make sure we write at least 1k per block

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkminix/mkminix.c

    r0dd2717 rb84175a  
    9797static void     mark_bmap(uint32_t *bmap, int idx, int v);
    9898static int      insert_dentries(const struct mfs_sb_info *sb);
     99
     100static inline int write_1k_block(aoff64_t off, size_t size, const void *data);
    99101
    100102static devmap_handle_t handle;
     
    310312        }
    311313
    312         rc = block_write_direct(handle, root_dblock, 1, root_block);
     314        rc = write_1k_block(root_dblock, 1, root_block);
    313315
    314316        free(root_block);
     
    338340
    339341        for (i = 0; i < itable_size; ++i, ++itable_off) {
    340                 rc = block_write_direct(handle, itable_off, 1, itable_buf);
     342                rc = write_1k_block(itable_off, 1, itable_buf);
    341343
    342344                if (rc != EOK)
     
    374376        ino_buf[MFS_ROOT_INO].i_dzone[0] = sb->first_data_zone;
    375377
    376         rc = block_write_direct(handle, itable_off, 1, ino_buf);
     378        rc = write_1k_block(itable_off, 1, ino_buf);
    377379
    378380        free(ino_buf);
     
    411413        ino_buf[MFS_ROOT_INO].i_dzone[0] = sb->first_data_zone;
    412414
    413         rc = block_write_direct(handle, itable_off, 1, ino_buf);
     415        rc = write_1k_block(itable_off, 1, ino_buf);
    414416
    415417        free(ino_buf);
     
    516518        sb->s_state = MFS_VALID_FS;
    517519
    518         rc = block_write_direct(handle, MFS_SUPERBLOCK, 1, sb);
     520        rc = write_1k_block(MFS_SUPERBLOCK, 1, sb);
    519521        free(sb);
    520522
     
    543545        sb->s_disk_version = 3;
    544546
    545         rc = block_write_direct(handle, MFS_SUPERBLOCK, 1, sb);
     547        rc = write_1k_block(MFS_SUPERBLOCK, 1, sb);
    546548        free(sb);
    547549
     
    583585
    584586        for (i = 0; i < ibmap_nblocks; ++i) {
    585                 if ((rc = block_write_direct(handle, start_block + i,
     587                if ((rc = write_1k_block(start_block + i,
    586588                                1, (ibmap_buf8 + i * MFS_BLOCKSIZE))) != EOK)
    587589                        return rc;
     
    591593
    592594        for (i = 0; i < zbmap_nblocks; ++i) {
    593                 if ((rc = block_write_direct(handle, start_block + i,
     595                if ((rc = write_1k_block(start_block + i,
    594596                                1, (zbmap_buf8 + i * MFS_BLOCKSIZE))) != EOK)
    595597                        return rc;
     
    608610        else
    609611                bmap[idx / 32] |= 1 << (idx % 32);
     612}
     613
     614static inline int write_1k_block(aoff64_t off, size_t size, const void *data)
     615{
     616        return block_write_direct(handle, off * 2, size * 2, data);     
    610617}
    611618
Note: See TracChangeset for help on using the changeset viewer.