Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

not getting legacy device name for agile device(using libIO/io_new_to_legacy_dsfs)

 
SOLVED
Go to solution
Highlighted
Advisor

not getting legacy device name for agile device(using libIO/io_new_to_legacy_dsfs)

Hi I am using libIO/io_new_to_legacy_dsfs() API for identifying the legacy devices for a given new agile device name.

But I am not getting the legacy device names as out put, Here is my snippet,

 

        char legacy_dsf[MAXPATHLEN]="";
        int count;

        if (io_init(O_RDONLY) != IO_SUCCESS)
        {
                io_error ("io_init");
                return -1;
        }
 //int io_new_to_legacy_dsfs(char *new_dsf, char *legacy_dsf, int *count);
        io_new_to_legacy_dsfs(argv[1], legacy_dsf, &count);
        printf("dsfDevice : %s \tlegacy_dsf : %s \tcount:%d\n", argv[1], legacy_dsf, count);

        io_end();

Where as ioscan provides following output for the same device which I was using

$ioscan -m dsf
Persistent DSF           Legacy DSF(s)
========================================
/dev/rdisk/disk4         /dev/rdsk/c0t0d0

Can anyone tell me how this libIO stuff actually works? :smileymad:

3 REPLIES 3
Highlighted
Advisor

Re: not getting legacy device name for agile device(using libIO/io_new_to_legacy_dsfs)

has anyone tried using libIO ever before on HPUX 11.31?

Solution

Re: not getting legacy device name for agile device(using libIO/io_new_to_legacy_dsfs)

Well yes libIO is used - in fact the LVM subsystem uses it, and it looks like ioscan uses a statically linked copy of libIO as well - in fact it probably uses the exact call you are using:

 

#nm /usr/sbin/ioscan |grep io_new_to_legacy_dsfs
[153]    |     67696000|    2192|FUNC |LOCAL|0|   .text|io_new_to_legacy_dsfs

  

You don't actually tell us anywhere what you do get back from your code?  I'm no C coder, but looking at the man page for io_new_to_legacy_dsfs() I'd note the following...

 

- There seems to be an indication that you should set legacy_dsf to MAXPATHLEN * 10 and count to 10 before making the call. Certainly in the only example I can find here count is at least initialized to a value, and I couldn't see that you did that anywhere. It would seem that legacy_dsf has to be of size MAXPATHLEN * count to get back anything that will fit in the buffer.

 

- You don't seem to do any error checking off the call to io_new_to_legacy_dsfs() how do you know its not returning IO_ERROR - you should check the return code and follow up with a call to io_error() if appropriate.


I am an HPE Employee
Accept or Kudo
Highlighted
Advisor

Re: not getting legacy device name for agile device(using libIO/io_new_to_legacy_dsfs)

Exactly..!! I also read the manual page and did the needful changes(setting the count and array size), and it worked fine for me.