blob: 67205717dea2ce8db9416001a3f428ab543c19db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#ifndef SG_VPD_H
#define SG_VPD_H
/*
* Copyright (c) 2022 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <stdint.h>
#include <stdbool.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "sg_lib.h"
#include "sg_pr2serr.h"
#ifdef __cplusplus
extern "C" {
#endif
/* These two structures are duplicates of those of the same name in
* sg_vpd_vendor.c . <<< Take care that both are the same. >>> */
struct opts_t {
bool do_all;
bool do_enum;
bool do_force;
bool do_long;
bool do_quiet;
bool verbose_given;
bool version_given;
int do_hex;
int do_ident;
int do_raw;
int examine;
int maxlen;
int vend_prod_num;
int verbose;
int vpd_pn;
const char * device_name;
const char * page_str;
const char * inhex_fn;
const char * vend_prod;
sgj_state json_st;
};
struct svpd_values_name_t {
int value; /* VPD page number */
int subvalue; /* to differentiate if value+pdt are not unique */
int pdt; /* peripheral device type id, -1 is the default */
/* (all or not applicable) value */
const char * acron;
const char * name;
};
void svpd_enumerate_vendor(int vend_prod_num);
int svpd_count_vendor_vpds(int vpd_pn, int vend_prod_num);
int svpd_decode_vendor(int sg_fd, struct opts_t * op, int off);
const struct svpd_values_name_t * svpd_find_vendor_by_acron(const char * ap);
int svpd_find_vp_num_by_acron(const char * vp_ap);
const struct svpd_values_name_t * svpd_find_vendor_by_num(int page_num,
int vend_prod_num);
int vpd_fetch_page(int sg_fd, uint8_t * rp, int page, int mxlen,
bool qt, int vb, int * rlenp);
void dup_sanity_chk(int sz_opts_t, int sz_values_name_t);
extern uint8_t * rsp_buff;
#ifdef __cplusplus
}
#endif
#endif /* end of SG_VPD_H */
|