know which devies was used

I write I driver which register in system as few devices for example
/dev/sample1 /dev/sample2. But in function read/write how can I know
which devices was used to read/write?

Thanks
Tom

tomasz <tomasz.walenczak@radmor.com.pl> wrote:

I write I driver which register in system as few devices for example
/dev/sample1 /dev/sample2. But in function read/write how can I know
which devices was used to read/write?

On each register, you will pass an attribute structure into the
resmgr_attach() call.

On the read/write functions, you will be passed an ocb, this is
per-open data, the ocb will point to the attribute structre that
matches the device that was opened.

e.g.

resmgr_attach(... "/dev/sample1",..., &attr_sample1 ); fd = open("/dev/sample1",...); write( fd, ... ); io_write( ... iofunc_ocb_t *ocb ... )

ocb->attr is &attr_sample1

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com