how do i read a block
Prashant Shah
pshah.mumbai at gmail.com
Tue May 14 02:29:22 EDT 2013
Hi,
On Mon, May 13, 2013 at 9:52 PM, Matthias Brugger
<matthias.bgg at gmail.com> wrote:
>
> El 13/05/2013 10:07, "shampavman" <shampavman.cg at gmail.com> va escriure:
>
>
>>
>> Hi all,
>>
>> Supposing i create a file of size 10K, it will occupy 2 blocks (4K each).
>> Now if i want to read only 1 block from it how can i do it?
>>
>> read(fd, buf, 4096) ;
>> would this mean i would read the first block and all its contents?
>
One way to do this is use the FIBMAP ioctl to the get the block
numbers of a file and then seek the disk /dev/sdX directly and use the
read() to get data block.
Regards.
More information about the Kernelnewbies
mailing list