I have multiple processes in my linux environment that have to use the same device driver to access a number of similar devices. My problem is that if one process instantaiates a device(by instantiate, I mean mknod ) file, and uses a minor number say 0 and 1 for two devices. So how does the other process while doing the same thing come to know that which minor number to use?
In short, in application space is it possible to find the number of device files that use the same driver?
Assuming that you are referring to a driver that you are creating or at least have the source to, try using minor numbers in numerical order (for simplicity) starting with zero. Have your driver keep track of how many minor numbers/devices have been instantiated and expose that count via an entry in sysfs. When you go to instantiate a new device, use the current value of the variable for the new device's minor number and increment the variable (inside the driver).