forked from linux-nvme/nvme-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccessors-fabrics.c
More file actions
180 lines (152 loc) · 4.17 KB
/
accessors-fabrics.c
File metadata and controls
180 lines (152 loc) · 4.17 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
* This file is part of libnvme.
*
* Copyright (c) 2025, Dell Technologies Inc. or its subsidiaries.
* Authors: Martin Belanger <[email protected]>
*
* ____ _ _ ____ _
* / ___| ___ _ __ ___ _ __ __ _| |_ ___ __| | / ___|___ __| | ___
* | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \/ _` | | | / _ \ / _` |/ _ \
* | |_| | __/ | | | __/ | | (_| | || __/ (_| | | |__| (_) | (_| | __/
* \____|\___|_| |_|\___|_| \__,_|\__\___|\__,_| \____\___/ \__,_|\___|
*
* Auto-generated struct member accessors (setter/getter)
*
* To update run: meson compile -C [BUILD-DIR] update-accessors
* Or: make update-accessors
*/
#include <stdlib.h>
#include <string.h>
#include "accessors-fabrics.h"
#include "private-fabrics.h"
#include "compiler-attributes.h"
/****************************************************************************
* Accessors for: struct libnvmf_discovery_args
****************************************************************************/
__public void libnvmf_discovery_args_set_max_retries(
struct libnvmf_discovery_args *p,
int max_retries)
{
p->max_retries = max_retries;
}
__public int libnvmf_discovery_args_get_max_retries(
const struct libnvmf_discovery_args *p)
{
return p->max_retries;
}
__public void libnvmf_discovery_args_set_lsp(
struct libnvmf_discovery_args *p,
__u8 lsp)
{
p->lsp = lsp;
}
__public __u8 libnvmf_discovery_args_get_lsp(
const struct libnvmf_discovery_args *p)
{
return p->lsp;
}
/****************************************************************************
* Accessors for: struct libnvmf_uri
****************************************************************************/
__public void libnvmf_uri_set_scheme(struct libnvmf_uri *p, const char *scheme)
{
free(p->scheme);
p->scheme = scheme ? strdup(scheme) : NULL;
}
__public const char *libnvmf_uri_get_scheme(const struct libnvmf_uri *p)
{
return p->scheme;
}
__public void libnvmf_uri_set_protocol(
struct libnvmf_uri *p,
const char *protocol)
{
free(p->protocol);
p->protocol = protocol ? strdup(protocol) : NULL;
}
__public const char *libnvmf_uri_get_protocol(const struct libnvmf_uri *p)
{
return p->protocol;
}
__public void libnvmf_uri_set_userinfo(
struct libnvmf_uri *p,
const char *userinfo)
{
free(p->userinfo);
p->userinfo = userinfo ? strdup(userinfo) : NULL;
}
__public const char *libnvmf_uri_get_userinfo(const struct libnvmf_uri *p)
{
return p->userinfo;
}
__public void libnvmf_uri_set_host(struct libnvmf_uri *p, const char *host)
{
free(p->host);
p->host = host ? strdup(host) : NULL;
}
__public const char *libnvmf_uri_get_host(const struct libnvmf_uri *p)
{
return p->host;
}
__public void libnvmf_uri_set_port(struct libnvmf_uri *p, int port)
{
p->port = port;
}
__public int libnvmf_uri_get_port(const struct libnvmf_uri *p)
{
return p->port;
}
__public void libnvmf_uri_set_path_segments(
struct libnvmf_uri *p,
const char *const *path_segments)
{
char **new_array = NULL;
size_t i;
if (path_segments) {
for (i = 0; path_segments[i]; i++)
;
new_array = calloc(i + 1, sizeof(char *));
if (new_array != NULL) {
for (i = 0; path_segments[i]; i++) {
new_array[i] = strdup(path_segments[i]);
if (!new_array[i]) {
while (i > 0)
free(new_array[--i]);
free(new_array);
new_array = NULL;
break;
}
}
}
}
for (i = 0; p->path_segments && p->path_segments[i]; i++)
free(p->path_segments[i]);
free(p->path_segments);
p->path_segments = new_array;
}
__public const char *const *libnvmf_uri_get_path_segments(
const struct libnvmf_uri *p)
{
return (const char *const *)p->path_segments;
}
__public void libnvmf_uri_set_query(struct libnvmf_uri *p, const char *query)
{
free(p->query);
p->query = query ? strdup(query) : NULL;
}
__public const char *libnvmf_uri_get_query(const struct libnvmf_uri *p)
{
return p->query;
}
__public void libnvmf_uri_set_fragment(
struct libnvmf_uri *p,
const char *fragment)
{
free(p->fragment);
p->fragment = fragment ? strdup(fragment) : NULL;
}
__public const char *libnvmf_uri_get_fragment(const struct libnvmf_uri *p)
{
return p->fragment;
}