Deos-headers package proposal

From DDCIDeos
Jump to navigationJump to search

Single Header, Multiple Component (SHMC)

Several whiles ago the driver team needed a way to provide a single header file from multiple drivers.

The way it works:

  • Example: i2c-ioctl.h
    • A header file containing fairly common ioctl request codes for I2C drivers.
    • All of our I2C drivers have the same request codes for the same function.
    • Portability, reuse, savings.
  • A component, vfile-common-headers, is where the i2c-ioctl.h header file is stored, maintained, PCRed, and importantly, where it is delivered from.
    • An I2C driver svn:externs the i2c-ioctl.h header so that it can provide the ioctl requests.
    • If this I2C driver is verified, the verification of the svn:externed i2c-ioctl.h header occurs as does verification of any other svn:extern.

All is good.

stdio.h

A DVMS improvement proposal would like to add the stdio FILE APIs.

  • You know: fopen, fread, fwrite, ftell, fseek, fclose, ...
    • These naturally contain a RAM buffer which improves performance by reducing calls to media for small read/write requests.

The problem: stdio.h, where the prototypes of these functions belong, is owned/delivered by ANSI.

deos-headers package proposal

Solution proposed:

  • Similar to vfile-common-headers, create a SHMC component called deos-headers (?).
  • But it's not quite as simple as the I2C example above.
    • stdio.h has DEOSBASEAPI/DEOSABIAPI function prototypes in it.
    • ANSI provides the implementation of functions that are in its delivered stdio.h.
      • vfile would like to provide the implementation of functions that aren't in ANSI's stdio.h.
      • ANSI shouldn't have to be bothered with stdio.h content that it doesn't provide or care about.
        • In fact, adding the stdio FILE APIs to ANSI's stdio.h would likely cause an issue with our exported symbols checker.

Coming up for air. Where to go from here?

Proposal:

  1. Rename ANSI stdio.h to ansi-stdio.h.
  2. ANSI delivers ansi-stdio.h to DI_DESK_INCLUDE_PROJECT (/desk/include/ansi)
  3. vfile creates and delivers vfile-stdio.h to DI_DESK_INCLUDE_PROJECT (/desk/include/vfile)
  4. Add stdio.h to deos-headers component, content of:

#include <ansi-stdio.h>
#include <vfile-stdio.h>

  1. Users would include, as usual, <stdio.h>

Problems:

  1. The deos-headers stdio.h assumes ANSI and vfile are delivered to a customer.
    • Someone suggested the /desk/include/stdio.h could be generated by a postinstall script which would include all stdio-*.h found in the installation media.

errno.h

We'd all like one place to put errno values.

  • We'd all like to not have to unrelease ANSI to accomplish this.
  • ANSI only owns this because it provides strerror_r.
    • A proposal for strerror_r was to include a file that is the error strings which would be parsed at start-up so that strerror_r could index into the file to find the proper string.

other.h?

I'm sure there are other headers out there that could use some attention.