This is the mail archive of the ecos-discuss@sources.redhat.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]
Other format: [Raw text]

Re: Problem in cyg_io_compare?


"Gary D. Thomas" <gary.thomas@mind.be> writes:

> > 2) Document the existing behavior - "it's a feature, not a bug".

> > I would be willing to contribute a documentation patch as well
> > once I am sure I understand the underlying thought behind these
> > functions.  I didn't find this either in the on-line
> > documentation, or in my copy of Anthony Massa's book.

> > Restating: it works as it does in order that the *name passed to
> > the lookup function can be added to a 'base name' known to the
> > driver to create a full name?

> Yes, that's the intention, perhaps not very well documented or
> articulated (I wrote that code oh so long ago...)

How about something along these lines:

  <funcsynopsis>
    <funcprototype>
      <funcdef>Cyg_ErrNo <function>(*lookup)</function></funcdef>
      <paramdef>struct <parameter>cyg_devtab_entry</parameter> **tab</paramdef>
      <paramdef>struct <parameter>cyg_devtab_entry</parameter> *sub_tab</paramdef>
      <paramdef>const char <parameter>name</parameter> *name</paramdef>
    </funcprototype>
  </funcsynopsis>

  <para>
    The lookup function is called from <function>cyg_io_lookup</function>
    if the name of the device in question (as declared in the
    corresponding <structname>DEVTAB_ENTRY</structname>) matches the name
    passed to <function>cyg_io_lookup</function>.
  </para>

  <para>
    The <parameter>**tab</parameter> parameter holds a pointer to the
    memory location of the devtab entry.  This indirection allows the
    device driver author to create a new devtab entry in the lookup
    function, in order to provide for pluggable devices, and devices
    where multiple instances are possible.
  </para>

  <para>
    The <parameter>*sub_tab</parameter> parameter is a
    <type>cyg_io_handle_t</type> that references a second device that
    the current driver depends on.  It has already been looked up by
    the time it is passed to the <function>lookup</function> function.
  </para>

  <para>
    The <parameter>*name</parameter> parameter holds a pointer to the
    part of a string passed to <function>cyg_io_lookup</function> that
    differs from the "base name" of a device.  For instance, a device
    might have the base name "/dev/fd".  If a lookup is performed on
    "/dev/fd/1", then the <function>lookup</function> function will be
    called with "/1" in its <parameter>name</parameter> argument.
  </para>

Of course, it needs some tweaking, as I'm not %100 sure on how **tab
might be used, but adding that would be an improvement, especially WRT
to the name parameter and it's "confusing" behavior.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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