Skip to contentSkip to conversation

getting device info from device node

DISCUSSION Oliver Neukum 2 participants 3 messages Jun 4, 2002 – Jun 5, 2002

lore
Share & tools
lore
#0 lore raw

Hi Greg,

I must disagree. The most basic thing about configuring a device is identifying it. You must be able to tell what it is.

However I think I found a relatively clean way. You can return a name from an ioctl().
You just can't return the one human readable name. You can return a name which is unique and can only be used while the device is still plugged in.

Regards
Oliver

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 10 lines · Oliver Neukum

Hi Greg,

I must disagree. The most basic thing about configuring a device is identifying it. You must be able to tell what it is.

However I think I found a relatively clean way. You can return a name from an ioctl().
You just can't return the one human readable name. You can return a name which is unique and can only be used while the device is still plugged in.

Great, how does the kernel create this "name"?

thanks,

greg k-h

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Oliver Neukum

Am Mittwoch, 5. Juni 2002 00:19 schrieben Sie:

Quoted 6 lines · Oliver Neukum
Quoted 5 lines

Hi Greg,

I must disagree. The most basic thing about configuring a device is identifying it. You must be able to tell what it is.

Quoted 7 lines
Quoted 5 lines

However I think I found a relatively clean way. You can return a name from an ioctl().
You just can't return the one human readable name. You can return a name which is unique and can only be used while the device is still plugged in.

Great, how does the kernel create this "name"?

I'd suggest a fixed prefix+pid+counter.
What it actually is doesn't matter if it's unique. It's simply a directory with the files in it hard links to the files in the persistent directory.
The trick is that we refuse to open files in it, if the name has been invalidated by device removal.
I am not sure how much of the vfs locking we could use. I am not Al Viro, that's why it didn't occur to me earlier.

Regards
Oliver

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel