Changeset 4727a97a in mainline


Ignore:
Timestamp:
2011-03-08T19:59:38Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b07acd
Parents:
f0ceb1d
Message:

Set the current time in root inode and finx inode table initialization

File:
1 edited

Legend:

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

    rf0ceb1d r4727a97a  
    4949#include <mem.h>
    5050#include <str.h>
     51#include <time.h>
    5152#include <minix.h>
    5253
     
    299300        const int chunks = sb->block_size / MFS_BLOCKSIZE;
    300301
    301         for (i = 0; i < sb->itable_size; ++i, ++itable_pos)
     302        for (i = 0; i < sb->itable_size; ++i, itable_pos += chunks)
    302303                block_write_direct(sb->handle, itable_pos, chunks, itable_buf);
    303304
     
    308309{
    309310        struct mfs_inode *ino_buf;
    310         const size_t bufsize = MFS_BLOCKSIZE;
    311311        const long itable_pos = 2 + sb->zbmap_blocks + sb->ibmap_blocks;
    312312
    313         ino_buf = (struct mfs_inode *) malloc(bufsize);
    314         memset(ino_buf, 0x00, bufsize);
     313        const time_t sec = time(NULL);
     314
     315        ino_buf = (struct mfs_inode *) malloc(MFS_BLOCKSIZE);
     316        memset(ino_buf, 0x00, MFS_BLOCKSIZE);
    315317
    316318        ino_buf[MFS_ROOT_INO].i_mode = S_IFDIR;
     
    318320        ino_buf[MFS_ROOT_INO].i_gid = 0;
    319321        ino_buf[MFS_ROOT_INO].i_size = (sb->longnames ? MFSL_DIRSIZE : MFS_DIRSIZE) * 2;
    320         ino_buf[MFS_ROOT_INO].i_mtime = 0;
     322        ino_buf[MFS_ROOT_INO].i_mtime = sec;
    321323        ino_buf[MFS_ROOT_INO].i_nlinks = 2;
    322324        ino_buf[MFS_ROOT_INO].i_dzone[0] = sb->first_data_zone;
     
    332334        const size_t bufsize = MFS_MIN_BLOCKSIZE;
    333335        const long itable_pos = 2 + sb->zbmap_blocks + sb->ibmap_blocks;
     336
     337        const time_t sec = time(NULL);
    334338
    335339        ino_buf = (struct mfs2_inode *) malloc(bufsize);
     
    340344        ino_buf[MFS_ROOT_INO].i_gid = 0;
    341345        ino_buf[MFS_ROOT_INO].i_size = MFS3_DIRSIZE * 2;
    342         ino_buf[MFS_ROOT_INO].i_mtime = 0;
    343         ino_buf[MFS_ROOT_INO].i_atime = 0;
    344         ino_buf[MFS_ROOT_INO].i_ctime = 0;
     346        ino_buf[MFS_ROOT_INO].i_mtime = sec;
     347        ino_buf[MFS_ROOT_INO].i_atime = sec;
     348        ino_buf[MFS_ROOT_INO].i_ctime = sec;
    345349        ino_buf[MFS_ROOT_INO].i_nlinks = 2;
    346350        ino_buf[MFS_ROOT_INO].i_dzone[0] = sb->first_data_zone;
Note: See TracChangeset for help on using the changeset viewer.