Commit 7e39f922 authored by mincheol's avatar mincheol
Browse files

clean directory

parent 55ced0f4
cmd_/home/user/Team_Safdar/extractmd/extractmd.ko := ld -r -m elf_x86_64 -T ./scripts/module-common.lds --build-id -o /home/user/Team_Safdar/extractmd/extractmd.ko /home/user/Team_Safdar/extractmd/extractmd.o /home/user/Team_Safdar/extractmd/extractmd.mod.o
cmd_/home/user/Team_Safdar/kernelmode_solution/extractmd.ko := ld -r -m elf_x86_64 -T ./scripts/module-common.lds --build-id -o /home/user/Team_Safdar/kernelmode_solution/extractmd.ko /home/user/Team_Safdar/kernelmode_solution/extractmd.o /home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o
cmd_/home/user/Team_Safdar/extractmd/extractmd.mod.o := gcc -Wp,-MD,/home/user/Team_Safdar/extractmd/.extractmd.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -m64 -mno-80387 -mno-fp-ret-in-387 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(extractmd.mod)" -D"KBUILD_MODNAME=KBUILD_STR(extractmd)" -DMODULE -c -o /home/user/Team_Safdar/extractmd/extractmd.mod.o /home/user/Team_Safdar/extractmd/extractmd.mod.c
cmd_/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o := gcc -Wp,-MD,/home/user/Team_Safdar/kernelmode_solution/.extractmd.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -m64 -mno-80387 -mno-fp-ret-in-387 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(extractmd.mod)" -D"KBUILD_MODNAME=KBUILD_STR(extractmd)" -DMODULE -c -o /home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o /home/user/Team_Safdar/kernelmode_solution/extractmd.mod.c
source_/home/user/Team_Safdar/extractmd/extractmd.mod.o := /home/user/Team_Safdar/extractmd/extractmd.mod.c
source_/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o := /home/user/Team_Safdar/kernelmode_solution/extractmd.mod.c
deps_/home/user/Team_Safdar/extractmd/extractmd.mod.o := \
deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o := \
$(wildcard include/config/module/unload.h) \
include/linux/module.h \
$(wildcard include/config/sysfs.h) \
......@@ -568,6 +568,6 @@ deps_/home/user/Team_Safdar/extractmd/extractmd.mod.o := \
include/linux/vermagic.h \
include/generated/utsrelease.h \
/home/user/Team_Safdar/extractmd/extractmd.mod.o: $(deps_/home/user/Team_Safdar/extractmd/extractmd.mod.o)
/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o: $(deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o)
$(deps_/home/user/Team_Safdar/extractmd/extractmd.mod.o):
$(deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.mod.o):
cmd_/home/user/Team_Safdar/extractmd/extractmd.o := gcc -Wp,-MD,/home/user/Team_Safdar/extractmd/.extractmd.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -m64 -mno-80387 -mno-fp-ret-in-387 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(extractmd)" -D"KBUILD_MODNAME=KBUILD_STR(extractmd)" -c -o /home/user/Team_Safdar/extractmd/extractmd.o /home/user/Team_Safdar/extractmd/extractmd.c
cmd_/home/user/Team_Safdar/kernelmode_solution/extractmd.o := gcc -Wp,-MD,/home/user/Team_Safdar/kernelmode_solution/.extractmd.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -m64 -mno-80387 -mno-fp-ret-in-387 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(extractmd)" -D"KBUILD_MODNAME=KBUILD_STR(extractmd)" -c -o /home/user/Team_Safdar/kernelmode_solution/extractmd.o /home/user/Team_Safdar/kernelmode_solution/extractmd.c
source_/home/user/Team_Safdar/extractmd/extractmd.o := /home/user/Team_Safdar/extractmd/extractmd.c
source_/home/user/Team_Safdar/kernelmode_solution/extractmd.o := /home/user/Team_Safdar/kernelmode_solution/extractmd.c
deps_/home/user/Team_Safdar/extractmd/extractmd.o := \
deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.o := \
include/linux/module.h \
$(wildcard include/config/sysfs.h) \
$(wildcard include/config/modules.h) \
......@@ -725,8 +725,8 @@ deps_/home/user/Team_Safdar/extractmd/extractmd.o := \
arch/x86/include/asm/kmap_types.h \
include/asm-generic/kmap_types.h \
include/linux/hugetlb_inline.h \
/home/user/Team_Safdar/extractmd/extractmd.h \
/home/user/Team_Safdar/extractmd/linux-4.0.9/fs/ext4/ext4.h \
/home/user/Team_Safdar/kernelmode_solution/extractmd.h \
/home/user/Team_Safdar/kernelmode_solution/linux-4.0.9/fs/ext4/ext4.h \
include/linux/blkdev.h \
$(wildcard include/config/blk/dev/io/trace.h) \
$(wildcard include/config/blk/dev/bsg.h) \
......@@ -890,8 +890,8 @@ deps_/home/user/Team_Safdar/extractmd/extractmd.o := \
include/uapi/linux/aio_abi.h \
arch/x86/include/asm/compat.h \
arch/x86/include/asm/user32.h \
/home/user/Team_Safdar/extractmd/linux-4.0.9/fs/ext4/extents_status.h \
/home/user/Team_Safdar/kernelmode_solution/linux-4.0.9/fs/ext4/extents_status.h \
/home/user/Team_Safdar/extractmd/extractmd.o: $(deps_/home/user/Team_Safdar/extractmd/extractmd.o)
/home/user/Team_Safdar/kernelmode_solution/extractmd.o: $(deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.o)
$(deps_/home/user/Team_Safdar/extractmd/extractmd.o):
$(deps_/home/user/Team_Safdar/kernelmode_solution/extractmd.o):
/home/user/Team_Safdar/extractmd/extractmd.ko
/home/user/Team_Safdar/extractmd/extractmd.o
/home/user/Team_Safdar/kernelmode_solution/extractmd.ko
/home/user/Team_Safdar/kernelmode_solution/extractmd.o
......@@ -105,7 +105,6 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
sprintf(path_block_bitmap, "%s/bd/bbitmap", p->path);
sprintf(path_inode_bitmap, "%s/bd/ibitmap", p->path);
sprintf(path_inode_table, "%s/bd/itable", p->path);
//sprintf(path_reserved_gdt, "%s/reserved_GDT", p->path);
sprintf(path_journal, "%s/journal/journal", p->path);
/* sync */
......@@ -200,17 +199,6 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
kfree(buffer_inode_table);
}
/* reserved GDT, if not flexible block group, extract reserved GDT
if ((sbi->s_es->s_feature_incompat & 0x200) != 0x200)
{
unsigned long nr_reserved_gdt = sbi->s_es->s_reserved_gdt_blocks;
for(i = 0; i < nr_group; i++)
{
struct buffer_head *bh_reserved_gdt = __bread(bdev, extractmd_group_first_block_no(sb, i) + 2, EXT4_BLOCK_SIZE(sb) * nr_reserved_gdt);
extractmd_write_file_per_group(path_reserved_gdt, bh_reserved_gdt->b_data, EXT4_BLOCK_SIZE(sb) * nr_reserved_gdt, i);
}
} */
/* journal */
for(j = 0; j < nr_journal_blocks; j++)
{
......
#include <linux/types.h>
typedef unsigned int ext4_group_t;
/*
* Structure of the super block
*/
struct extractmd_super_block {
__le64 padding[128];
/*00*/ __le32 s_inodes_count; /* Inodes count */
__le32 s_blocks_count_lo; /* Blocks count */
__le32 s_r_blocks_count_lo; /* Reserved blocks count */
__le32 s_free_blocks_count_lo; /* Free blocks count */
/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
__le32 s_first_data_block; /* First Data Block */
__le32 s_log_block_size; /* Block size */
__le32 s_log_cluster_size; /* Allocation cluster size */
/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
__le32 s_clusters_per_group; /* # Clusters per group */
__le32 s_inodes_per_group; /* # Inodes per group */
__le32 s_mtime; /* Mount time */
/*30*/ __le32 s_wtime; /* Write time */
__le16 s_mnt_count; /* Mount count */
__le16 s_max_mnt_count; /* Maximal mount count */
__le16 s_magic; /* Magic signature */
__le16 s_state; /* File system state */
__le16 s_errors; /* Behaviour when detecting errors */
__le16 s_minor_rev_level; /* minor revision level */
/*40*/ __le32 s_lastcheck; /* time of last check */
__le32 s_checkinterval; /* max. time between checks */
__le32 s_creator_os; /* OS */
__le32 s_rev_level; /* Revision level */
/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
__le16 s_def_resgid; /* Default gid for reserved blocks */
/*
* These fields are for EXT4_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
__le32 s_first_ino; /* First non-reserved inode */
__le16 s_inode_size; /* size of inode structure */
__le16 s_block_group_nr; /* block group # of this superblock */
__le32 s_feature_compat; /* compatible feature set */
/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
__le32 s_feature_ro_compat; /* readonly-compatible feature set */
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*78*/ char s_volume_name[16]; /* volume name */
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
__le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
/*
* Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
*/
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
__le32 s_journal_dev; /* device number of journal file */
__le32 s_last_orphan; /* start of list of inodes to delete */
__le32 s_hash_seed[4]; /* HTREE hash seed */
__u8 s_def_hash_version; /* Default hash version to use */
__u8 s_jnl_backup_type;
__le16 s_desc_size; /* size of group descriptor */
/*100*/ __le32 s_default_mount_opts;
__le32 s_first_meta_bg; /* First metablock block group */
__le32 s_mkfs_time; /* When the filesystem was created */
__le32 s_jnl_blocks[17]; /* Backup of the journal inode */
/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
__le32 s_r_blocks_count_hi; /* Reserved blocks count */
__le32 s_free_blocks_count_hi; /* Free blocks count */
__le16 s_min_extra_isize; /* All inodes have at least # bytes */
__le16 s_want_extra_isize; /* New inodes should reserve # bytes */
__le32 s_flags; /* Miscellaneous flags */
__le16 s_raid_stride; /* RAID stride */
__le16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
__le64 s_mmp_block; /* Block for multi-mount protection */
__le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
__u8 s_checksum_type; /* metadata checksum algorithm used */
__le16 s_reserved_pad;
__le64 s_kbytes_written; /* nr of lifetime kilobytes written */
__le32 s_snapshot_inum; /* Inode number of active snapshot */
__le32 s_snapshot_id; /* sequential ID of active snapshot */
__le64 s_snapshot_r_blocks_count; /* reserved blocks for active
snapshot's future use */
__le32 s_snapshot_list; /* inode number of the head of the
on-disk snapshot list */
#define EXT4_S_ERR_START offsetof(struct ext4_super_block, s_error_count)
__le32 s_error_count; /* number of fs errors */
__le32 s_first_error_time; /* first time an error happened */
__le32 s_first_error_ino; /* inode involved in first error */
__le64 s_first_error_block; /* block involved of first error */
__u8 s_first_error_func[32]; /* function where the error happened */
__le32 s_first_error_line; /* line number where error happened */
__le32 s_last_error_time; /* most recent time of an error */
__le32 s_last_error_ino; /* inode involved in last error */
__le32 s_last_error_line; /* line number where error happened */
__le64 s_last_error_block; /* block involved of last error */
__u8 s_last_error_func[32]; /* function where the error happened */
#define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts)
__u8 s_mount_opts[64];
__le32 s_usr_quota_inum; /* inode for tracking user quota */
__le32 s_grp_quota_inum; /* inode for tracking group quota */
__le32 s_overhead_clusters; /* overhead blocks/clusters in fs */
__le32 s_backup_bgs[2]; /* groups with sparse_super2 SBs */
__u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
__le32 s_reserved[105]; /* Padding to the end of the block */
__le32 s_checksum; /* crc32c(superblock) */
};
struct extractmd_redundant_super_block {
/*00*/ __le32 s_inodes_count; /* Inodes count */
__le32 s_blocks_count_lo; /* Blocks count */
__le32 s_r_blocks_count_lo; /* Reserved blocks count */
__le32 s_free_blocks_count_lo; /* Free blocks count */
/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
__le32 s_first_data_block; /* First Data Block */
__le32 s_log_block_size; /* Block size */
__le32 s_log_cluster_size; /* Allocation cluster size */
/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
__le32 s_clusters_per_group; /* # Clusters per group */
__le32 s_inodes_per_group; /* # Inodes per group */
__le32 s_mtime; /* Mount time */
/*30*/ __le32 s_wtime; /* Write time */
__le16 s_mnt_count; /* Mount count */
__le16 s_max_mnt_count; /* Maximal mount count */
__le16 s_magic; /* Magic signature */
__le16 s_state; /* File system state */
__le16 s_errors; /* Behaviour when detecting errors */
__le16 s_minor_rev_level; /* minor revision level */
/*40*/ __le32 s_lastcheck; /* time of last check */
__le32 s_checkinterval; /* max. time between checks */
__le32 s_creator_os; /* OS */
__le32 s_rev_level; /* Revision level */
/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
__le16 s_def_resgid; /* Default gid for reserved blocks */
/*
* These fields are for EXT4_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
__le32 s_first_ino; /* First non-reserved inode */
__le16 s_inode_size; /* size of inode structure */
__le16 s_block_group_nr; /* block group # of this superblock */
__le32 s_feature_compat; /* compatible feature set */
/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
__le32 s_feature_ro_compat; /* readonly-compatible feature set */
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*78*/ char s_volume_name[16]; /* volume name */
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
__le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
/*
* Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
*/
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
__le32 s_journal_dev; /* device number of journal file */
__le32 s_last_orphan; /* start of list of inodes to delete */
__le32 s_hash_seed[4]; /* HTREE hash seed */
__u8 s_def_hash_version; /* Default hash version to use */
__u8 s_jnl_backup_type;
__le16 s_desc_size; /* size of group descriptor */
/*100*/ __le32 s_default_mount_opts;
__le32 s_first_meta_bg; /* First metablock block group */
__le32 s_mkfs_time; /* When the filesystem was created */
__le32 s_jnl_blocks[17]; /* Backup of the journal inode */
/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
__le32 s_r_blocks_count_hi; /* Reserved blocks count */
__le32 s_free_blocks_count_hi; /* Free blocks count */
__le16 s_min_extra_isize; /* All inodes have at least # bytes */
__le16 s_want_extra_isize; /* New inodes should reserve # bytes */
__le32 s_flags; /* Miscellaneous flags */
__le16 s_raid_stride; /* RAID stride */
__le16 s_mmp_update_interval; /* # seconds to wait in MMP checking */
__le64 s_mmp_block; /* Block for multi-mount protection */
__le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
__u8 s_checksum_type; /* metadata checksum algorithm used */
__le16 s_reserved_pad;
__le64 s_kbytes_written; /* nr of lifetime kilobytes written */
__le32 s_snapshot_inum; /* Inode number of active snapshot */
__le32 s_snapshot_id; /* sequential ID of active snapshot */
__le64 s_snapshot_r_blocks_count; /* reserved blocks for active
snapshot's future use */
__le32 s_snapshot_list; /* inode number of the head of the
on-disk snapshot list */
#define EXT4_S_ERR_START offsetof(struct ext4_super_block, s_error_count)
__le32 s_error_count; /* number of fs errors */
__le32 s_first_error_time; /* first time an error happened */
__le32 s_first_error_ino; /* inode involved in first error */
__le64 s_first_error_block; /* block involved of first error */
__u8 s_first_error_func[32]; /* function where the error happened */
__le32 s_first_error_line; /* line number where error happened */
__le32 s_last_error_time; /* most recent time of an error */
__le32 s_last_error_ino; /* inode involved in last error */
__le32 s_last_error_line; /* line number where error happened */
__le64 s_last_error_block; /* block involved of last error */
__u8 s_last_error_func[32]; /* function where the error happened */
#define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts)
__u8 s_mount_opts[64];
__le32 s_usr_quota_inum; /* inode for tracking user quota */
__le32 s_grp_quota_inum; /* inode for tracking group quota */
__le32 s_overhead_clusters; /* overhead blocks/clusters in fs */
__le32 s_backup_bgs[2]; /* groups with sparse_super2 SBs */
__u8 s_encrypt_algos[4]; /* Encryption algorithms in use */
__le32 s_reserved[105]; /* Padding to the end of the block */
__le32 s_checksum; /* crc32c(superblock) */
};
/*
* Structure of a blocks group descriptor
*/
struct extractmd_group_desc
{
__le32 bg_block_bitmap_lo; /* Blocks bitmap block */
__le32 bg_inode_bitmap_lo; /* Inodes bitmap block */
__le32 bg_inode_table_lo; /* Inodes table block */
__le16 bg_free_blocks_count_lo;/* Free blocks count */
__le16 bg_free_inodes_count_lo;/* Free inodes count */
__le16 bg_used_dirs_count_lo; /* Directories count */
__le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
__le32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */
__le16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bbitmap) LE */
__le16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+ibitmap) LE */
__le16 bg_itable_unused_lo; /* Unused inodes count */
__le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
__le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
__le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
__le32 bg_inode_table_hi; /* Inodes table block MSB */
__le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
__le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
__le16 bg_used_dirs_count_hi; /* Directories count MSB */
__le16 bg_itable_unused_hi; /* Unused inodes count MSB */
__le32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */
__le16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bbitmap) BE */
__le16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+ibitmap) BE */
};
struct extractmd_inode {
__le16 i_mode; /* File mode */
__le16 i_uid; /* Low 16 bits of Owner Uid */
__le32 i_size_lo; /* Size in bytes */
__le32 i_atime; /* Access time */
__le32 i_ctime; /* Inode Change time */
__le32 i_mtime; /* Modification time */
__le32 i_dtime; /* Deletion Time */
__le16 i_gid; /* Low 16 bits of Group Id */
__le16 i_links_count; /* Links count */
__le32 i_blocks_lo; /* Blocks count */
__le32 i_flags; /* File flags */
union {
struct {
__le32 l_i_version;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__le32 i_block[15];/* Pointers to blocks */
__le32 i_generation; /* File version (for NFS) */
__le32 i_file_acl_lo; /* File ACL */
__le32 i_size_high;
__le32 i_obso_faddr; /* Obsoleted fragment address */
union {
struct {
__le16 l_i_blocks_high; /* were l_i_reserved1 */
__le16 l_i_file_acl_high;
__le16 l_i_uid_high; /* these 2 fields */
__le16 l_i_gid_high; /* were reserved2[0] */
__le16 l_i_checksum_lo;/* crc32c(uuid+inum+inode) LE */
__le16 l_i_reserved;
} linux2;
struct {
__le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
__le16 m_i_file_acl_high;
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
__le16 i_extra_isize;
__le16 i_checksum_hi; /* crc32c(uuid+inum+inode) BE */
__le32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */
__le32 i_mtime_extra; /* extra Modification time(nsec << 2 | epoch) */
__le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
__le32 i_crtime; /* File Creation time */
__le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
__le32 i_version_hi; /* high 32 bits for 64-bit version */
};
struct extractmd_path
{
char *path_device;
......
No preview for this file type
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
kernel//home/user/Team_Safdar/extractmd/extractmd.ko
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <linux/fs.h>
#include "extractmd.h"
int main()
{
FILE *fp;
unsigned char *buffer = (unsigned char *)malloc(4096);
struct extractmd_group_desc *gd;
unsigned int i;
fp = fopen("/home/user/md/group_descriptor", "r");
fread(buffer, 4096, 1, (FILE*)fp);
gd = (struct extractmd_group_desc *)buffer;
printf("%lu\n",gd[1].bg_block_bitmap_lo);
printf("%lu\n",gd[1].bg_inode_bitmap_lo);
printf("%lu\n",gd[1].bg_inode_table_lo);
printf("%lu\n",gd[1].bg_free_blocks_count_lo);
printf("%lu\n",gd[1].bg_free_inodes_count_lo);
printf("%lu\n",gd[1].bg_used_dirs_count_lo);
printf("%lu\n",gd[1].bg_flags);
printf("%lu\n",gd[2].bg_block_bitmap_lo);
printf("%lu\n",gd[2].bg_inode_bitmap_lo);
printf("%lu\n",gd[2].bg_inode_table_lo);
printf("%lu\n",gd[2].bg_free_blocks_count_lo);
printf("%lu\n",gd[2].bg_free_inodes_count_lo);
printf("%lu\n",gd[2].bg_used_dirs_count_lo);
printf("%lu\n",gd[2].bg_flags);
fclose(fp);
}
\ No newline at end of file
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <linux/fs.h>
#include "extractmd.h"
int main()
{
FILE *fp;
unsigned char *buffer = (unsigned char *)malloc(4096);
struct extractmd_super_block *sb, *sb2;
struct extractmd_redundant_super_block *rsb;
unsigned int i;
fp = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp);
sb = (struct extractmd_super_block *)buffer;
printf("META_BG: %lu\n",sb->s_feature_incompat & 0x10);
printf("s_first_meta_bg : %lu\n",sb->s_first_meta_bg);
// printf("s_inodes_count : %lu\n",sb->s_inodes_count);
// printf("s_blocks_count_lo : %lu\n",sb->s_blocks_count_lo);
// printf("s_r_blocks_count_lo : %lu\n",sb->s_r_blocks_count_lo);
// printf("s_free_blocks_count_lo : %lu\n",sb->s_free_blocks_count_lo);
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// printf("s_first_data_block : %lu\n",sb->s_first_data_block);
fclose(fp);
// fp = fopen("/home/user/md/super_block0", "r");
// fread(buffer, 4096, 1, (FILE*)fp);
// sb2 = (struct extractmd_super_block *)buffer;
// printf("s_inodes_count : %lu\n",sb2->s_inodes_count);
// printf("s_blocks_count_lo : %lu\n",sb2->s_blocks_count_lo);
// printf("s_r_blocks_count_lo : %lu\n",sb2->s_r_blocks_count_lo);
// printf("s_free_blocks_count_lo : %lu\n",sb2->s_free_blocks_count_lo);
// printf("s_free_inodes_count : %lu\n",sb2->s_free_inodes_count);
// printf("s_first_data_block : %lu\n",sb2->s_first_data_block);
// fclose(fp);
// fp = fopen("/home/user/md/super_block25", "r");
// fread(buffer, 4096, 1, (FILE*)fp);
// rsb = (struct extractmd_redundant_super_block *)buffer;
// printf("s_inodes_count : %lu\n",rsb->s_inodes_count);
// printf("s_blocks_count_lo : %lu\n",rsb->s_blocks_count_lo);
// printf("s_r_blocks_count_lo : %lu\n",rsb->s_r_blocks_count_lo);
// printf("s_free_blocks_count_lo : %lu\n",rsb->s_free_blocks_count_lo);
// printf("s_free_inodes_count : %lu\n",rsb->s_free_inodes_count);
// printf("s_first_data_block : %lu\n",rsb->s_first_data_block);
// fclose(fp);
// fp = fopen("/home/user/md/super_block27", "r");
// fread(buffer, 4096, 1, (FILE*)fp);
// rsb = (struct extractmd_redundant_super_block *)buffer;
// printf("s_inodes_count : %lu\n",rsb->s_inodes_count);
// printf("s_blocks_count_lo : %lu\n",rsb->s_blocks_count_lo);
// printf("s_r_blocks_count_lo : %lu\n",rsb->s_r_blocks_count_lo);
// printf("s_free_blocks_count_lo : %lu\n",rsb->s_free_blocks_count_lo);
// printf("s_free_inodes_count : %lu\n",rsb->s_free_inodes_count);
// printf("s_first_data_block : %lu\n",rsb->s_first_data_block);
// fclose(fp);
// fp = fopen("/home/user/md/super_block3", "r");
// fread(buffer, 4096, 1, (FILE*)fp);
// rsb = (struct extractmd_redundant_super_block *)buffer;
// printf("s_inodes_count : %lu\n",rsb->s_inodes_count);
// printf("s_blocks_count_lo : %lu\n",rsb->s_blocks_count_lo);
// printf("s_r_blocks_count_lo : %lu\n",rsb->s_r_blocks_count_lo);