22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CONF 49 M0_INTERNAL int type ## _get(struct m0_confc *confc, \ 50 const struct m0_fid *fid, \ 53 struct m0_conf_obj *obj; \ 56 rc = confc_obj_get(confc, fid, &obj); \ 58 *out = M0_CONF_CAST(obj, type); \ 61 struct __ ## type ## _semicolon_catcher 83 M0_CONF_ROOT_POOLS_FID, *
pool) ?:
115 M0_CONF_ROOT_NODES_FID,
116 M0_CONF_NODE_PROCESSES_FID,
117 M0_CONF_PROCESS_SERVICES_FID,
118 M0_CONF_SERVICE_SDEVS_FID);
142 const struct m0_fid *path,
168 const struct m0_fid to_sdevs[] = {M0_CONF_ROOT_NODES_FID,
169 M0_CONF_NODE_PROCESSES_FID,
170 M0_CONF_PROCESS_SERVICES_FID,
171 M0_CONF_SERVICE_SDEVS_FID};
172 const struct m0_fid to_drives[] = {M0_CONF_ROOT_SITES_FID,
173 M0_CONF_SITE_RACKS_FID,
174 M0_CONF_RACK_ENCLS_FID,
175 M0_CONF_ENCLOSURE_CTRLS_FID,
176 M0_CONF_CONTROLLER_DRIVES_FID};
177 const struct m0_fid to_drvsvs[] = {M0_CONF_ROOT_POOLS_FID,
178 M0_CONF_POOL_PVERS_FID,
179 M0_CONF_PVER_SITEVS_FID,
180 M0_CONF_SITEV_RACKVS_FID,
181 M0_CONF_RACKV_ENCLVS_FID,
182 M0_CONF_ENCLV_CTRLVS_FID,
183 M0_CONF_CTRLV_DRIVEVS_FID};
184 const struct m0_fid to_profs[] = {M0_CONF_ROOT_PROFILES_FID};
185 const struct m0_fid to_fdmifs[] = {M0_CONF_ROOT_FDMI_FLT_GRPS_FID,
186 M0_CONF_FDMI_FGRP_FILTERS_FID};
209 for (eps =
svc->cs_endpoints; *eps !=
NULL; eps++) {
243 M0_CONF_ROOT_PROFILES_FID, *
fid);
274 M0_CONF_ROOT_NODES_FID,
275 M0_CONF_NODE_PROCESSES_FID,
276 M0_CONF_PROCESS_SERVICES_FID);
292 if (
rc == 0 && *result ==
NULL)
316 "Confc is not ready. Called by a dummy rpc client?");
330 M0_CST_CONFD,
svc->cs_endpoints[0], &
obj);
362 const struct m0_fid *path)
395 #define conf_objs_count(confc, filter, arg, count, ...) \ 396 conf__objs_count(confc, filter, arg, count, \ 397 M0_COUNT_PARAMS(__VA_ARGS__) + 1, \ 398 (const struct m0_fid []){ __VA_ARGS__, M0_FID0 }) 452 uint32_t *nr_devices)
454 M0_CASSERT(
sizeof(
void *) >=
sizeof svc_types);
457 (
void *)svc_types, nr_devices,
458 M0_CONF_ROOT_SITES_FID,
459 M0_CONF_SITE_RACKS_FID,
460 M0_CONF_RACK_ENCLS_FID,
461 M0_CONF_ENCLOSURE_CTRLS_FID,
462 M0_CONF_CONTROLLER_DRIVES_FID);
535 M0_CONF_PROCESS_SERVICES_FID);
669 #undef M0_TRACE_SUBSYSTEM const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
M0_INTERNAL int m0_ha_state_get(struct m0_ha_nvec *note, struct m0_chan *chan)
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
struct m0_conf_obj * cc_root
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
static int _conf_load(struct m0_conf_root *root, const struct m0_fid *path, uint32_t nr_levels)
M0_INTERNAL struct m0_locality * m0_locality_get(uint64_t value)
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
static int confc_service_find(struct m0_confc *confc, enum m0_conf_service_type stype, const char *ep, struct m0_conf_obj **result)
static struct m0_mutex chan_lock
M0_INTERNAL int m0_confc_profile_open(struct m0_confc *confc, const struct m0_fid *fid, struct m0_conf_profile **out)
M0_INTERNAL int m0_conf_full_load(struct m0_conf_root *r)
static const char * ep_addr
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
const struct m0_conf_obj_type M0_CONF_SITE_TYPE
struct m0_chan rh_conf_cache_ready_async
static struct m0_sm_group * grp
struct m0_conf_obj rt_obj
#define M0_LOG(level,...)
const struct m0_conf_obj_type * m0_conf_fid_type(const struct m0_fid *fid)
static bool conf_obj_is_service(const struct m0_conf_obj *obj)
enum m0_trace_level level
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
#define conf_objs_count(confc, filter, arg, count,...)
static int confc_obj_get(struct m0_confc *confc, const struct m0_fid *fid, struct m0_conf_obj **result)
const struct m0_conf_obj_type M0_CONF_SDEV_TYPE
M0_INTERNAL int m0_conf_diter_next_sync(struct m0_conf_diter *it, bool(*filter)(const struct m0_conf_obj *obj))
M0_INTERNAL bool m0_is_cas_disk(const struct m0_conf_obj *obj)
struct m0_chan rh_conf_cache_ready
M0_INTERNAL uint8_t m0_fid_tget(const struct m0_fid *fid)
static struct m0_be_emap_cursor it
const struct m0_conf_obj_type M0_CONF_POOL_TYPE
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL struct m0_conf_pver ** m0_conf_pvers(const struct m0_conf_obj *obj)
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
const struct m0_conf_obj_type M0_CONF_CONTROLLER_TYPE
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
M0_INTERNAL int m0_conf_pver_get(struct m0_confc *confc, const struct m0_fid *pool, struct m0_conf_pver **out)
M0_INTERNAL int m0_confc_service_find(struct m0_confc *confc, enum m0_conf_service_type stype, const char *ep, struct m0_conf_obj **result)
static struct m0_sm_ast ast[NR]
#define M0_RC_INFO(rc, fmt,...)
static int conf__objs_count(struct m0_confc *confc, bool(*filter)(const struct m0_conf_obj *obj, void *arg), void *arg, uint32_t *count, int level, const struct m0_fid *path)
#define M0_ERR_INFO(rc, fmt,...)
struct m0_conf_root * root
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL bool m0_is_ios_disk(const struct m0_conf_obj *obj)
static bool dev_has_type(const struct m0_conf_obj *obj, void *arg)
static bool m0_conf_service_type_is_valid(enum m0_conf_service_type t)
const struct m0_conf_obj_type M0_CONF_ENCLOSURE_TYPE
static const struct socktype stype[]
struct m0_fid rt_imeta_pver
M0_INTERNAL int m0_conf_devices_count(struct m0_confc *confc, uint64_t svc_types, uint32_t *nr_devices)
const struct m0_fid_type cot_ftype
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
M0_INTERNAL const char * m0_bool_to_str(bool b)
M0_INTERNAL const char * m0_conf_service_type2str(enum m0_conf_service_type type)
static struct m0_confc * confc
struct m0_conf_obj * m0_conf_obj_grandparent(const struct m0_conf_obj *obj)
static bool conf_obj_is_sdev(const struct m0_conf_obj *obj)
static struct m0_thread t[8]
M0_INTERNAL int m0_conf_obj_ha_update(const struct m0_fid *obj_fid)
struct m0_conf_cache cc_cache
M0_INTERNAL struct m0_reqh * m0_conf_obj2reqh(const struct m0_conf_obj *obj)
M0_INTERNAL bool m0_disk_is_of_type(const struct m0_conf_obj *obj, uint64_t svc_types)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
M0_INTERNAL int m0_conf_confc_ha_update(struct m0_confc *confc)
M0_INTERNAL int m0_conf_obj_find_lock(struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
const struct m0_conf_obj_type M0_CONF_DRIVE_TYPE
M0_INTERNAL int m0_conf_confc_ha_update_async(struct m0_confc *confc, struct m0_ha_nvec *nvec, struct m0_chan *chan)
#define M0_CONF_CAST(ptr, type)
struct m0_conf_sdev * ck_sdev
M0_INTERNAL bool m0_confc_is_inited(const struct m0_confc *confc)
static struct m0_clink clink[RDWR_REQUEST_MAX]
#define m0_confc_open_sync(result, origin,...)
M0_INTERNAL void m0_conf_obj_get_lock(struct m0_conf_obj *obj)
struct m0_sm_ast rh_conf_cache_ast
M0_INTERNAL struct m0_reqh * m0_confc2reqh(const struct m0_confc *confc)
static struct m0_pool pool
M0_INTERNAL int m0_conf_device_cid_to_fid(struct m0_confc *confc, uint64_t cid, struct m0_fid *fid)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
static struct m0_confc * conf_obj2confc(const struct m0_conf_obj *obj)
M0_INTERNAL int m0_conf_process2service_get(struct m0_confc *confc, const struct m0_fid *process_fid, enum m0_conf_service_type stype, struct m0_fid *sfid)
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
#define m0_conf_diter_init(iter, confc, origin,...)
static struct m0_chan chan[RDWR_REQUEST_MAX]
#define M0_FI_ENABLED(tag)
struct m0_chan rh_conf_cache_exp
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
static struct m0_net_test_service svc
struct m0_conf_obj sd_obj
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
M0_INTERNAL int m0_conf_objs_ha_update(struct m0_ha_nvec *nvec)
M0_INTERNAL struct m0_confc * m0_confc_from_obj(const struct m0_conf_obj *obj)
static struct m0_rconfc * rconfc(struct m0_client *m0c)
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
M0_INTERNAL void m0_chan_fini(struct m0_chan *chan)
struct m0_rconfc rh_rconfc
M0_INTERNAL void m0_confc_ready_cb(struct m0_rconfc *rconfc)
static void confc_ready_async_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL bool m0_conf_obj_is_pool(const struct m0_conf_obj *obj)
M0_INTERNAL void m0_confc_expired_cb(struct m0_rconfc *rconfc)
struct m0_ha_note * nv_note
static int32_t min32(int32_t a, int32_t b)
M0_INTERNAL int m0_conf_pver_find(const struct m0_conf_pool *pool, const struct m0_fid *pver_to_skip, struct m0_conf_pver **out)
static void __ha_nvec_reset(struct m0_ha_nvec *nvec, int32_t total)
M0_INTERNAL bool m0_conf_service_is_top_rms(const struct m0_conf_service *svc)
const struct m0_conf_obj_type M0_CONF_DIR_TYPE
#define m0_tl_for(name, head, obj)
M0_INTERNAL bool m0_conf_service_ep_is_known(const struct m0_conf_obj *svc_obj, const char *ep_addr)
M0_INTERNAL int m0_conf__diter_init(struct m0_conf_diter *it, struct m0_confc *confc, struct m0_conf_obj *origin, uint32_t nr_lvls, const struct m0_fid *path)
const struct m0_conf_obj_type M0_CONF_RACK_TYPE
static const char * process_fid
#define M0_IMPOSSIBLE(fmt,...)