device driver code that can response to SEEK_END

Fernando RUIZ CASAS fernando.ruiz at ctv.es
Thu Apr 25 08:04:06 UTC 2002


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.

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 fenando-ruiz.com
work:fernando.ruiz at ctv.es


-----Mensaje original-----
De: Pattara Kiatisevi [mailto:pkiatisevi at student.ei.uni-stuttgart.de]
Enviado el: miercoles, 24 de abril de 2002 16:27
Para: 'RTEMS Users'
CC: oggonachip at yahoogroups.com
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 http://www.fsf.org/philosophy/no-word-attachments.html
----------------------------------------------------------------------
Ott Pattara Kiatisevi 				   T L W G
M.Sc. INFOTECH Student, Stuttgart, Germany	http://linux.thai.net/
----------------------------------------------------------------------





More information about the users mailing list