Commit 1d0f3af5 authored by root's avatar root
Browse files

external journal

parent 206738e2
......@@ -631,12 +631,6 @@ deps_/home/user/Team_Safdar/extractmd/extractmd.o := \
$(wildcard include/config/amd/iommu.h) \
include/linux/pm_wakeup.h \
include/linux/mount.h \
arch/x86/include/asm/uaccess.h \
$(wildcard include/config/x86/intel/usercopy.h) \
$(wildcard include/config/debug/strict/user/copy/checks.h) \
arch/x86/include/asm/smap.h \
$(wildcard include/config/x86/smap.h) \
arch/x86/include/asm/uaccess_64.h \
include/linux/buffer_head.h \
include/linux/pagemap.h \
include/linux/mm.h \
......@@ -681,6 +675,12 @@ deps_/home/user/Team_Safdar/extractmd/extractmd.o := \
include/linux/highmem.h \
$(wildcard include/config/debug/highmem.h) \
include/linux/uaccess.h \
arch/x86/include/asm/uaccess.h \
$(wildcard include/config/x86/intel/usercopy.h) \
$(wildcard include/config/debug/strict/user/copy/checks.h) \
arch/x86/include/asm/smap.h \
$(wildcard include/config/x86/smap.h) \
arch/x86/include/asm/uaccess_64.h \
include/linux/hardirq.h \
include/linux/ftrace_irq.h \
$(wildcard include/config/ftrace/nmi/enter.h) \
......
......@@ -5,15 +5,13 @@
#include <linux/device.h>
#include <linux/mount.h>
#include <linux/string.h>
#include <linux/buffer_head.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
#include <linux/buffer_head.h>
#include "extractmd.h"
#include "linux-4.0.9/fs/ext4/ext4.h"
/* Prototypes */
static int __init init_extractmd(void);
static void __exit cleanup_extractmd(void);
static int extractmd_ioctl(struct inode *, struct file *, struct extractmd_path *);
......@@ -23,7 +21,7 @@ static int device_release(struct inode *, struct file *);
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 *);
ext4_fsblk_t extractmd_inode_bitmap(struct super_block *, struct ext4_group_desc *);
......@@ -34,7 +32,6 @@ long extractmd_write_file_per_group(char *, char*, unsigned long, int);
#define DEVICE_NAME "extractmd" /* Dev name as it appears in /proc/devices */
#define MAJOR_NUM 199 /* Device MAJOR number */
/* Global variables are declared as static, so are global within the file.*/
static struct class *my_class;
static dev_t devt;
......@@ -184,9 +181,26 @@ 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);
}
/*
* external journal : On the journal device there will be an ext4 super block in the usual place, with a matching UUID.
* this module extracts uuid of the journal devices and write them on a file name "external_journal".
*/
if ((sbi->s_es->s_journal_inum | 0x0) == 0x0)
{
int u;
unsigned long j_buff[16];
char path_external_journal[255] = {0};
sprintf(path_external_journal, "%s/external_journal", p->path);
for (u = 0; u < 16; u ++)
j_buff[u] = sbi->s_es->s_journal_uuid[u];
extractmd_write_file(path_external_journal, (char *)j_buff, sizeof(unsigned long) * 16);
}
filp_close(fp, NULL);
filp_close(fp_dev, NULL);
return 0;
}
......
No preview for this file type
No preview for this file type
......@@ -164,6 +164,31 @@ int main()
fclose(fp);
// fp = fopen("/home/user/md/external_journal", "r");
// fread(buffer, sizeof(unsigned long) * 16, 1, (FILE*)fp);
// unsigned long *a = (unsigned long *)buffer;
// printf("s_inodes_count : %lu\n",a[0]);
// printf("s_inodes_count : %lu\n",a[1]);
// printf("s_inodes_count : %lu\n",a[2]);
// printf("s_inodes_count : %lu\n",a[3]);
// printf("s_inodes_count : %lu\n",a[4]);
// printf("s_inodes_count : %lu\n",a[5]);
// printf("s_inodes_count : %lu\n",a[6]);
// printf("s_inodes_count : %lu\n",a[7]);
// printf("s_inodes_count : %lu\n",a[8]);
// printf("s_inodes_count : %lu\n",a[9]);
// printf("s_inodes_count : %lu\n",a[10]);
// printf("s_inodes_count : %lu\n",a[11]);
// printf("s_inodes_count : %lu\n",a[12]);
// printf("s_inodes_count : %lu\n",a[14]);
// printf("s_inodes_count : %lu\n",a[14]);
// printf("s_inodes_count : %lu\n",a[15]);
// fclose(fp);
// FILE *fp0 = fopen("/home/user/md/super_block0", "r");
......
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