Using the HP-UX libIO Library

int dev_type=-1;
dev_t dev=-1;
hw_path_t hw_path;
char str[MAX_HW_PATH_STR];
/* initialize libIO operations */
if (io_init(O_RDONLY)!=IO_SUCCESS) {
io_error("ERROR:io_init");
exit(1);
}
/*get an exiting agile disk I/O node */
if ((node=io_search((io_token_t)NULL, S_IOTREE_EXT, 0,
"class", "disk", NULL))==(io_token_t)NULL) {
io_error("ERROR:io_search:class:disk");
exit(1);
}
dev_type=D_CHR;
options=1;
if (io_mkdev_ext(node, dev_type, options, &dev)
!= IO_SUCCESS) {
io_error("ERROR:io_mkdev_ext:options:1");
exit(1);
}
/*get device specific options */
options = 0;
if (io_dev_to_options(dev, dev_type, &options)
==IO_ERROR) {
io_error("ERROR: io_dev_to_options");
exit(1);
}
/*get the hardware path of the I/O node */
if (io_node_to_hw_path(node, &hw_path)==IO_ERROR) {
io_error("ERROR:io_node_to_hw_path");
exit(1);
}
if (io_hw_path_to_str(str, &hw_path)== IO_ERROR) {
io_error("io_hw_path_to_str");
exit(1);
}
printf("\nDisk option %lld for dev_t 0x%x of the hardware
path %s.\n", options, dev, str);
/*end of libio operations */