Using the HP-UX libIO Library

Examples
Example 1
Get an I/O node of a disk device from the kernel I/O data structure. Verify the I/O
node from agile view or legacy view and print the hardware path of that I/O node
from agile view or legacy view.
Algorithm
1. Initialize the libIO library.
2. Search for a disk device in the kernel data structures.
3. Verify if it is from agile view or legacy view.
4. Print the hardware path of that I/O node is from agile view or legacy view.
5. Terminate the connection.
Solution
#include <sys/libIO.h>
#include <stdio.h>
main()
{
io_token_t node;
int ret=0;
hw_path_t hw_path;
char my_string[MAX_HW_PATH_STR ];
/*initialize libIO */
if (io_init (O_RDONLY) ==IO_ERROR) {
io_error("io_init");
exit(1);
}
/*Search for a disk Device node */
if ((node=io_search ((io_token_t)NULL, S_IOTREE, Q_SW,
"class", "disk", NULL))==(io_token_t)NULL) {
io_error("ERROR:io_search");
exit(1);
}
/*Verify the the node belong to which view */
ret=io_is_legacy_token(node);
if (ret==IO_TOKEN_LEGACY) {
if (io_query (node, S_IOTREE, "hw_path", &hw_path)
==IO_ERROR ) {