Motr  M0
validation.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-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 #pragma once
23 #ifndef __MOTR_CONF_VALIDATION_H__
24 #define __MOTR_CONF_VALIDATION_H__
25 
26 #include "lib/types.h" /* bool */
27 
28 struct m0_conf_cache;
29 struct m0_conf_obj;
30 struct m0_fid;
31 
61  char *buf, size_t buflen);
62 
69 M0_INTERNAL char *m0_conf_validation_error_locked(
70  const struct m0_conf_cache *cache, char *buf, size_t buflen);
71 
73 struct m0_conf_rule {
74  /*
75  * Use the name of the function that .cvr_error points at.
76  * This simplifies finding the rule that failed.
77  */
78  const char *cvr_name;
85  char *(*cvr_error)(const struct m0_conf_cache *cache,
86  char *buf, size_t buflen);
87 };
88 
90 enum { M0_CONF_RULES_MAX = 32 };
91 
94  /*
95  * Use the name of m0_conf_ruleset variable. This simplifies
96  * finding the rule that failed.
97  */
98  const char *cv_name;
99  /*
100  * This array must end with { NULL, NULL }.
101  */
103 };
104 
106 #endif /* __MOTR_CONF_VALIDATION_H__ */
107 
108 /*
109  * Local variables:
110  * c-indentation-style: "K&R"
111  * c-basic-offset: 8
112  * tab-width: 8
113  * fill-column: 80
114  * scroll-step: 1
115  * End:
116  */
117 /*
118  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
119  */
Definition: beck.c:235
static int void * buf
Definition: dir.c:1019
Definition: sock.c:887
const char * cv_name
Definition: validation.h:98
char * m0_conf_validation_error(struct m0_conf_cache *cache, char *buf, size_t buflen)
Definition: validation.c:60
Definition: fid.h:38
struct m0_conf_rule cv_rules[M0_CONF_RULES_MAX]
Definition: validation.h:102
M0_INTERNAL char * m0_conf_validation_error_locked(const struct m0_conf_cache *cache, char *buf, size_t buflen)
Definition: validation.c:72
const char * cvr_name
Definition: validation.h:78