"seekable" device

Pattara Kiatisevi pkiatisevi at student.ei.uni-stuttgart.de
Wed Mar 27 11:45:44 UTC 2002


Thank you for all answers but it is not yet clear. I mean, in my driver
code I have an internal "fpos" variable to keep current position. And what
I should do if there is a read (or write) call with offset:

a) fpos = rw_args->offset
b) fpos += rw_args->offset

?

I see from man page of fseek, there is the "int whence" argument, I wonder
how this argument will traverse to my driver.

If this is mentioned in any document please let me know. Thank you very
much..

Pattara

On Thu, 21 Mar 2002, Aaron J. Grier wrote:

> On Thu, Mar 21, 2002 at 05:17:48PM +0100, Pattara Kiatisevi wrote:
>
> > I have a hopefully simple question about this "fseek" function. What
> > will happen if an application calls "fseek" to a device? I mean, how
> > can I adjust my device driver (I wrote a /dev/soundinput to simulate a
> > song file) to support this seek function? Now I have only
> > soundinput_initialize(), open(), close(), read(), write() and ioctl().
>
> in the io struct (rtems_libio_rw_args_t *) passed to read and write,
> there's a member "offset" which is manipulated by fseek.  it looks
> something like this:
>
> rw_args = (rtems_libio_rw_args_t *) arg;
> buffer = rw_args->buffer;
> count = rw_args->count;
> offset = rw_args->offset;
>
> --
>   Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron at frye.com
>      "In a few thousand years people will be scratching their heads
>        wondering how on earth the first computer was invented and
>           bootstrapped without a prior computer to do it with."
>                     --  Chris Malcolm, on comp.arch
>
>




More information about the users mailing list