81 for (
i = 0;
i < sum0; ++
i) {
109 for (
i = 0;
i <
NR; ++
i) {
127 for (
i = 0;
i < 2 *
NR2; ++
i) {
139 for (
i = 0;
i <
NR; ++
i) {
274 indexes[0] = 0,
counts[0] = 2;
275 indexes[1] = 1,
counts[1] = 3;
276 indexes[2] = 2,
counts[2] = 1;
277 indexes[3] = 8,
counts[3] = 4;
387 static const char *msg =
"abcdefghijklmnopqrstuvwxyz0123456789" 389 size_t msglen = strlen(msg)+1;
403 memcpy(b->
ov_buf[0], msg, msglen);
435 uint32_t num_segs = shapes[
NR_BUFS-1].num_segs - 1;
458 for (j = 0; j <
buf.ov_vec.v_nr; ++j) {
461 for (k = 0; k <
buf.ov_vec.v_count[j]; ++k) {
462 q =
buf.ov_buf[j] + k;
475 uint32_t num_segs = shapes[
NR_BUFS-1].num_segs + 1;
498 for (j = 0; j <
buf.ov_vec.v_nr; ++j) {
501 for (k = 0; k <
buf.ov_vec.v_count[j] && len < msglen;
503 q =
buf.ov_buf[j] + k;
530 static const struct struct_int struct_int1 = {
536 static const struct struct_char struct_char1 = {
545 struct struct_int *struct_int2 =
NULL;
546 struct struct_char *struct_char2 =
NULL;
547 struct struct_int struct_int3;
548 struct struct_char struct_char3;
555 nbytes =
sizeof struct_int1 * 4 +
sizeof struct_char1 * 4 + 1;
569 for (
i = 0;
i < 4; ++
i) {
572 (
void *)&struct_int1,
578 (
void *)&struct_char1,
579 sizeof struct_char1);
588 for (
i = 0;
i < 3; ++
i) {
604 M0_UT_ASSERT(struct_char2->char1 == struct_char1.char1);
605 M0_UT_ASSERT(struct_char2->char2 == struct_char1.char2);
606 M0_UT_ASSERT(struct_char2->char3 == struct_char1.char3);
620 for (
i = 0;
i < 3; ++
i) {
632 sizeof struct_char3);
650 int tot = strlen(
src) + 1 +
n - 1;
651 static uint64_t
seed = 0;
659 for (
i = 0;
i <
n - 1; ++
i) {
673 vec->ov_vec.v_nr =
n;
674 for (
i = 0, len = 0, pos = 0, off = 0;
i <= tot; ++
i, ++len) {
678 vec->ov_vec.v_count[pos] = len;
679 memcpy(
vec->ov_buf[pos],
src + off, len);
690 static const char abc[] =
"vextcwmflyjabszingqurdkoph";
691 static const char aBc[] =
"vextcwmflyjabszingQurdkoph";
698 for (
n = 1;
n < 15; ++
n) {
699 for (
i = 0;
i < 1000; ++
i) {
static m0_bcount_t seg_size
#define M0_BUFVEC_INIT_BUF(addr_ptr, count_ptr)
M0_INTERNAL void m0_ivec_cursor_init(struct m0_ivec_cursor *cur, const struct m0_indexvec *ivec)
static struct m0_addb2_philter p
M0_INTERNAL bool m0_ivec_varr_cursor_move_to(struct m0_ivec_varr_cursor *cur, m0_bindex_t dest)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
static struct m0_semaphore q
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
M0_INTERNAL m0_bcount_t m0_ivec_cursor_step(const struct m0_ivec_cursor *cur)
static bool m0_addr_is_aligned(const void *addr, unsigned shift)
static void test_cmp(void)
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)
static struct m0_bufvec * split(const char *src, int n)
static m0_bcount_t segs[NR *IT]
static void test_indexvec_varr_cursor(void)
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)
static struct m0_be_emap_cursor it
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
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)
M0_INTERNAL 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_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 uint64_t m0_rnd(uint64_t max, uint64_t *seed)
M0_INTERNAL m0_bindex_t m0_ivec_varr_cursor_index(const struct m0_ivec_varr_cursor *cur)
static void test_bufvec_cursor(void)
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)
m0_time_t m0_time_now(void)
static struct m0_addb2_callback c
static void test_bufvec_cursor_copyto_copyfrom(void)
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
void * m0_alloc(size_t size)
m0_bcount_t counts[SEGS_NR]
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
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 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)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL bool m0_vec_cursor_move(struct m0_vec_cursor *cur, m0_bcount_t count)
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_copyto(struct m0_bufvec_cursor *dcur, void *sdata, m0_bcount_t num_bytes)
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
M0_INTERNAL m0_bindex_t m0_ivec_cursor_index(const struct m0_ivec_cursor *cur)
static void test_ivec_cursor(void)
static void m0_fi_enable_once(const char *func, const char *tag)
#define m0_varr_for(arr, type, idx, obj)
struct m0_pdclust_src_addr src
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)
M0_INTERNAL void * m0_varr_ele_get(struct m0_varr *arr, uint64_t index)
struct m0_indexvec_varr * vc_ivv