Motr  M0
glob.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 #pragma once
22 #ifndef __MOTR_CONF_GLOB_H__
23 #define __MOTR_CONF_GLOB_H__
24 
25 #include "conf/cache.h" /* M0_CONF_PATH_MAX */
26 
67 enum {
69  M0_CONF_GLOB_ERR = 1 << 0,
70 };
71 
72 typedef int (*m0_conf_glob_errfunc_t)(int errcode,
73  const struct m0_conf_obj *obj,
74  const struct m0_fid *path);
75 
81 struct m0_conf_glob {
83  int cg_flags;
84 
99 
101  const struct m0_conf_obj *cg_errobj;
102  const struct m0_fid *cg_errpath;
103 
104  /* XXX TODO: Drop this field and use .cg_origin->co_cache. */
105  const struct m0_conf_cache *cg_cache;
106 
108  const struct m0_conf_obj *cg_origin;
109 
117 
120 
122  uint32_t cg_depth;
123 
125  bool cg_down_p;
126 #ifdef DEBUG
127 
128  bool cg_debug_print;
129 #endif
130 };
131 
142 #define m0_conf_glob_init(glob, flags, errfunc, cache, origin, ...) \
143  m0_conf__glob_init((glob), (flags), (errfunc), (cache), (origin), \
144  (const struct m0_fid []){ __VA_ARGS__, M0_FID0 })
145 M0_INTERNAL void m0_conf__glob_init(struct m0_conf_glob *glob,
147  const struct m0_conf_cache *cache,
148  const struct m0_conf_obj *origin,
149  const struct m0_fid *path);
150 
172 M0_INTERNAL int m0_conf_glob(struct m0_conf_glob *glob,
173  uint32_t nr, const struct m0_conf_obj **objv);
174 
182 M0_INTERNAL char *m0_conf_glob_error(const struct m0_conf_glob *glob,
183  char *buf, size_t buflen);
184 
186 #endif /* __MOTR_CONF_GLOB_H__ */
Definition: beck.c:235
static size_t nr
Definition: dump.c:1505
const struct m0_conf_obj * cg_trace[M0_CONF_PATH_MAX+1]
Definition: glob.h:119
int const char const void size_t int flags
Definition: dir.c:328
const struct m0_conf_obj * cg_origin
Definition: glob.h:108
int cg_flags
Definition: glob.h:83
const struct m0_conf_cache * cg_cache
Definition: glob.h:105
m0_conf_glob_errfunc_t cg_errfunc
Definition: glob.h:98
M0_INTERNAL void m0_conf__glob_init(struct m0_conf_glob *glob, int flags, m0_conf_glob_errfunc_t errfunc, const struct m0_conf_cache *cache, const struct m0_conf_obj *origin, const struct m0_fid *path)
Definition: glob.c:53
uint32_t cg_depth
Definition: glob.h:122
static struct foo * obj
Definition: tlist.c:302
Definition: sock.c:887
int(* m0_conf_glob_errfunc_t)(int errcode, const struct m0_conf_obj *obj, const struct m0_fid *path)
Definition: glob.h:72
M0_INTERNAL char * m0_conf_glob_error(const struct m0_conf_glob *glob, char *buf, size_t buflen)
Definition: glob.c:115
static int errfunc(int errcode, const struct m0_conf_obj *obj, const struct m0_fid *path)
Definition: glob.c:200
const struct m0_conf_obj * cg_errobj
Definition: glob.h:101
Definition: fid.h:38
M0_INTERNAL int m0_conf_glob(struct m0_conf_glob *glob, uint32_t nr, const struct m0_conf_obj **objv)
Definition: glob.c:92
int cg_errcode
Definition: glob.h:100
struct m0_fid cg_path[M0_CONF_PATH_MAX+1]
Definition: glob.h:116
const struct m0_fid * cg_errpath
Definition: glob.h:102
bool cg_down_p
Definition: glob.h:125