public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Larmour <jlarmour@cygnus.co.uk>
To: Masaki Sawanobori <masaki@zentek.com>
Cc: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] I/O driver lookup handler: read/write mode
Date: Tue, 30 Nov 1999 07:36:00 -0000	[thread overview]
Message-ID: <3843EEE1.26F8019@cygnus.co.uk> (raw)
In-Reply-To: <062c01bf3b22$2a8be000$437201aa@atlantis7>

Masaki Sawanobori wrote:
> 
> 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");

Gosh. That's good. Are you considering contributing it back? 
 
> 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().

Quite, although it wouldn't need to be passed that way for fopen, only
cyg_io_lookup.

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

Using cyg_io_get_config() after the cyg_io_lookup() would seem a better
approach.
 
> 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.

This is true. We intend to do something about that in the eCos
implementation of EL/IX, but that may take some time. We intend to do
pluggable filesystems as well, so everything should get sorted out
eventually.

Jifl
-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
 my brains kept falling out."    || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault

  reply	other threads:[~1999-11-30  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-30  2:59 Masaki Sawanobori
1999-11-30  7:36 ` Jonathan Larmour [this message]
1999-11-30 14:14   ` Masaki Sawanobori
1999-12-01  3:15     ` Nick Garnett
1999-11-30  7:47 ` Gary Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3843EEE1.26F8019@cygnus.co.uk \
    --to=jlarmour@cygnus.co.uk \
    --cc=ecos-discuss@sourceware.cygnus.com \
    --cc=masaki@zentek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).