Issue 9: Meta Data Printing
Reported by postri...@gmail.com, Dec 19, 2008
Hello Everyone,

I have attached the initial files of metadata printing.

It is printing the superblock information of any mountpoint.

There is no error checking so enter a valid mount point only otherwise it
will give you wrong data.

To use the files download them all in one folder

make in that folder

insert the module using insmod dev1.ko

see the device name using cat /proc/devices

run mknod /dev/ohsm_meta c 248 0

the 248 should be replaced by major number you are getting

compile user.c

run the program 

enter the mount point

cross check by entering the device name in tune2fs -l

To print the meta data related to the ext2 fs i need to use the functions
of the ext2 module like block group etc.

I am exporting the functions but there seems to be a problem.

I am not able to use the exported functions.

If any body has any idea then kindly comment.

Makefile
154 bytes   View   Download
dev1.c
20.3 KB   View   Download
user.c
6.6 KB   View   Download
Dec 19, 2008
Project Member #1 sandeepksinha
I have added few new labels so, add these labels whenever you open  new issue.
e.g. for this Test-Code-Module, this tests the module functionality at the code level.
Labels: Type-Task Test-Code-Module
Dec 20, 2008
Project Member #2 sandeepksinha
The struct nameidata has changed over 2.6.24 to the recent version and hence this
code is not working.

I think we need to finalise a kernel version. I think 2.6.27 is good.

Dec 20, 2008
Project Member #3 sandeepksinha
Hi Rishi,
I could run through your code and here are some comments on them.

1. The fops structure should not necesarrily contain .read,.write, etc when you don't
need them. You can remove everything except .ioctl.

2. Remove the code for the above options we dont need it.

3. I can see the size of mount point is 20 characters, make it 256, remember that you
should have referred it from the FS code. AFAIK, ext2 supports mountpoint size upto 256.

4. Use #define MAX_MOUNT_LENGTH 256 intead of magic numbers, which the reader of the
code will never understand. He will keep on thinking why 20 and why not 10 ?

5. move the whole code of your "ext2 super block read for a mount point" to a
separate file, say ohsm_ext2_read_super.c and ohsm_ioctl.c for this file.
I want this file to be a perfect framework for our OHSM.

6. Add a include directory and move the following headers for these two files.
The name of header should be same as these C files, except that they will be with an
extension of .h.

7. Also, replace printk with dbg_printk and in the header add something like this.
#ifdef DEBUG
#define dbg_printk(x) printk(x)
#else
#define dbg_printk /* */

So, whenever you set #define DEBUG 1 in makefile, you will see all the messages being
printed else, it will all be replaced with /* */ at the time of compilation.


Rest its fine. It need sanity but that we can see later on. I think moving the
structures itself to a header file should solve your problem.

We should be able to upload this at the earliest.
Status: Started
Dec 21, 2008
#4 postri...@gmail.com
The almost final meta data printing module is ready.

It takes the mount point from the user and prints the ext2_sb-info structure and the
block group descriptors of the mounted file system.

I have attached the makefile, the header file ohsm_meta_module.h, the char device
driver ohsm_meta-module.c and the user space program ohsm_meta_user.c

compile all the files and make a device in /dev named as "ohsm_meta" using mknod

insert the module ohsm_meta_module.ko

run the program from user space ohsm_meta_user.c

enter the mount point 

check in dmesg the output
Makefile
166 bytes   View   Download
ohsm_meta_module.h
508 bytes   View   Download
ohsm_meta_user.c
1.6 KB   View   Download
ohsm_meta_module.c
8.3 KB   View   Download
Dec 21, 2008
Project Member #5 sandeepksinha
Program looks good and ok.
Its working fine at my end.
Just the option for displaying info for a particular inode remians.
Lowering the priority as most of the work is almost done...
Status: In-progress
Labels: -Priority-High Priority-Medium
Dec 21, 2008
#6 postri...@gmail.com
I have modified the files a little. Kindly download the new files.
Makefile
166 bytes   View   Download
ohsm_meta_user.c
1.7 KB   View   Download
ohsm_meta_module.h
508 bytes   View   Download
ohsm_meta_module.c
8.3 KB   View   Download
Dec 21, 2008
Project Member #7 sandeepksinha
Hi rishi, 
In the ohsm_meta_module.c, the last two functions, i would need some changes.
1. remove magic number from cases. remove unused cases.
2. I can see printk before variable declarations. correct it.
3. Move all the definitions in this file to a header file.

This  work shoudl be done immediately.

Dec 22, 2008
#8 postri...@gmail.com
I have made the specified changes
ohsm_meta_module.c
7.4 KB   View   Download
ohsm_meta_module.h
2.0 KB   View   Download
ohsm_meta_user.c
1.6 KB   View   Download
Makefile
166 bytes   View   Download
Dec 29, 2008
Project Member #9 imreckless@gmail.com
Metadata printing is done, and we have successfully tested it.
It is giving us the required information.
I am closing this issue.
Status: Done