From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Masaki Sawanobori" To: "Jonathan Larmour" , "Gary Thomas" Cc: Subject: Re: [ECOS] I/O driver lookup handler: read/write mode Date: Tue, 30 Nov 1999 14:14:00 -0000 Message-id: <06ef01bf3b80$755dd6c0$437201aa@atlantis7> References: <062c01bf3b22$2a8be000$437201aa@atlantis7> <3843EEE1.26F8019@cygnus.co.uk> X-SW-Source: 1999-11/msg00082.html 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.