LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kernel data structure modification (https://www.linuxquestions.org/questions/linux-newbie-8/kernel-data-structure-modification-4175556659/)

Kullu 10-20-2015 05:29 AM

Kernel data structure modification
 
I am new to linux kernel development
I want to add one field to struct inode. My question is how can I add a field to it

smallpond 10-21-2015 06:01 AM

You are free to add anything you want to your copy of the kernel.

gdejonge 10-21-2015 09:01 AM

That's simple.
1. Download the kernel source files.
2. Locate the place where the inode struct is defined.
3. Add your new field.
4. Recompile your kernel.

Of course this probably will break half of your programs and will be guaranteed to corrupt your file system, but hey, it's open source and you are free to do with it whatever you want.


Sorry, could resist.

Problem with your question is that it's to vague to give a clear answer.
For example. You don't tell us what file-system you're thinking of.
Also you don't tell us why you wan't to add this field. If you would explain the reason for it, maybe someone could direct you to an alternative that is more in line with what you want to do.

If you are serious about going into kernel development you should visit the kernelnewbies site.

Cheers.

Kullu 10-28-2015 02:10 AM

I want to calculate no of pages used per inode, that is why I want to include that field into inode structure so that in /proc file I can traverse through all inodes and print no of pages per inode in /proc file...


All times are GMT -5. The time now is 07:58 AM.