Exemple #1
0
bool create_bad_block_inode( PEXT2_FILESYS Ext2Sys,
                             PEXT2_BADBLK_LIST bb_list)
{
    bool            retval;
    EXT2_INODE      inode;
    LARGE_INTEGER   SysTime;
    
    NtQuerySystemTime(&SysTime);

    ext2_mark_inode_bitmap(Ext2Sys->inode_map, EXT2_BAD_INO);

    Ext2Sys->group_desc[0].bg_free_inodes_count--;
    Ext2Sys->ext2_sb->s_free_inodes_count--;

    memset(&inode, 0, sizeof(EXT2_INODE));
    inode.i_mode = (USHORT)((0777 & ~Ext2Sys->umask));
    inode.i_uid = inode.i_gid = 0;
    inode.i_blocks = 0;
    inode.i_block[0] = 0;
    inode.i_links_count = 2;
    RtlTimeToSecondsSince1970(&SysTime, &inode.i_mtime);
    inode.i_ctime = inode.i_atime = inode.i_mtime;
    inode.i_size = 0;

    retval = ext2_save_inode(Ext2Sys, EXT2_BAD_INO, &inode);

    return retval;
}
Exemple #2
0
bool ext2_reserve_inodes(PEXT2_FILESYS fs)
{
    ULONG   i;
    int     group;

    for (i = EXT2_ROOT_INO + 1; i < EXT2_FIRST_INODE(fs->ext2_sb); i++)
    {
        ext2_mark_inode_bitmap(fs->inode_map, i);
        group = ext2_group_of_ino(fs, i);
        fs->group_desc[group].bg_free_inodes_count--;
        fs->ext2_sb->s_free_inodes_count--;
    }

    return true;
}
Exemple #3
0
void ext2_inode_alloc_stats2(PEXT2_FILESYS fs, ULONG ino,
                   int inuse, int isdir)
{
    int group = ext2_group_of_ino(fs, ino);

    if (inuse > 0)
        ext2_mark_inode_bitmap(fs->inode_map, ino);
    else
        ext2_unmark_inode_bitmap(fs->inode_map, ino);

    fs->group_desc[group].bg_free_inodes_count -= inuse;

    if (isdir)
        fs->group_desc[group].bg_used_dirs_count += inuse;

    fs->ext2_sb->s_free_inodes_count -= inuse;
}