This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: I/O driver lookup handler: read/write mode


Gary Thomas wrote:
> What are you using for your source base?  I could see about adding some of
> this, but the timing would depend on my/our workload.  Perhaps you'd like
> to propose some changes and I could review and integrate them?  (Not that
> I'm trying to get out of work, but that's part of what Open Source is all
> about :-)

I am working on eCos 1.2.7 for Matsushita MN10300/AM33.

The following changes to the I/O driver model came to my mind. I could just
do with READONLY and WRITEONLY for my driver, but these R/W modes seem to be
needed for supporting ANSI C fopen.

#define    CYG_IO_LOOKUP_MODE_READONLY    0x0001
#define    CYG_IO_LOOKUP_MODE_WRITEONLY   0x0002
#define    CYG_IO_LOOKUP_MODE_READWRITE   0x0003
#define    CYG_IO_LOOKUP_MODE_CREATE      0x0100
#define    CYG_IO_LOOKUP_MODE_APPEND      0x0200
#define    CYG_IO_LOOKUP_MODE_TRUNCATE    0x0400

Cyg_ErrNo cyg_io_lookup(const char  *name, cyg_io_handle_t *handle,  int
mode);
* Add a mode parameter for cyg_io_lookup() and a lookup handler.

Cyg_ErrNo cyg_io_close(cyg_io_handle_t handle);
* Add a new cyg_io_close function and a close handler.

This would break existing I/O device drivers. But it seems to be most
straightforward.

Jonathan Larmour wrote:
> Using cyg_io_get_config() after the cyg_io_lookup() would seem a better
> approach.

This would be fine, too; in this case,  the changes could be done locally in
the fopen code and would not affect the existing I/O device driver model.
But I like the other approach better since using cyg_io_get/set_config()
would seem to divide the task unnecessarily into two separate functions
which should  be done in cyg_io_lookup() as a unit.

> Gosh. That's good. Are you considering contributing it back?

Sure I will consider it if I can make it generic enough.

-- Masaki S.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]