Using the HP-UX libIO Library

/*Initialize the libIO connection */
if (io_init(O_RDONLY)!=IO_SUCCESS){
io_error("io_init") ;
exit(1);
}
key[0]="class";
ptr[0]=(void *)class_name;
key[1]="driver_name";
ptr[1]=(void *)driver_name;
/*get an existing disk device node */
if((token=io_search((io_token_t)NULL, S_IOTREE, 0,
"class", "disk", NULL))==NULL){
io_error("io_search");
exit(1);
}
if (io_search_array_batch(token, S_IOTREE, 0, key, ptr,
ret_token)==IO_ERROR) {
io_error("io_search_array_batch");
exit(1);
}
/*get the property of the node */
printf ("class instance hardware path
driver_name\n");
printf("============================================\n");
while ((i<RETURN_NODE_NUMBER)&&(ret_token[i]!=NULL)) {
node = ret_token[i++];
if (io_query_batch(node, S_IOTREE , "hw_path",
&hw_path, "class", class_name, "driver_name",
driver_name, "instance" , &instance)==IO_ERROR) {
io_error("io_query_batch");
exit(1);
}
io_hw_path_to_str(my_string, &hw_path);
printf ("%s %d %s %s\n", class_name,
instance, my_string, driver_name);
}
/*Terminate the connection */
io_end();
}
Output
class instance hardware path driver_name