Commit 206738e2 authored by root's avatar root
Browse files

redundant superblock extraction

parent 0f3a0a70
obj-m += extractmd.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules -Wall -Wformat=0
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
......@@ -20,8 +20,9 @@ static int extractmd_ioctl(struct inode *, struct file *, struct extractmd_path
static int device_open(struct inode *, struct file *);
static int device_release(struct inode *, struct file *);
static struct ext4_group_desc *extractmd_get_group_desc(struct super_block *sb, ext4_group_t block_group);
static unsigned long extractmd_pow(unsigned long , unsigned long);
static inline ext4_fsblk_t extractmd_group_first_block_no(struct super_block *, ext4_group_t);
static struct ext4_group_desc *extractmd_get_group_desc(struct super_block *, ext4_group_t);
//static int extractmd_get_inode_loc(struct inode *, struct ext4_iloc *);
ext4_fsblk_t extractmd_block_bitmap(struct super_block *, struct ext4_group_desc *);
ext4_fsblk_t extractmd_inode_table(struct super_block *, struct ext4_group_desc *);
......@@ -78,8 +79,9 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
int i = 0;
unsigned long nr_gd; // number of groupd descriptors
unsigned long nr_inode_table_block; // number of inode table blocks
struct buffer_head *bh_sb;
//unsigned long nr_reserved_gdt; // number of reserved gdts in a group;
struct buffer_head *bh_sb;
struct super_block *sb = fp->f_inode->i_sb; // get super_block of vfs
//struct super_block *sb = fp->f_path.mnt->mnt_sb;
struct ext4_sb_info *sbi = EXT4_SB(sb); // get ext4_sb_info
......@@ -89,6 +91,10 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
nr_gd = sbi->s_gdb_count * sbi->s_desc_per_block;
nr_inode_table_block = sbi->s_itb_per_group;
/*****************************************************/
//nr_reserved_gdt = sbi->s_es->s_reserved_gdt_blocks;
/*****************************************************/
/* set path and filenames */
sprintf(path_super_block, "%s/super_block", p->path);
sprintf(path_group_descriptor, "%s/group_descriptor", p->path);
......@@ -108,15 +114,66 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
/* super block in Group 0 */
bh_sb = __bread(bdev, 0, EXT4_BLOCK_SIZE(sb));
extractmd_write_file(path_super_block, bh_sb->b_data, EXT4_BLOCK_SIZE(sb));
//extractmd_write_file_per_group(p->path_super_block, bh_sb->b_data, EXT4_BLOCK_SIZE(sb), 0);
extractmd_write_file_per_group(path_super_block, bh_sb->b_data, EXT4_BLOCK_SIZE(sb), 0);
/* sparse super block v2? */
if((sbi->s_es->s_feature_compat & 0x200) == 1)
{
struct buffer_head *bh_redundant_sb1;
struct buffer_head *bh_redundant_sb2;
bh_redundant_sb1 = __bread(bdev, extractmd_group_first_block_no(sb, sbi->s_es->s_backup_bgs[0]), EXT4_BLOCK_SIZE(sb));
bh_redundant_sb2 = __bread(bdev, extractmd_group_first_block_no(sb, sbi->s_es->s_backup_bgs[1]), EXT4_BLOCK_SIZE(sb));
extractmd_write_file_per_group(path_super_block, bh_redundant_sb1->b_data, EXT4_BLOCK_SIZE(sb), 1);
extractmd_write_file_per_group(path_super_block, bh_redundant_sb2->b_data, EXT4_BLOCK_SIZE(sb), 2);
}
/* sparse super block? Yes -> then sb in group 0 or a power of 3, 5, or 7 */
else if((sbi->s_es->s_feature_ro_compat & 0x1) == 1)
{
unsigned long x,y,z;
struct buffer_head *bh_redundant_sb;
for (x = 1; extractmd_pow(3,x) < nr_group; x++)
{
bh_redundant_sb = __bread(bdev, extractmd_group_first_block_no(sb,extractmd_pow(3,x)), EXT4_BLOCK_SIZE(sb));
extractmd_write_file_per_group(path_super_block, bh_redundant_sb->b_data, EXT4_BLOCK_SIZE(sb),extractmd_pow(3,x));
}
for (y = 1; extractmd_pow(5,y) < nr_group; y++)
{
bh_redundant_sb = __bread(bdev, extractmd_group_first_block_no(sb,extractmd_pow(5,y)), EXT4_BLOCK_SIZE(sb));
extractmd_write_file_per_group(path_super_block, bh_redundant_sb->b_data, EXT4_BLOCK_SIZE(sb),extractmd_pow(5,y));
}
for (z = 1; extractmd_pow(7,z) < nr_group; z++)
{
bh_redundant_sb = __bread(bdev, extractmd_group_first_block_no(sb,extractmd_pow(7,z)), EXT4_BLOCK_SIZE(sb));
extractmd_write_file_per_group(path_super_block, bh_redundant_sb->b_data, EXT4_BLOCK_SIZE(sb),extractmd_pow(7,z));
}
}
else
{
int k;
struct buffer_head *bh_redundant_sb;
for (k = 1; k < nr_group; k++)
{
bh_redundant_sb = __bread(bdev, extractmd_group_first_block_no(sb, k), EXT4_BLOCK_SIZE(sb));
extractmd_write_file_per_group(path_super_block, bh_redundant_sb->b_data, EXT4_BLOCK_SIZE(sb), k);
}
}
/* group descriptors, bit maps, inode tables */
for(i = 0; i < nr_group; i++)
{
struct ext4_group_desc *group = extractmd_get_group_desc(sb, i);
struct buffer_head *bh_group_descriptor = __bread(bdev, 1, EXT4_DESC_SIZE(sb) * nr_gd);
struct buffer_head *bh_group_descriptor = __bread(bdev, extractmd_group_first_block_no(sb, i) + 1, EXT4_DESC_SIZE(sb) * nr_gd);
struct buffer_head *bh_block_bitmap = __bread(bdev, extractmd_block_bitmap(sb, group), EXT4_BLOCK_SIZE(sb));
struct buffer_head *bh_inode_bitmap = __bread(bdev, extractmd_inode_bitmap(sb, group), EXT4_BLOCK_SIZE(sb));
struct buffer_head *bh_inode_table = __bread(bdev, extractmd_inode_table(sb, group), EXT4_BLOCK_SIZE(sb) * nr_inode_table_block);
......@@ -127,13 +184,37 @@ static int extractmd_ioctl(struct inode *inode, struct file *f, struct extractmd
extractmd_write_file_per_group(path_inode_table , bh_inode_table->b_data, EXT4_BLOCK_SIZE(sb) * nr_inode_table_block, i);
}
filp_close(fp, NULL);
filp_close(fp_dev, NULL);
return 0;
}
static unsigned long extractmd_pow(unsigned long base, unsigned long exponent)
{
unsigned long i = 0;
unsigned long ret = 1;
if (exponent == 0)
{
return 1;
}
else
{
for (i = 0; i < exponent; i++)
ret = ret * base;
}
return ret;
}
static inline ext4_fsblk_t extractmd_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
{
return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
}
static struct ext4_group_desc *extractmd_get_group_desc(struct super_block *sb, ext4_group_t block_group)
{
unsigned int group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb);
......@@ -169,6 +250,7 @@ static int device_release(struct inode *inode, struct file *file)
return 0;
}
long extractmd_write_file(char *path, char* data, unsigned long size)
{
long ret;
......@@ -205,10 +287,6 @@ long extractmd_write_file_per_group(char * path, char* data, unsigned long size,
return ret;
}
module_init(init_extractmd);
module_exit(cleanup_extractmd);
......
......@@ -120,6 +120,125 @@ struct extractmd_super_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
*/
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -10,75 +10,212 @@ int main()
{
FILE *fp;
unsigned char *buffer = (unsigned char *)malloc(4096);
struct extractmd_super_block *sb;
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);
fp = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp);
// sb = (struct extractmd_super_block *)buffer;
sb = (struct extractmd_super_block *)buffer;
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);
// 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;
FILE *fp0 = fopen("/home/user/md/super_block0", "r");
fread(buffer, 4096, 1, (FILE*)fp0);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
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);
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_block49", "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_block5", "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_block7", "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_block9", "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);
// FILE *fp0 = fopen("/home/user/md/super_block0", "r");
// fread(buffer, 4096, 1, (FILE*)fp0);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp1 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp1);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp1 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp1);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp2 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp2);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp2 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp2);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp3 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp3);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp3 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp3);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp4 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp4);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp4 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp4);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp5 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp5);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp5 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp5);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp6 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp6);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp6 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp6);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp7 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp7);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp7 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp7);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp8 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp8);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp8 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp8);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
FILE *fp9 = fopen("/home/user/md/super_block", "r");
fread(buffer, 4096, 1, (FILE*)fp9);
sb = (struct extractmd_super_block *)buffer;
printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
// FILE *fp9 = fopen("/home/user/md/super_block", "r");
// fread(buffer, 4096, 1, (FILE*)fp9);
// sb = (struct extractmd_super_block *)buffer;
// printf("s_free_inodes_count : %lu\n",sb->s_free_inodes_count);
......@@ -117,5 +254,4 @@ int main()
//fclose(fp);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment