mapping from dev_t to device name

From: BenHanokh Gabriel (gabriel@SANgate.com)
Date: Wed Aug 09 2000 - 02:47:18 EST


hi

i'm writing a program which needs to know the scsi-id of files it is
dealing with.
while geting the scsi-id can be done with the SCSI_IOCTL_GET_IDLUN
ioctl, it needs to be done on an open device.
the problem is how to figure out the device name from the file name/ fd
?
in BSD i can stat(2) the file and then call devname(2) to translate from
the dev_t field in the stat struct into device name in filesystem.

is there an api like this in linux, or that i have to scan /etc/fstab
with getmntent(3) loooking for mount-point which is the longest prefix
of filename( after getting rid of soft-links ) ?
this looks like a redundent work as the kernel must have done it while
opening the file

please CC me for answers as i'm not regitered to the mailing list

THX
/gabriel

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:17 EST