On 19/08/10 10:27 PM, Peter Tribble wrote:
On Tue, Aug 10, 2010 at 6:48 PM, Peter Taps<ptr...@yahoo.com> wrote:
Hi Peter,
I went through using jkstat. However, kstat returns sd0, sd1, etc. for disk
names. The actual disk names are c8t0d0, c8tt1d0, etc. in my system. How do I
get c8t0d0 from sd0?
Thank you in advance for your help.
This isn't straightforward. I have code in solview (another one of my projects)
that does this, which I think was based on the way that iostat does
it. Basically,
the c#t#d#s# entries in /dev/dsk are symlinks off into the /devices tree. You
need to match those up with the entries in /etc/path_to_inst.
For example,
# ls -l /dev/dsk/c8t1d0s2
lrwxrwxrwx 1 root root 47 Oct 12 2009
/dev/dsk/c8t1d0s2 -> ../../devices/p...@0,0/pci108e,5...@5/d...@1,0:c
Matches the line
"/p...@0,0/pci108e,5...@5/d...@1,0" 7 "sd"
in /etc/path_to_inst, so c8t1d0 corresponds to sd7.
(One problem I have is with upgraded systems where the driver has changed,
resulting in multiple links in /dev/dsk pointing to the same place, so it isn't
a simple 1-to-1 mapping.)
Might I suggest looking at the devlink walker code?
An example is in
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/fwflash/plugins/transport/common/sd.c#654
James C. McPherson
--
Oracle
http://www.jmcp.homeunix.com/blog
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code