For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2006 > IOCTL to read a block from a partition on a filesystem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IOCTL to read a block from a partition on a filesystem
af300wsm@gmail.com

2006-07-25, 7:00 pm

Hello,

I'm very new to using IOCTL's for programming and am having difficulty
getting the information I want by searching Google. Every time I enter
something like, "IOCTL read block" etc. I get a bunch of hits on
blocking reads, etc. I'm not having trouble with blocking I/O.

What I'm after is, I want to know what the IOCTL is for reading a block
of data from an arbitrary block in a filesystem. I would imagine that
it's specific to the OS (or at the very least, not easily portable) so
the OS I'm working on is FreeBSD 6.0. I've looked through the include
files in /usr/include/sys but not being certain of what I'm looking
for, it's very tough to know if I've looked through all the right
files. So basically, what IOCTL would I use to read block 5,520 from a
file system? (Is that even the right way to ask the question?)

Because this pertains to FreeBSD, I'm cross-posting this message to the
freeBSD group too. Please forgive the cross-post.

Thanks for any help.
Andrew Falanga

Andrew Haley

2006-07-25, 7:00 pm

In comp.unix.bsd.freebsd.misc af300wsm@gmail.com wrote:
> Hello,


> I'm very new to using IOCTL's for programming and am having difficulty
> getting the information I want by searching Google. Every time I enter
> something like, "IOCTL read block" etc. I get a bunch of hits on
> blocking reads, etc. I'm not having trouble with blocking I/O.


> What I'm after is, I want to know what the IOCTL is for reading a block
> of data from an arbitrary block in a filesystem. I would imagine that
> it's specific to the OS (or at the very least, not easily portable) so
> the OS I'm working on is FreeBSD 6.0. I've looked through the include
> files in /usr/include/sys but not being certain of what I'm looking
> for, it's very tough to know if I've looked through all the right
> files. So basically, what IOCTL would I use to read block 5,520 from a
> file system? (Is that even the right way to ask the question?)


Why would you want to use ioctl()? Open the raw device, s() 5,520
blocks, and read() the data.

Andrew.

af300wsm@gmail.com

2006-07-25, 7:00 pm


Andrew Haley wrote:
> In comp.unix.bsd.freebsd.misc af300wsm@gmail.com wrote:
>
>
>
> Why would you want to use ioctl()? Open the raw device, s() 5,520
> blocks, and read() the data.
>
> Andrew.


To be honest, ignorance. I was under the impression that to perform
what I wanted to do, I had to use ioctl( ).

Andrew

Conrad J. Sabatier

2006-07-25, 7:00 pm

In article <1153847727.131126.20090@h48g2000cwc.googlegroups.com>,
<af300wsm@gmail.com> wrote:
>
>
>Hello,
>
>I'm very new to using IOCTL's for programming and am having difficulty
>getting the information I want by searching Google. Every time I enter
>something like, "IOCTL read block" etc. I get a bunch of hits on
>blocking reads, etc. I'm not having trouble with blocking I/O.
>
>What I'm after is, I want to know what the IOCTL is for reading a block
>of data from an arbitrary block in a filesystem. I would imagine that
>it's specific to the OS (or at the very least, not easily portable) so
>the OS I'm working on is FreeBSD 6.0. I've looked through the include
>files in /usr/include/sys but not being certain of what I'm looking
>for, it's very tough to know if I've looked through all the right
>files. So basically, what IOCTL would I use to read block 5,520 from a
>file system? (Is that even the right way to ask the question?)
>
>Because this pertains to FreeBSD, I'm cross-posting this message to the
>freeBSD group too. Please forgive the cross-post.
>
>Thanks for any help.
>Andrew Falanga


No Unix programmer should be without a copy of "Advanced Programming in the
Unix Environment" by W. Richard Stevens, universally regarded as the Unix
programmers' "Bible".

I have an e-version of the book (in CHM, or Windows Help format, as its
known), if you're interested. Viewable with a number of tools available in
the FreeBSD ports collection.

Just let me know, and I'll either mail it to you, or, failing that (my ISP
has pretty strict size restrictions on e-mail), I'll setup here for you to
ftp in and grab it.

Definitely a "must-have" item!

--
Conrad J. Sabatier <conrads@cox.net> -- "In Unix veritas"
af300wsm@gmail.com

2006-07-26, 7:01 pm


Conrad J. Sabatier wrote:
> In article <1153847727.131126.20090@h48g2000cwc.googlegroups.com>,
> <af300wsm@gmail.com> wrote:
>
> No Unix programmer should be without a copy of "Advanced Programming in the
> Unix Environment" by W. Richard Stevens, universally regarded as the Unix
> programmers' "Bible".
>
> I have an e-version of the book (in CHM, or Windows Help format, as its
> known), if you're interested. Viewable with a number of tools available in
> the FreeBSD ports collection.
>
> Just let me know, and I'll either mail it to you, or, failing that (my ISP
> has pretty strict size restrictions on e-mail), I'll setup here for you to
> ftp in and grab it.
>
> Definitely a "must-have" item!
>
> --
> Conrad J. Sabatier <conrads@cox.net> -- "In Unix veritas"


I am definitely interested, so long as it's legal to share this data.
If not, please, let me know how/where I can purchase it.

Thanks,
Andy

Conrad J. Sabatier

2006-07-27, 9:59 pm

In article <1153923780.022237.92860@m79g2000cwm.googlegroups.com>,
<af300wsm@gmail.com> wrote:
>
>
>
>Conrad J. Sabatier wrote:
>
>I am definitely interested, so long as it's legal to share this data.
>If not, please, let me know how/where I can purchase it.
>
>Thanks,
>Andy


To be honest, I don't know the legal status of this particular file, and I
don't know offhand where you might find it; I got it off one of the
alt.binaries groups.

If it's really a concern, you could always shell out the $80 or so for the
hardcover printed edition. That's just not practical for me at this time. I
lost nearly my entire library of reference books in Hurricane Katrina, and
there's just no way I can afford to replace them all. These things aren't
cheap!

Drop me an e-mail if you want to pursue this further.

--
Conrad J. Sabatier <conrads@cox.net> -- "In Unix veritas"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com