qclib
zhypinfo.h
1
/* Copyright IBM Corp. 2020 */
2
3
#include <stdlib.h>
4
#include <stdio.h>
5
#include <string.h>
6
#include <getopt.h>
7
8
#include "
query_capacity.h
"
9
10
11
int
get_handle(
void
**hdl,
int
*layers) {
12
int
rc;
13
14
*hdl =
qc_open
(&rc);
15
if
(rc < 0) {
16
fprintf(stderr,
"Error: Could not open capacity data, rc=%d\n"
, rc);
17
return
rc;
18
}
19
if
(rc > 0) {
20
fprintf(stderr,
"Warning: Capacity data inconsistent, try again later (rc=%d)\n"
, rc);
21
return
rc;
22
}
23
if
(!*hdl) {
24
fprintf(stderr,
"Error: Capacity data returned invalid handle, rc=%d\n"
, rc);
25
return
rc;
26
}
27
*layers =
qc_get_num_layers
(*hdl, &rc);
28
if
(rc != 0) {
29
fprintf(stderr,
"Error: Could not retrieve number of layers, rc=%d\n"
, rc);
30
return
rc;
31
}
32
if
(*layers < 1) {
33
fprintf(stderr,
"Error: Invalid number of layers: %d\n"
, *layers);
34
return
1;
35
}
36
37
return
0;
38
}
qc_get_num_layers
int qc_get_num_layers(void *hdl, int *rc)
Definition:
query_capacity.c:895
qc_open
void * qc_open(int *rc)
Definition:
query_capacity.c:825
query_capacity.h
Generated on Thu Sep 24 2020 00:00:00 for qclib by
1.8.20