25 #ifndef __MOTR_BE_FMT_H__ 26 #define __MOTR_BE_FMT_H__ 29 #include "lib/buf_xc.h" 209 #define BFLH_F "(flh_serial=%" PRIu64 " flh_discarded=%" PRIu64 " " \ 210 "flh_group_lsn=%" PRIu64 " flh_group_size=%" PRIu64 ")" 211 #define BFLH_P(log_hdr) (log_hdr)->flh_serial, (log_hdr)->flh_discarded, \ 212 (log_hdr)->flh_group_lsn, (log_hdr)->flh_group_size 268 #define BFLRH_F "(pos=%" PRIu64 " size=%" PRIu64 " discarded=%" PRIu64 " " \ 269 "prev_pos=%" PRIu64 " prev_size=%" PRIu64 \ 270 " io_nr_max=%" PRIu64 ")" 271 #define BFLRH_P(h) (h)->lrh_pos, (h)->lrh_size, (h)->lrh_discarded, \ 272 (h)->lrh_prev_pos, (h)->lrh_prev_size, \ 291 #define M0_BE_FMT_DECODE_CFG_DEFAULT \ 292 (&(const struct m0_be_fmt_decode_cfg) { \ 293 .dc_group_size_max = 1 << 24, \ 295 .dc_iter_end = NULL, \ 298 #define M0_BE_FMT_DECODE_CFG_DEFAULT_WITH_TRACE \ 299 (&(const struct m0_be_fmt_decode_cfg) { \ 300 .dc_group_size_max = 1 << 24, \ 301 .dc_iter = m0_be_fmt_type_trace, \ 302 .dc_iter_end = m0_be_fmt_type_trace_end, \ 306 #define M0_BE_FMT_DECLARE(name) \ 307 struct m0_be_fmt_##name; \ 308 struct m0_be_fmt_##name##_cfg; \ 310 m0_be_fmt_##name##_init(struct m0_be_fmt_##name *obj, \ 311 const struct m0_be_fmt_##name##_cfg *cfg); \ 312 M0_INTERNAL void m0_be_fmt_##name##_fini(struct m0_be_fmt_##name *obj); \ 313 M0_INTERNAL void m0_be_fmt_##name##_reset(struct m0_be_fmt_##name *obj); \ 314 M0_INTERNAL m0_bcount_t \ 315 m0_be_fmt_##name##_size(struct m0_be_fmt_##name *obj); \ 316 M0_INTERNAL m0_bcount_t \ 317 m0_be_fmt_##name##_size_max(const struct m0_be_fmt_##name##_cfg *cfg); \ 318 M0_INTERNAL int m0_be_fmt_##name##_encode(struct m0_be_fmt_##name *obj, \ 319 struct m0_bufvec_cursor *cur); \ 320 M0_INTERNAL int m0_be_fmt_##name##_encode_buf(struct m0_be_fmt_##name *obj, \ 321 struct m0_buf *buf); \ 323 m0_be_fmt_##name##_decode(struct m0_be_fmt_##name **obj, \ 324 struct m0_bufvec_cursor *cur, \ 325 const struct m0_be_fmt_decode_cfg *cfg); \ 327 m0_be_fmt_##name##_decode_buf(struct m0_be_fmt_##name **obj, \ 328 struct m0_buf *buf, \ 329 const struct m0_be_fmt_decode_cfg *cfg); \ 330 M0_INTERNAL void m0_be_fmt_##name##_decoded_free(struct m0_be_fmt_##name *obj) 349 #define M0_BE_FMT_REG(size, addr, buf) (struct m0_be_fmt_reg){ \ 368 #define M0_BE_FMT_TX(payload, id) (struct m0_be_fmt_tx){ \ 369 .bft_payload = (payload), \ 391 #undef M0_BE_FMT_DECLARE
uint64_t fgc_payload_size_max
M0_INTERNAL uint32_t m0_be_fmt_group_reg_nr(const struct m0_be_fmt_group *fg)
M0_INTERNAL void m0_be_fmt_group_reg_add(struct m0_be_fmt_group *fg, const struct m0_be_fmt_reg *freg)
M0_INTERNAL void m0_be_fmt_type_trace_end(const struct m0_xcode_cursor *it)
static struct m0_be_emap_cursor it
M0_INTERNAL void m0_be_fmt_group_tx_by_id(const struct m0_be_fmt_group *fg, uint32_t index, struct m0_be_fmt_tx *ftx)
uint64_t dc_group_size_max
M0_INTERNAL void m0_be_fmt_log_record_header_io_size_add(struct m0_be_fmt_log_record_header *obj, m0_bcount_t size)
uint64_t fgc_reg_size_max
M0_INTERNAL struct m0_be_fmt_group_info * m0_be_fmt_group_info_get(struct m0_be_fmt_group *fg)
struct m0_be_fmt_content fg_content
struct m0_be_fmt_group_header fg_header
M0_INTERNAL int m0_be_fmt_type_trace(const struct m0_xcode_cursor *it)
struct m0_buf bft_payload
#define M0_BE_FMT_DECLARE(name)
struct m0_be_fmt_content_header fg_content_header
M0_INTERNAL void m0_be_fmt_group_reg_by_id(const struct m0_be_fmt_group *fg, uint32_t index, struct m0_be_fmt_reg *freg)
struct m0_buf * fcp_payload
M0_INTERNAL void m0_be_fmt_group_tx_add(struct m0_be_fmt_group *fg, const struct m0_be_fmt_tx *ftx)
M0_BASSERT(sizeof(((struct m0_be_fmt_group *) NULL) ->fg_cfg)==sizeof(struct m0_be_fmt_group_cfg *))
struct m0_be_fmt_content_payloads fmc_payloads
int(* dc_iter)(const struct m0_xcode_cursor *it)
struct m0_be_fmt_log_store_header_cfg M0_XCA_DOMAIN
void(* dc_iter_end)(const struct m0_xcode_cursor *it)
M0_INTERNAL bool m0_be_fmt_group_sanity_check(struct m0_be_fmt_group *fg)
M0_INTERNAL uint32_t m0_be_fmt_group_tx_nr(const struct m0_be_fmt_group *fg)
struct m0_be_fmt_content_reg_area fmc_reg_area
static struct m0_be_ut_backend be