On Mon, 24 Aug 2009 04:04:35 -0700 (PDT) damitri <shri...@gmail.com> wrote:
> Hello All, > > How can I get disk’s dev link name (which is in the form /dev/dsk/CxTyDz) > from libdevinfo if I have its corresponding physical path? > > Eg: When I do “ls -l /dev/dsk/c1t0d0s0” the output is > > # ls -l /dev/dsk/c1t0d0s0 > lrwxrwxrwx 1 root root 43 Jun 3 16:32 /dev/dsk/c1t0d0s0 -> > ../../devices/p...@1c,600000/s...@2/s...@0,0:a > > Now I want to write a function which would accept a disk’s physical path > (/devices/p...@1c,600000/s...@2/s...@0,0:a ) and find its matching dev link > node (/dev/dsk/c1t0d0s0) Having done something kinda similar for my stmsboot rewrite last year (http://blogs.sun.com/jmcp/entry/on_stmsboot_1m), I recommend wandering through http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/stmsboot/stmsboot_util.c#1090 and subsequent functions. The libdevinfo(3LIB) and its SEE ALSO refs are very good to read on this matter, too. James C. McPherson -- Senior Kernel Software Engineer, Solaris Sun Microsystems http://blogs.sun.com/jmcp http://www.jmcp.homeunix.com/blog _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code