1 /* 2 * PROJECT: Mke2fs 3 * FILE: Badblock.c 4 * PROGRAMMER: Matt Wu <mattwu@163.com> 5 * HOMEPAGE: http://ext2.yeah.net 6 */ 7 8 /* INCLUDES **************************************************************/ 9 10 #include "Mke2fs.h" 11 12 /* DEFINITIONS ***********************************************************/ 13 14 /* FUNCTIONS *************************************************************/ 15 create_bad_block_inode(PEXT2_FILESYS Ext2Sys,PEXT2_BADBLK_LIST bb_list)16bool create_bad_block_inode( PEXT2_FILESYS Ext2Sys, 17 PEXT2_BADBLK_LIST bb_list) 18 { 19 bool retval; 20 EXT2_INODE inode; 21 LARGE_INTEGER SysTime; 22 23 NtQuerySystemTime(&SysTime); 24 25 ext2_mark_inode_bitmap(Ext2Sys->inode_map, EXT2_BAD_INO); 26 27 Ext2Sys->group_desc[0].bg_free_inodes_count--; 28 Ext2Sys->ext2_sb->s_free_inodes_count--; 29 30 memset(&inode, 0, sizeof(EXT2_INODE)); 31 inode.i_mode = (USHORT)((0777 & ~Ext2Sys->umask)); 32 inode.i_uid = inode.i_gid = 0; 33 inode.i_blocks = 0; 34 inode.i_block[0] = 0; 35 inode.i_links_count = 2; 36 RtlTimeToSecondsSince1970(&SysTime, &inode.i_mtime); 37 inode.i_ctime = inode.i_atime = inode.i_mtime; 38 inode.i_size = 0; 39 40 retval = ext2_save_inode(Ext2Sys, EXT2_BAD_INO, &inode); 41 42 return retval; 43 } 44