device driver code that can response to SEEK_END

Pattara Kiatisevi pkiatisevi at
Thu Apr 25 09:15:32 UTC 2002

Oh, it is not the audio device but the simulated flash (fixed size). I
know this fixed size.

On Thu, 25 Apr 2002, Fernando RUIZ CASAS wrote:

> How many bytes have your device?
> In a flash disk device is easy but in a char device (printer, serial, audio
> ouput..)
> is not easy.
> If the offset is biggest that the device size you make a read/write past eof
> error.

so, in the read function if the offset is greater than size then I should
return -1?

And in case of the audio device, can I set sth. to have it "unseekable"?

Thank you very much,

> But in your audio device?
> You need place in the file descriptor of rtems the filesize (device size in
> this case).
> You can see this browsing the open/close/seek implementation of rtems
> filesystem.
> You can imaginate that you have a regular file and make the same that rtems
> makes
> when your open device is called like a regular file.
> The seek only moves the pointer in the rtems level. Not in the device level.
> I'm right?
> Fernando RUIZ CASAS
> home:correo at
> work:fernando.ruiz at
> -----Mensaje original-----
> De: Pattara Kiatisevi [mailto:pkiatisevi at]
> Enviado el: miercoles, 24 de abril de 2002 16:27
> Para: 'RTEMS Users'
> CC: oggonachip at
> Asunto: device driver code that can response to SEEK_END
> Hi all,
> I still have problem with this seeking problem with my device driver code.
> I found it has problem when there is a call fseek(x,0,SEEK_END). Anybody
> has idea how should i write the device driver code to let this SEEK_END
> work. I mean how should I update these variables:
> typedef struct {
>     rtems_libio_t          *iop;
>     off_t                   offset;
>     unsigned8              *buffer;
>     unsigned32              count;
>     unsigned32              flags;
>     unsigned32              bytes_moved;
> } rtems_libio_rw_args_t;
> So far I just check if offset > mydatasize then return with bytes_moved =
> 0;
> Thank you very much,
> Pattara
> --
> Please avoid sending me Word or PowerPoint attachments.
> See
> ----------------------------------------------------------------------
> Ott Pattara Kiatisevi 				   T L W G
> M.Sc. INFOTECH Student, Stuttgart, Germany
> ----------------------------------------------------------------------

More information about the users mailing list