Changing i_blocks field from ext4_inode.
Hello, Can we change both the fields(struct ext4_extent_header and struct ext4_extent) from i_blocks[..] of any file manually? from i_block I got header & first extent of file as follows. struct ext4_extent_header *eeh = (struct ext4_extent_header *)EXT4_I(d_inode1)->i_data; struct ext4_extent *eex = EXT_FIRST_EXTENT(eeh); from extent I got physical block numbers of file as follows. printk(KERN_INFO "high 16 bits of physical block=%d",eex->ee_start_hi); printk(KERN_INFO "low 32 bits of physical block=%d", eex->ee_start_lo); Now,I have to change this whole structure of i_blocks[..] so that new structure of i_blocks[..] contains new header as well as new physical blocks. I have tried in following way: **for ext4_extent_header: eeh->eh_entries=myeeh->eh_entries; eeh->eh_magic=myeeh->eh_magic; eeh->eh_max=myeeh->eh_max; eeh->eh_depth=myeeh->eh_depth; eeh->eh_generation=myeeh->eh_generation where myeeh is the old ext4_extent_header from which I have to copy fields in to new header i.e in eeh which contains the current header of file. **for ext4_extent : eex->ee_block=myeex->ee_block; eex->ee_len=myeex->ee_len; eex->ee_start_hi=eex->ee_start_hi; eex->ee_start_lo=myeex->ee_start_lo; where myeex is the old ext4_extent from which I have to copy fields in to new extent i.e in eex which contain the current extent of file. I have done above code by writing my own module but it is not directly making change in files ext4_inode i.e file content does not change even though I have changed physical block numbers. If above method is wrong then what is the correct way? -- Regards, Ganesh Patil.
participants (1)
-
Ganesh Patil