"seekable" device

Fernando RUIZ CASAS correo at fernando-ruiz.com
Wed Mar 27 13:53:52 UTC 2002


Don't touch it.
rtems read increase it (or decrease) by you.
You only need seek the device at rw_args->offset position and to do the
transfer.
Your internal fpos is only for you.
read() and write() don't need it.
when you call fseek() you are setting this offset.
In the case of devices is a dummy call becuse you only set this offset, not
the device.
Very easy. Don't complicate it.

Am I right?
BRGDS

Fernando RUIZ CASAS
home: correo at fernando-ruiz.com
work: fernando.ruiz at ctv.es



> -----Mensaje original-----
> De: Pattara Kiatisevi [mailto:pkiatisevi at student.ei.uni-stuttgart.de]
> Enviado el: miercoles, 27 de marzo de 2002 12:46
> Para: 'RTEMS Users'
> CC: oggonachip at yahoogroups.com
> Asunto: Re: "seekable" device
>
>
> 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