This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Block devices vs Character devices.
- To: "Jonathan Larmour" <jlarmour at redhat dot com>
- Subject: RE: [ECOS] Block devices vs Character devices.
- From: <felixwong at i-technologies dot cc>
- Date: Fri, 2 Nov 2001 11:55:20 +0800
- Cc: "Ecos-Discuss" <ecos-discuss at sources dot redhat dot com>
Here is my modification of "devfs.cxx" for block device. Will the
eCos update include block devices soon?
For block device driver (devfs) to work correctly, the following codes should be
in "devfs.cxx". To replace the original character ONLY code.
in "dev_fo_read":
cyg_devtab_entry_t *t = (cyg_devtab_entry_t *)fp->f_data;
if (t->status&CYG_DEVTAB_STATUS_BLOCK)
err = cyg_io_bread( (cyg_io_handle_t)fp->f_data,
iov->iov_base,
&len,fp->f_offset);
else
err = cyg_io_read( (cyg_io_handle_t)fp->f_data,
iov->iov_base,
&len);
In "dev_fo_write":
cyg_devtab_entry_t *t = (cyg_devtab_entry_t *)fp->f_data;
if (t->status&CYG_DEVTAB_STATUS_BLOCK)
err = cyg_io_bwrite( (cyg_io_handle_t)fp->f_data,
iov->iov_base,
&len,fp->f_offset);
else
err = cyg_io_write( (cyg_io_handle_t)fp->f_data,
iov->iov_base,
&len);
-----Original Message-----
From: jlarmour@worf.jifvik.org [mailto:jlarmour@worf.jifvik.org]On Behalf Of Jonathan Larmour
Sent: Friday, November 02, 2001 11:48 AM
To: felixwong@i-technologies.cc
Cc: Ecos-Discuss
Subject: Re: [ECOS] Block devices vs Character devices.
felixwong@i-technologies.cc wrote:
>
> The block device option for eCos was added recently. I am writing a hard disk block
> device driver. However, I have some questions about how to invoke the block device feature
> of devfs. I would like to clarify something before I modify "devfs.cxx" for block devices.
>
> 1. There seems no mechanism to redirect calls to devfs's bwrite, is it true?
Not at present.
> 2. CYG_DEVTAB_STATUS_BLOCK was supposed to be used for identifing if device Block or Char?
Yes, as per CHAR_DEVTAB_ENTRY/BLOCK_DEVTAB_ENTRY definition in
io/common/current/include/devtab.h.
> How comes /dev/tty device with this flag set?
It will have used DEVIO_TABLE, which maps onto CHAR_DEVIO_TABLE in
devtab.h.
> 3. Should BLOCK devices use bread/bwrite instread of read/write?
Probably.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine