Advice on getting the scsi device name.
Hi,
I am writing a program that needs to safely and correctly identify and
mount a dev/sda ... dev/sda1 or dev/sdb etc.As far my knowledge fits me, i have to manually check the entry on proc/scsi/scsi to determine. Please advice me on a better method that could be included in a C program. Any help is greatly appreciated.
- Thanks :)
Danny
Quoted 7 lines · Danny Leong
Hi,
I am writing a program that needs to safely and correctly identify and
mount a dev/sda ... dev/sda1 or dev/sdb etc.As far my knowledge fits me, i have to manually check the entry on proc/scsi/scsi to determine. Please advice me on a better method that could be included in a C program. Any help is greatly appreciated.
You can't. mknod is done from userspace and the kernel can't gurantee you the name.
Quoted 5 lines
I am writing a program that needs to safely and correctly identify and mount a dev/sda ... dev/sda1 or dev/sdb etc.As far my knowledge fits me, i have to manually check the entry on proc/scsi/scsi to determine. Please advice me on a better method that could be included in a C program.
That depends a lot on what you consider a correct identification. I can't think of any identification that /proc/scsi/scsi would help with.
At a minimum, you usually have to do an ioctl to the device to find out its host, bus, target, and lu numbers. Typically, even that isn't enough of an identification and you have to read VPD from the lu or read a volume label from the disk to really know what entity is behind /dev/sda.
What sort of identification are you looking for?