Resource manager and directories: get path for io_read/write

Hello,

I’m trying to use the resource manager for a debug interface.
Different applications will be enabled to open a device such as : “/dev/remote/app1” or “/dev/remote/app2” etc…

So I created a resource manager with the directory flag : resmgr_attach with falg = _RESMGR_FLAG_DIR

id = resmgr_attach( dpp, // dispatch handle &(resmgr_attr), // resource manager attrs "/dev/remote", // device name _FTYPE_ANY, // open type _RESMGR_FLAG_DIR, // flags &connect_funcs, // connect routines &io_funcs, // I/O routines &attr); // handle

When a client does for example : open("/dev/remote/app1",O_RDWR);

it works and triggers the io_open func, here I can retrieve the path (app1) in the io_open_t *msg (msg->connect.path)

int io_open_remote (resmgr_context_t *ctp, io_open_t *msg, RESMGR_HANDLE_T *handle, void *extra)
{
	printf("io_open_remote: path [%s]\n"
			,msg->connect.path);
}

Then on a read or write … how do I get this path back ? Through the ocb structure ?

Or am I supposed to do another resmgr_attach when the io_open happens ?

Sorry if my questions are silly…but I’m kind of lost here…

Thanks for any answer,

Paul

If there isn’t a way to get to the path from read, the work around is as follows. You create and use an enhanced ocb instead of the ocb. An eocb is just an ocb with more data at the end that you can define yourself. Then you stick the path in beyond where the ocb ends. To do this, you have to modify the ocb allocate routine, and change your references to struct ocb to your new struct eocb.