ReactOS
0.4.15-dev-8621-g4b051b9
Badblock.c
Go to the documentation of this file.
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
16
bool
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
}
create_bad_block_inode
bool create_bad_block_inode(PEXT2_FILESYS Ext2Sys, PEXT2_BADBLK_LIST bb_list)
Definition:
Badblock.c:16
ext2_save_inode
bool ext2_save_inode(PEXT2_FILESYS Ext2Sys, ULONG no, PEXT2_INODE pInode)
Definition:
Inode.c:59
Mke2fs.h
ext2_mark_inode_bitmap
#define ext2_mark_inode_bitmap
Definition:
Mke2fs.h:216
EXT2_BAD_INO
#define EXT2_BAD_INO
Definition:
ext2_fs.h:58
RtlTimeToSecondsSince1970
BOOLEAN NTAPI RtlTimeToSecondsSince1970(PLARGE_INTEGER Time, PULONG ElapsedSeconds)
NtQuerySystemTime
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition:
time.c:569
USHORT
unsigned short USHORT
Definition:
pedump.c:61
memset
#define memset(x, y, z)
Definition:
compat.h:39
_ext2_filesys
Definition:
Mke2fs.h:152
_ext2_filesys::ext2_sb
PEXT2_SUPER_BLOCK ext2_sb
Definition:
Mke2fs.h:159
_ext2_filesys::umask
__u32 umask
Definition:
Mke2fs.h:170
_ext2_filesys::inode_map
PEXT2_INODE_BITMAP inode_map
Definition:
Mke2fs.h:161
_ext2_filesys::group_desc
PEXT2_GROUP_DESC group_desc
Definition:
Mke2fs.h:158
ext2_group_desc::bg_free_inodes_count
__u16 bg_free_inodes_count
Definition:
ext2_fs.h:154
ext2_inode
Definition:
ext2.h:124
ext2_struct_badblocks_list
Definition:
Mke2fs.h:142
ext2_super_block::s_free_inodes_count
__u32 s_free_inodes_count
Definition:
ext2_fs.h:351
inode
Definition:
fs.h:78
inode::i_blocks
__u64 i_blocks
Definition:
fs.h:85
inode::i_gid
gid_t i_gid
Definition:
fs.h:89
inode::i_block
__u32 i_block[15]
Definition:
fs.h:86
inode::i_mtime
__u32 i_mtime
Definition:
fs.h:83
inode::i_size
loff_t i_size
Definition:
fs.h:80
inode::i_mode
umode_t i_mode
Definition:
fs.h:87
inode::i_uid
uid_t i_uid
Definition:
fs.h:88
inode::i_atime
__u32 i_atime
Definition:
fs.h:81
inode::i_ctime
__u32 i_ctime
Definition:
fs.h:82
_LARGE_INTEGER
Definition:
typedefs.h:103
sdk
lib
fslib
ext2lib
Badblock.c
Generated on Sun Sep 8 2024 06:13:38 for ReactOS by
1.9.6