26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Writing a resource manager<br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

connect_funcs and io_funcs<br />

These are simply the list of connect functions and I/O functions that<br />

you wish to bind to the mountpoint.<br />

handle<br />

This is an “extendable” data structure (aka “attributes structure”) that<br />

identifies the resource being mounted. For example, for a serial port,<br />

you’d extend the standard POSIX-layer attributes structure by adding<br />

information about the base address of the serial port, the baud rate,<br />

etc. Note that it does not have to be an attributes structure — if<br />

you’re providing your own “open” handler, then you can choose to<br />

interpret this field any way you wish. It’s only if you’re using the<br />

default iofunc_open_default() handler as your “open” handler that<br />

this field must be an attributes structure.<br />

The flags member can contain any of the following flags (or the constant 0 if none are<br />

specified):<br />

_RESMGR_FLAG_BEFORE or _RESMGR_FLAG_AFTER<br />

These flags indicate that your resource manager wishes to be placed before or<br />

after (respectively) other resource managers <strong>with</strong> the same mountpoint. These<br />

two flags would be useful <strong>with</strong> union’d (overlaid) filesystems. We’ll discuss the<br />

interactions of these flags shortly.<br />

_RESMGR_FLAG_DIR<br />

This flag indicates that your resource manager is taking over the specified<br />

mountpoint and below — it’s effectively a filesystem style of resource manager,<br />

as opposed to a discretely-manifested resource manager.<br />

_RESMGR_FLAG_OPAQUE<br />

If set, prevents resolving to any other manager below your mount point except<br />

for the path manager. This effectively eliminates unioning on a path.<br />

_RESMGR_FLAG_FTYPEONLY<br />

This ensures that only requests that have the same FTYPE_* as the file_type<br />

passed to resmgr_attach() are matched.<br />

_RESMGR_FLAG_FTYPEALL<br />

This flag is used when a resource manager wants to catch all client requests,<br />

even those <strong>with</strong> a different FTYPE_* specification than the one passed to<br />

resmgr_attach() in the file_type argument. This can only be used in conjunction<br />

<strong>with</strong> a registration file type of FTYPE_ALL.<br />

_RESMGR_FLAG_SELF<br />

Allow this resource manager to talk to itself. This really is a “Don’t try this at<br />

home, kids” kind of flag, because allowing a resource manager to talk to itself<br />

can break the send-hierarchy and lead to deadlock (as was discussed in the<br />

Message Passing chapter).<br />

212 Chapter 5 • Resource Managers April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!