Dealing with Directory in Resource Manager

Hi,

I am writing a resource manager, and in that I want to handle multiple devices. (And I don’t want to reserve space for all the device at the time of attaching it to the resource manager, means providing the flexibility at the run time for creation and deletion of the N number of devices under this directory).

For this I attach a directory “/dev/sample” into the resource manager. Now I can perform the operations on the devices, named “/dev/sample/sample0”, “/dev/sample/sample1”,…"/dev/sample/sampleX". Each time I gets the different FD as I should expect.

Now when I perform the Write operation, lets say on device “/dev/sample/sample2”, but I am getting the data even I read from any device “/dev/sample/sampleX”. This means that these logical devices could not be differentiated in the underlaying architecture.

Any idea how to differentiate between these logical devices.

When I do SELECT on these FD’s , I always get the data into the largest FD, irrespective of on which FD i wrote the data.

Thanks in advance,

Best Regards,
Dheeraj

I got the solution.
In case of multiple open, the created OCB ( for the first time) was linked to all the open, resulting in the one OCB structure. So what we need to do is that for each OPEN, create the OCB and attach to the resource manager.
and then RM will map the fd to OCB for further reference to that device.

cheers,