SCSI Pass-Through Programmer's Guide
A simple C program to invoke HPLDEVTOIOPATH
/*
File: ldevtoiop.c
This program accepts an LDEV number and returns its I/O path. The path is returned
in an array of 32 characters. The I/O path returned is followed by spaces and hence
may need trimming before use.
Steps to link and add capabilities:
1. In POSIX Shell run: c89 ldevtoiop.c -o ELD2IOP
2. Exit shell, run linkedit
3. altprog ELD2IOP;CAP=BA,IA,PM,PH
*/
#pragma standard_level "ext_modcal"
#pragma intrinsic GETPRIVMODE
#include <stdio.h>
typedef
struct path_str_struct
{
char str[32];
} path_str_t;
typedef union
{
int all;
struct {
short info;
short subsys;
} part;
} hpe_status;
typedef short ldev_type;
extern void hpldevtoiopath( ldev_type ldev, path_str_t* path, hpe_status* sts);
void main()
{
path_str_t path;
ldev_type ldev;
hpe_status status;
int ldev_temp;
ldev = 7;
status.all = 0;
printf("Please enter the ldev no. for which you need the I/O path: ");
scanf("%d",&ldev_temp);
ldev = ldev_temp;
GETPRIVMODE();
hpldevtoiopath (ldev, &path, &status);
if (status.all != 0)
printf ("Error Status returned: info %d subsys %d\n",
status.part.info, status.part.subsys);
else
printf ("IO Path returned is %s\n",path);
}
- 25 -