Re: Writing onto disk sector

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

 



On Wed, Aug 20, 2008 at 1:21 PM, Akhil <akhilesh.noida@xxxxxxxxx> wrote:
> I am not sure whether this is a relevant question...please ignore if
> it seems nonsense....
>
> Is it possible in linux (2.6 or 2.4) to write/read directly onto a
> particular disk sector? If yes , how?

You mean raw read ???...from kernel ?? I am not sure if this is
correct ,but you can do something like this if you have the filesystem
over it.

sb=<superblock of filesystem>
struct buffer_head *bh = sb_bread(sb,blocknumber)

blocknumber would depend on which sector do you want to read and what
is the blocksize of the filesystem.......so rougly

blockno = (sector/(sb->s_blocksize/512));

The contents of your sector would be in bh->b_data .

Hope that helps........


>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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