Paul Durrant wrote:
Darren Reed wrote:
What I'd like to suggest is that we consider expanding the entry
points for regular device drivers to allow for context to be created
in open(9e), passed back in with all of the other entry points (read,
write, strategy, etc) and require the driver to clear it in close(9e).
This would change function prototypes to be something like:
int prefixopen(dev_t *devp, int flag, int otyp, cred_t *cred_p, void
**ctxp);
int prefixread(dev_t dev, struct uio *uio_p, cred_t *cred_p, void *ctx);
int prefixclose(dev_t dev, int flag, int otyp, cred_t *cred_p, void
**ctxp);
and so forth.
For existing drivers, not changing "ctxp" would result in NULL being
passed into the driver as the "ctx" pointer.
Thoughts?
I assume you'd bump CB_REV for drivers interpreting the new argument?
I assume that your plan is to store the context pointer in the struct
vnode?
Paul
While this would make some drivers simpler (the lookup of the dev_t
would be simpler), it isn't strictly necessary.
I think you could achieve the same basic result by just offering a new
set of utility routines:
* ddi_set_devt_private(dev_t, void *ctx);
* void *ddi_get_devt_private(dev_t);
This would eliminate the trouble drivers have to go thru to come up with
their own storage and retrieval logic, while not requiring a change to
the entry points.
-- Garrett
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code