Re: is there any prob in accessing new field added to inode mem structure, in some other functions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 Dec 2004 16:35:45 -0000, Vineet Shrikrishna Joglekar
<vineetjoglekar@xxxxxxxxxxxxxx> wrote:
> 
> 
> Hi all,
> 
> I am using linux 2.4.21 and I am trying to play with the etx2 file system.
> My aim is to allocate a data structure dynamically to every file that is
> opened, at the time of opening.
> What I tried to do was: added the structure pointer in the inode data
> structure "ext2_inode" say "x_ptr".


You are messing with inode structure in disk. If you have to add your
own variable in disk inode. You need to first create the file system
meta data structures yourself because the filesystem made by linux
does not have that field in ext2_inode.


> In the function "ext2_read_inode" which
> reads the hard disk copy of inode into memory, I allocated memory to this
> pointer and filled the appropriate value. I chose this function as I thought
> when a file is opened, this function will be always called once. Upto this
> is working fine.
> 
> Now when I try to use this pointer "x_ptr" in some other function, that is,
> "do_generic_file_read" - which is called while reading a file, I am not
> getting any value in that pointer, but a null. (which is supposed to be
> there as I am filling up appropriate value in function ext2_read_inode)
> In the do_generic_file_read, VFS inode is availavle, so I am trying to
> access my pointer as inode->u.ext2_i.x_ptr and I had accessed this pointer
> in the same way while allocating memory for it in read_inode. At the same
> time, in do_generic_file_read, I can access other inode parameters, but not
> this new one added.



So, when you are reading an inode from the disk which does not contain
your pointer.


> Can someone please tell me where am I going wrong, or what could be the
> alternate solution to achieve this? This is very important for me.


Can you tell me what exactly you want to do??


> Thanks and regards,
> 
> Vineet
> 
> 
>  

Regards
-- 
Manish Regmi

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux