[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access content of file via inodes
Hi Nitin,
I did a simple test to see if b_data points to the actual data of the
file/inode.
I am using ext2 (non-journaling fs) for my test partition.
...
Apr x 1x:50:50 x kernel: vfs_unlink: blkbits[12], blks_per_pg[1],
pblock[0], lblock[26]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132130]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132131]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132132]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132133]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132134]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132135]
Apr x 1x:50:50 x kernel: vfs_unlink: memset bh->b_data of block [@132136]
...
Looks like I managed to get the blocks that belong to this particular inode.
But when I try to zero b_data, the data still appears in the hard disk device
(verified using hexdump).
Any idea why? It's been troubling me for days.
Regards,
Kathy
On Apr 5, 2005 3:26 PM, nitin ahuja <nitin2ahuja@xxxxxxxxxxxxx> wrote:
> Hi,
>
> >
> > How do I access/read the content of the files via > using inodes
> > or blocks that belong to the inode, at sys_link and > vfs_link layer?
> > I used bmap to access the blocks that belongs to the > inodes, but
> > getting access to the buffer_head's b_data doesn't > seem to help.
> >
>
> In struct buffer_head, b_data points to memory region of size 4K containing data of the desired block. So you can memcpy it to your buffer.
>
> Nitin
>
>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/