views:

33

answers:

2

In solaris when open call to char special device file is made in user space, the driver's open call is called with only two parameters. 1. major and minor number and 2. flag that contains read/write etc.. Is there any way to the get the name of the opened device file in driver's open call. or Is there any way to get the name of the device file from major and minor number in driver code?

A: 

I doubt the OS has any way to retrieve the name of the device file. Actually, this file name is not enforced by the OS and can be any name created with the mknod command. The only things that matter are the major and minor device numbers.

jlliagre
A: 

You can go through the lists of entries in /dev or /devices and compare the numbers. But of course in general, the special file could have been created anywhere in the filesystem.

But you shouldn't try doing this. Which problem are you trying to solve by this?

ShiDoiSi
I want to map major and minor number of each storage device (which has different major numbers) to a pseudo device file of my own driver. So if I create my pseudo device file with major and minor number of the storage device file in the name of the pseudo file. buy doing so I can create a one to one map from pseudo device to real device
suresh
I need to know the name of the pseudo file in open call of driver code to extract major and minor number of the real device file that is mapped to the opened device file. or Is there any ddi call to get the file list in a given directory like opendir and readdir in user space
suresh