25 #ifndef __MOTR_LIB_VEC_H__ 26 #define __MOTR_LIB_VEC_H__ 165 #define M0_BUFVEC_INIT_BUF(addr_ptr, count_ptr) (struct m0_bufvec){ \ 168 .v_count = (count_ptr), \ 170 .ov_buf = (addr_ptr) \ 429 #define M0_BUFVEC_FOR2(c0, c1, frag) \ 431 struct m0_bufvec_cursor *__c0 = (c0); \ 432 struct m0_bufvec_cursor *__c1 = (c1); \ 433 m0_bcount_t frag = 0; \ 434 while (!(m0_bufvec_cursor_move(__c0, frag) | \ 435 m0_bufvec_cursor_move(__c1, frag))) { \ 436 frag = min_check(m0_bufvec_cursor_step(__c0), \ 437 m0_bufvec_cursor_step(__c1)); 439 #define M0_BUFVEC_ENDFOR2 } } 526 M0_0VEC_ALIGN = (1 << M0_0VEC_SHIFT),
527 M0_0VEC_MASK = M0_0VEC_ALIGN - 1,
529 M0_SEG_SIZE = (1 << M0_SEG_SHIFT),
531 #elif defined (CONFIG_AARCH64) 534 M0_0VEC_ALIGN = (1 << M0_0VEC_SHIFT),
535 M0_0VEC_MASK = M0_0VEC_ALIGN - 1,
537 M0_SEG_SIZE = (1 << M0_SEG_SHIFT),
540 #error "The platform is not supported" static m0_bcount_t seg_size
M0_INTERNAL m0_bcount_t m0_bufvec_copy(struct m0_bufvec *dst, struct m0_bufvec *src, m0_bcount_t num_bytes)
M0_INTERNAL int m0_0vec_init(struct m0_0vec *zvec, uint32_t segs_nr)
M0_INTERNAL void m0_ivec_cursor_init(struct m0_ivec_cursor *cur, const struct m0_indexvec *ivec)
static m0_bindex_t indices[ZEROVEC_UT_SEGS_NR]
M0_INTERNAL int m0_bufvec_to_buf_copy(struct m0_buf *buf, const struct m0_bufvec *bvec)
M0_INTERNAL bool m0_ivec_varr_cursor_move_to(struct m0_ivec_varr_cursor *cur, m0_bindex_t dest)
M0_INTERNAL int m0_bufvec_alloc_aligned_packed(struct m0_bufvec *bufvec, uint32_t num_segs, m0_bcount_t seg_size, unsigned shift)
M0_INTERNAL int m0_indexvec_alloc(struct m0_indexvec *ivec, uint32_t len)
M0_INTERNAL void m0_0vec_fini(struct m0_0vec *zvec)
M0_INTERNAL m0_bcount_t m0_ivec_cursor_step(const struct m0_ivec_cursor *cur)
M0_INTERNAL int m0_buf_to_bufvec_copy(struct m0_bufvec *bvec, const struct m0_buf *buf)
struct m0_vec_cursor bc_vc
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
M0_INTERNAL m0_bindex_t m0_ivec_cursor_conti(const struct m0_ivec_cursor *cur, m0_bindex_t dest)
struct m0_io_indexvec * cis_ivecs
struct m0_vec_cursor ic_cur
M0_INTERNAL int m0_bufvec_splice(const struct m0_bufvec *bvec, m0_bcount_t nr, struct m0_buf *buf)
M0_INTERNAL uint32_t m0_bufvec_pack(struct m0_bufvec *bv)
M0_INTERNAL void m0_0vec_bvec_init(struct m0_0vec *zvec, const struct m0_bufvec *src, const m0_bindex_t *index)
M0_INTERNAL int m0_bufvec_merge(struct m0_bufvec *dst_bufvec, struct m0_bufvec *src_bufvec)
M0_INTERNAL m0_bindex_t m0_ivec_varr_cursor_conti(const struct m0_ivec_varr_cursor *cur, m0_bindex_t dest)
M0_INTERNAL m0_bcount_t m0_ivec_varr_cursor_step(const struct m0_ivec_varr_cursor *cur)
M0_INTERNAL m0_bcount_t m0_vec_cursor_end(const struct m0_vec_cursor *cur)
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
M0_INTERNAL int m0_data_to_bufvec_copy(struct m0_bufvec_cursor *cur, void *data, size_t len)
M0_INTERNAL bool m0_ivec_cursor_move_to(struct m0_ivec_cursor *cur, m0_bindex_t dest)
M0_INTERNAL int m0_bufvec_extend(struct m0_bufvec *bufvec, uint32_t num_segs)
M0_INTERNAL int m0_bufvec_cursor_cmp(struct m0_bufvec_cursor *c0, struct m0_bufvec_cursor *c1)
int m0_bufvec_alloc_aligned(struct m0_bufvec *bufvec, uint32_t num_segs, m0_bcount_t seg_size, unsigned shift)
M0_INTERNAL int m0_bufvec_alloc(struct m0_bufvec *bufvec, uint32_t num_segs, m0_bcount_t seg_size)
M0_INTERNAL void m0_bufvec_free(struct m0_bufvec *bufvec)
M0_INTERNAL bool m0_bufvec_cursor_move(struct m0_bufvec_cursor *cur, m0_bcount_t count)
M0_INTERNAL int m0_bufvec_to_data_copy(struct m0_bufvec_cursor *cur, void *data, size_t len)
M0_INTERNAL int m0_indexvec_varr_alloc(struct m0_indexvec_varr *ivec, uint32_t len)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copyfrom(struct m0_bufvec_cursor *scur, void *ddata, m0_bcount_t num_bytes)
M0_INTERNAL bool m0_vec_is_empty(const struct m0_vec *vec)
M0_INTERNAL m0_bindex_t m0_ivec_varr_cursor_index(const struct m0_ivec_varr_cursor *cur)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copy(struct m0_bufvec_cursor *dcur, struct m0_bufvec_cursor *scur, m0_bcount_t num_bytes)
M0_INTERNAL void m0_vec_cursor_init(struct m0_vec_cursor *cur, const struct m0_vec *vec)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_step(const struct m0_bufvec_cursor *cur)
static struct m0_bufvec bvec
M0_INTERNAL int m0_indexvec_wire2mem(struct m0_io_indexvec *wire_ivec, int max_frags_nr, uint32_t bshift, struct m0_indexvec *mem_ivec)
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
m0_bcount_t counts[SEGS_NR]
M0_INTERNAL int m0_0vec_cbuf_add(struct m0_0vec *zvec, const struct m0_buf *buf, const m0_bindex_t *index)
M0_INTERNAL bool m0_ivec_cursor_move(struct m0_ivec_cursor *cur, m0_bcount_t count)
M0_INTERNAL void m0_indexvec_varr_free(struct m0_indexvec_varr *ivec)
M0_INTERNAL void m0_bufvec_free_aligned(struct m0_bufvec *bufvec, unsigned shift)
M0_INTERNAL m0_bcount_t m0_vec_count(const struct m0_vec *vec)
M0_INTERNAL uint32_t m0_indexvec_pack(struct m0_indexvec *iv)
M0_INTERNAL void m0_ivec_varr_cursor_init(struct m0_ivec_varr_cursor *cur, struct m0_indexvec_varr *ivec)
M0_INTERNAL int m0_indexvec_split(struct m0_indexvec *in, m0_bcount_t curr_pos, m0_bcount_t nb_len, uint32_t bshift, struct m0_indexvec *out)
M0_INTERNAL m0_bcount_t m0_vec_cursor_step(const struct m0_vec_cursor *cur)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_prefix(struct m0_bufvec_cursor *c0, struct m0_bufvec_cursor *c1)
M0_INTERNAL int m0_indexvec_mem2wire(struct m0_indexvec *mem_ivec, int max_frags_nr, uint32_t bshift, struct m0_io_indexvec *wire_ivec)
M0_INTERNAL bool m0_bufvec_cursor_align(struct m0_bufvec_cursor *cur, uint64_t alignment)
M0_INTERNAL int m0__bufvec_dont_dump(struct m0_bufvec *bufvec)
M0_INTERNAL int m0_indexvec_universal_set(struct m0_indexvec *iv)
M0_INTERNAL bool m0_vec_cursor_move(struct m0_vec_cursor *cur, m0_bcount_t count)
M0_INTERNAL m0_bcount_t m0_io_count(const struct m0_io_indexvec *io_info)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copyto(struct m0_bufvec_cursor *dcur, void *sdata, m0_bcount_t num_bytes)
M0_INTERNAL m0_bindex_t m0_ivec_cursor_index(const struct m0_ivec_cursor *cur)
m0_bindex_t z_last_buf_idx
M0_INTERNAL bool m0_indexvec_is_universal(const struct m0_indexvec *iv)
M0_INTERNAL void m0_bufvec_free_aligned_packed(struct m0_bufvec *bufvec, unsigned shift)
M0_INTERNAL void m0_0vec_bufs_init(struct m0_0vec *zvec, void **bufs, const m0_bindex_t *index, const m0_bcount_t *counts, uint32_t segs_nr)
struct m0_vec_cursor M0_XCA_DOMAIN
const struct m0_vec * vc_vec
struct m0_ioseg * ci_iosegs
struct m0_pdclust_src_addr src
M0_INTERNAL void m0_bufvec_free2(struct m0_bufvec *bufvec)
M0_INTERNAL bool m0_ivec_varr_cursor_move(struct m0_ivec_varr_cursor *cur, m0_bcount_t count)
M0_INTERNAL int m0_bufvec_empty_alloc(struct m0_bufvec *bufvec, uint32_t num_segs)
struct m0_indexvec_varr * vc_ivv