Using the HP-UX libIO Library
if (io_hw_path_to_str(my_string, &hw_path1)==IO_ERROR) {
io_error("io_hw_path_to_str");
exit(1);
}
printf("IO_NEW_2_LEGACY MAPPING\n------------------------
\n");
printf("%s maps %s \n\n",my_string1, my_string);
free(token_array);
free(token_array1);
/*IO_LUNPATH_2_LUN Mapping */
lun_path_node=io_search((io_token_t)NULL, S_IOTREE_EXT,
Q_SW, "type", "LUN_PATH", NULL);
if (lun_path_node==(io_token_t)NULL) {
io_error("ERROR:io_search:");
exit(1);
}
count=1;
token_array=(io_token_t*)malloc(sizeof(io_token_t));
ret=io_get_mapping(lun_path_node, IO_LUNPATH_2_LUN,
&count,token_array);
if (ret==IO_E_MEM_ALLOC) {
token_array=(io_token_t*)
malloc(count*sizeof(io_token_t));
ret=io_get_mapping(lun_path_node, IO_LUNPATH_2_LUN,
&count, token_array);
}
if (ret != IO_SUCCESS) {
io_error("ERROR:io_get_mapping:");
exit(1);
}
if (io_query( lun_path_node, S_IOTREE_EXT, "hw_path",
&hw_path) ==IO_ERROR ) {
io_error("ERROR:io_query");
exit(1);
}
if (io_hw_path_to_str(my_string, &hw_path)==IO_ERROR) {
io_error("io_hw_path_to_str");
exit(1);
}
if (io_query (token_array[0], S_IOTREE, "hw_path",
&hw_path1)==IO_ERROR ) {
io_error("ERROR:io_query");
exit(1);
}
if (io_hw_path_to_str(my_string1, &hw_path1)==IO_ERROR) {
io_error("io_hw_path_to_str");