23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_STOB 67 rc = colon ==
NULL ? -EINVAL : 0;
68 rc =
rc ?: type_str ==
NULL ? -ENOMEM : 0;
69 if (colon !=
NULL && type_str !=
NULL) {
81 char *location_data =
NULL;
98 const char *location_data,
100 const char *str_cfg_create)
102 void *cfg_create =
NULL;
106 rc =
type->st_ops->sto_domain_cfg_create_parse(str_cfg_create,
108 cfg_parsed =
rc == 0;
109 rc =
rc ?:
type->st_ops->sto_domain_create(
type, location_data,
110 dom_key, cfg_create);
112 type->st_ops->sto_domain_cfg_create_free(cfg_create);
117 const char *location_data,
118 const char *str_cfg_init,
121 void *cfg_init =
NULL;
125 M0_ENTRY(
"location_data=%s str_cfg_init=%s",
126 location_data, str_cfg_init);
127 rc =
type->st_ops->sto_domain_cfg_init_parse(str_cfg_init, &cfg_init);
128 cfg_parsed =
rc == 0;
129 rc =
rc ?:
type->st_ops->sto_domain_init(
type, location_data,
132 type->st_ops->sto_domain_cfg_init_free(cfg_init);
137 const char *str_cfg_init,
139 const char *str_cfg_create,
152 "str_cfg_create=%s init=%d",
153 location, str_cfg_init, dom_key, str_cfg_create, !!
init);
159 rc =
rc ?: location_data ==
NULL ? -ENOMEM : 0;
166 "init() after create() failed: rc = %d, " 171 "destroy() failed: rc = %d, " 196 const char *str_cfg_init,
218 const char *str_cfg_init,
220 const char *str_cfg_create,
224 str_cfg_create,
out,
false);
233 M0_ENTRY(
"location=%s", location_const);
253 rc =
rc ?: location_data ==
NULL ? -ENOMEM : 0;
254 rc =
rc ?:
type->st_ops->sto_domain_destroy(
type, location_data);
257 if (!M0_IN(
rc, (0, -ENOENT)))
263 const char *str_cfg_init,
265 const char *str_cfg_create,
273 dom_key, str_cfg_create,
out);
299 M0_INTERNAL
const struct m0_fid *
305 M0_INTERNAL
const char *
324 return dom_id->
f_key;
329 uint64_t dom_container,
332 m0_fid_tset(dom_id, type_id, dom_container, dom_key);
346 return (dom_key & 0xFFULL << 56) == 0;
static int stob_domain_init(struct m0_stob_type *type, const char *location_data, const char *str_cfg_init, struct m0_stob_domain **out)
M0_INTERNAL struct m0_stob_type * m0_stob_type_by_dom_id(const struct m0_fid *id)
static int stob_domain_init_create(const char *location, const char *str_cfg_init, uint64_t dom_key, const char *str_cfg_create, struct m0_stob_domain **out, bool init)
M0_INTERNAL uint64_t m0_stob_domain__dom_key(const struct m0_fid *dom_id)
M0_INTERNAL struct m0_stob_domain * m0_stob_domain_find(const struct m0_fid *dom_id)
M0_INTERNAL void m0_stob_domain__dom_id_make(struct m0_fid *dom_id, uint8_t type_id, uint64_t dom_container, uint64_t dom_key)
M0_INTERNAL void m0_fid_tset(struct m0_fid *fid, uint8_t tid, uint64_t container, uint64_t key)
struct m0_fid si_domain_fid
static void stob_domain_cache_evict_cb(struct m0_stob_cache *cache, struct m0_stob *stob)
#define M0_LOG(level,...)
M0_INTERNAL const struct m0_fid * m0_stob_domain_id_get(const struct m0_stob_domain *dom)
M0_INTERNAL int m0_stob_domain_destroy(struct m0_stob_domain *dom)
M0_INTERNAL bool m0_stob_domain_is_of_type(const struct m0_stob_domain *dom, const struct m0_stob_type *dt)
M0_INTERNAL uint8_t m0_stob_type_id_get(const struct m0_stob_type *type)
M0_INTERNAL uint8_t m0_fid_tget(const struct m0_fid *fid)
void(* sdo_fini)(struct m0_stob_domain *dom)
M0_INTERNAL struct m0_stob_domain * m0_stob_type__dom_find(struct m0_stob_type *type, const struct m0_fid *dom_id)
M0_INTERNAL int m0_stob_cache_init(struct m0_stob_cache *cache, uint64_t idle_size, m0_stob_cache_eviction_cb_t eviction_cb)
M0_INTERNAL void m0_stob__cache_evict(struct m0_stob *stob)
M0_INTERNAL void m0_stob_type__dom_del(struct m0_stob_type *type, struct m0_stob_domain *dom)
#define M0_ASSERT_EX(cond)
M0_INTERNAL struct m0_stob_domain * m0_stob_domain_find_by_location(const char *location)
M0_INTERNAL bool m0_stob_domain__dom_key_is_valid(uint64_t dom_key)
M0_INTERNAL int m0_stob_domain_create(const char *location, const char *str_cfg_init, uint64_t dom_key, const char *str_cfg_create, struct m0_stob_domain **out)
static int stob_domain_create(struct m0_stob_type *type, const char *location_data, uint64_t dom_key, const char *str_cfg_create)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_stob_type__dom_add(struct m0_stob_type *type, struct m0_stob_domain *dom)
static struct m0_stob * stob
M0_INTERNAL struct m0_stob_domain * m0_stob_type__dom_find_by_location(struct m0_stob_type *type, const char *location)
struct m0_stob_cache sd_cache
static struct m0_stob_domain * dom
M0_INTERNAL void m0_stob_cache_fini(struct m0_stob_cache *cache)
M0_INTERNAL struct m0_stob_domain * m0_stob_domain_find_by_stob_id(const struct m0_stob_id *stob_id)
M0_INTERNAL void m0_stob_domain_fini(struct m0_stob_domain *dom)
int init(struct workload *w)
M0_INTERNAL int m0_stob_domain_destroy_location(const char *location)
struct m0_stob_type * sd_type
M0_INTERNAL struct m0_stob_type * m0_stob_type_by_name(const char *name)
M0_INTERNAL int m0_stob_domain_init(const char *location, const char *str_cfg_init, struct m0_stob_domain **out)
M0_INTERNAL int m0_stob_domain_create_or_init(const char *location, const char *str_cfg_init, uint64_t dom_key, const char *str_cfg_create, struct m0_stob_domain **out)
M0_INTERNAL const char * m0_stob_domain_location_get(const struct m0_stob_domain *dom)
M0_INTERNAL void m0_stob_domain__id_set(struct m0_stob_domain *dom, struct m0_fid *dom_id)
M0_INTERNAL bool m0_stob_domain__invariant(struct m0_stob_domain *dom)
static char * stob_domain_location_data(const char *location)
const struct m0_stob_domain_ops * sd_ops
static int stob_domain_type(const char *location, struct m0_stob_type **type)
M0_INTERNAL uint8_t m0_stob_domain__type_id(const struct m0_fid *dom_id)