Motr  M0
enum.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_XCODE_ENUM_H__
26 #define __MOTR_XCODE_ENUM_H__
27 
53 struct m0_xcode_enum_val;
54 
56 struct m0_xcode_enum {
58  const char *xe_name;
60  uint32_t xe_nr;
67  const struct m0_xcode_enum_val *xe_val;
74  int xe_maxlen;
75 };
76 
88  int xev_idx;
90  uint64_t xev_val;
97  const char *xev_name;
98 };
99 
100 bool m0_xcode_enum_is_valid (const struct m0_xcode_enum *en,
101  uint64_t val);
121 const char *m0_xcode_enum_print (const struct m0_xcode_enum *en,
122  uint64_t val, char *buf);
132 int m0_xcode_enum_read (const struct m0_xcode_enum *en,
133  const char *buf, int nr, uint64_t *val);
134 bool m0_xcode_bitmask_is_valid(const struct m0_xcode_enum *en,
135  uint64_t val);
155 int m0_xcode_bitmask_print (const struct m0_xcode_enum *en,
156  uint64_t val, char *buf, int nr);
163 int m0_xcode_bitmask_read (const struct m0_xcode_enum *en,
164  const char *buf, int nr, uint64_t *val);
165 struct m0_xcode_obj;
166 struct m0_xcode_cursor;
167 
174 M0_INTERNAL int m0_xcode_enum_field_read(const struct m0_xcode_cursor *it,
175  struct m0_xcode_obj *obj,
176  const char *str);
177 
184 M0_INTERNAL int m0_xcode_bitmask_field_read(const struct m0_xcode_cursor *it,
185  struct m0_xcode_obj *obj,
186  const char *str);
187 
189 #endif /* __MOTR_XCODE_ENUM_H__ */
190 
191 /*
192  * Local variables:
193  * c-indentation-style: "K&R"
194  * c-basic-offset: 8
195  * tab-width: 8
196  * fill-column: 80
197  * scroll-step: 1
198  * End:
199  */
200 /*
201  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
202  */
static size_t nr
Definition: dump.c:1505
Definition: idx_mock.c:52
const struct m0_xcode_enum_val * xe_val
Definition: enum.h:67
static struct m0_be_emap_cursor it
Definition: extmap.c:46
static struct foo * obj
Definition: tlist.c:302
Definition: sock.c:887
const char * xe_name
Definition: enum.h:58
bool m0_xcode_enum_is_valid(const struct m0_xcode_enum *en, uint64_t val)
Definition: enum.c:45
uint64_t xev_val
Definition: enum.h:90
int m0_xcode_bitmask_print(const struct m0_xcode_enum *en, uint64_t val, char *buf, int nr)
Definition: enum.c:85
int m0_xcode_bitmask_read(const struct m0_xcode_enum *en, const char *buf, int nr, uint64_t *val)
Definition: enum.c:112
uint32_t xe_nr
Definition: enum.h:60
const char * m0_xcode_enum_print(const struct m0_xcode_enum *en, uint64_t val, char *buf)
Definition: enum.c:51
const char * xev_name
Definition: enum.h:97
bool m0_xcode_bitmask_is_valid(const struct m0_xcode_enum *en, uint64_t val)
Definition: enum.c:78
M0_INTERNAL int m0_xcode_bitmask_field_read(const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
Definition: enum.c:155
int xe_maxlen
Definition: enum.h:74
int m0_xcode_enum_read(const struct m0_xcode_enum *en, const char *buf, int nr, uint64_t *val)
Definition: enum.c:65
M0_INTERNAL int m0_xcode_enum_field_read(const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
Definition: enum.c:142