Using the HP-UX libIO Library
io_end();
}
Output
Disk option 1 for dev_t 0xb00001d of the hardware path
64000/0xfa00/0x0.
Example 4
Get a disk device from legacy and agile kernel I/O data structure. Find the dev_t
of these I/O nodes. Map the dev_t to its corresponding agile/legacy dev_t and
print the major number of the dev_t.
Algorithm
1. Initialize the libIO library.
2. Search for a legacy disk device in the kernel data structures.
3. Get the dev_t of this node.
4. Map the legacy dev_t to agile dev_t.
5. Print the major number of the dev_t.
6. Search for an agile disk device in the kernel data structures.
7. Get the dev_t of this node.
8. Map the agile dev_t to legacy dev_t.
9. Print the major number of the dev_t.
10. Terminate the connection.
Solution
#include <stdio.h>
#include <stdlib.h>
#include <sys/libIO.h>
main()
{
io_token_t node=(io_token_t)NULL;
io_token_t new_node;
int dev_type=D_CHR;
int is_char=0;
int is_block=0;
dev_t dev=0;
dev_t *leg_dev;
dev_t new_dev;
int count=1;
int ret;
leg_dev=(dev_t *)malloc(sizeof(dev_t));