public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] I/O driver lookup handler: read/write mode
@ 1999-11-30  2:59 Masaki Sawanobori
  1999-11-30  7:36 ` Jonathan Larmour
  1999-11-30  7:47 ` Gary Thomas
  0 siblings, 2 replies; 5+ messages in thread
From: Masaki Sawanobori @ 1999-11-30  2:59 UTC (permalink / raw)
  To: ecos-discuss

Hello,

I am implementing a simple flash memory file system in the framework of eCos
I/O device driver model and C language libc stdio module so the user can
access a file using fopen() as follows.

    FILE *fp = fopen("/dev/flash0/filename", "r");
    FILE *fp = fopen("/flash0/filename", "w");

The problem is that the second paramter(read/write mode) of fopen() is not
passed down to a "lookup" device driver handler(via the cyg_io_lookup
function). The "lookup" handler has no way of returning a correct
return/error value without knowing whether a file(existing or non-existing)
is for read or write.

I would not like to resort to a workaround of adding a read/write mode
specifier as part of a filename parameter like "/nvram/filename/w" or
"/nvram/filename/r" or "/nvramR"/filename" or "/nvramW/filename".  This
would be redundant for fopen().

Is there any other workaround or a solution for this situation? Am I missing
something ?

Here is another wish about I/O device driver handlers. There is no "close"
handler.  I could use a "close" handler since it seems to be a right place
to free memory allocated in my "lookup" handler.

-- Masaki S.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-12-01  3:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-30  2:59 [ECOS] I/O driver lookup handler: read/write mode Masaki Sawanobori
1999-11-30  7:36 ` Jonathan Larmour
1999-11-30 14:14   ` Masaki Sawanobori
1999-12-01  3:15     ` Nick Garnett
1999-11-30  7:47 ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).