Using the HP-UX libIO Library
1/0/0/3/0.0x6.0x0 maps 1/0/0/3/0.6.0
IO_LUNPATH_2_LUN MAPPING
------------------------
1/0/0/3/0.0x6.0x0 maps 64000/0xfa00/0xc
IO_LUN_2_LUNPATH MAPPING
------------------------
64000/0xfa00/0xc maps 1/0/0/3/0.0x6.0x0
Example 3
Get an I/O node of class “ext_bus” from the agile kernel I/O data structure and
print the hardware path of its parent, child and sibling nodes.
Algorithm
1. Initialize the libIO library.
2. Search for class “ext_bus” node in the kernel data structures from agile view.
3. Get the relative nodes of that I/O node.
4. Print the hardware path of these I/O nodes.
5. Terminate the connection.
Solution
#include <stdio.h>
#include <sys/libIO.h>
main()
{
io_token_t node, node1;
io_token_t relative=0, relative1=0, relative2=0;
uint64_t addr;
int relation;
hw_path_t hw_path, hw_path1;
char my_string[MAX_HW_PATH_STR];
char my_string1[MAX_HW_PATH_STR];
char str[MAX_HW_PATH_STR];
/*Initialize libIO operation */
if (io_init(O_RDONLY) != IO_SUCCESS) {
io_error ("ERROR:io_init");
exit(1);
}
if ((node = io_search ((io_token_t)NULL, S_IOTREE_EXT,
Q_SW, "class", "ext_bus", NULL))==(io_token_t)NULL) {
io_error("ERROR:io_search: ");
exit(1);