31 #include "xcode/ut/xcode_fops_ff.h" 62 struct m0_fop_test *ftest;
67 ftest = (
struct m0_fop_test *)fdata;
72 for (
i = 0;
i < ftest->ft_arr.fta_cnt; ++
i) {
77 for (j = 0; j < ftest->ft_arr.fta_data->da_cnt; ++j) {
82 temp = ftest->ft_arr.fta_data[
i].da_pair[j].p_offset;
85 temp = ftest->ft_arr.fta_data[
i].da_pair[j].p_cnt;
89 ftest->ft_arr.fta_data[
i].da_pair[j].p_key.tk_index;
93 ftest->ft_arr.fta_data[
i].da_pair[j].p_key.tk_val;
97 ftest->ft_arr.fta_data[
i].da_pair[j].p_key.tk_flag;
99 cnt = ftest->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_cnt;
102 ftest->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_buf;
112 struct m0_fop_test *ccf1;
117 for (
i = 0;
i < ccf1->ft_arr.fta_cnt; ++
i) {
118 for (j = 0; j < ccf1->ft_arr.fta_data->da_cnt; ++j) {
122 ccf1->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_buf;
126 for (
i = 0;
i < ccf1->ft_arr.fta_cnt; ++
i)
127 m0_free(ccf1->ft_arr.fta_data[
i].da_pair);
129 m0_free(ccf1->ft_arr.fta_data);
185 struct m0_fop_test *ccf1;
189 size_t act_fop_size = 6876;
200 .
name =
"xcode fop test",
202 .
xt = m0_fop_test_xc,
215 M0_ALLOC_ARR(ccf1->ft_arr.fta_data, ccf1->ft_arr.fta_cnt);
218 for (
i = 0;
i < ccf1->ft_arr.fta_cnt; ++
i) {
221 ccf1->ft_arr.fta_data[
i].da_cnt);
225 for (
i = 0;
i < ccf1->ft_arr.fta_cnt; ++
i) {
231 for (j = 0; j < ccf1->ft_arr.fta_data->da_cnt; ++j) {
234 ccf1->ft_arr.fta_data[
i].da_pair[j].p_offset = ival++;
235 ccf1->ft_arr.fta_data[
i].da_pair[j].p_cnt =
cnt++;
236 ccf1->ft_arr.fta_data[
i].da_pair[j].p_key.tk_index =
238 ccf1->ft_arr.fta_data[
i].da_pair[j].p_key.tk_val =
240 ccf1->ft_arr.fta_data[
i].da_pair[j].p_key.tk_flag =
244 ccf1->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_buf =
246 ccf1->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_cnt =
248 memcpy(ccf1->ft_arr.fta_data[
i].da_pair[j].p_buf.tb_buf,
314 m0_xc_xcode_fops_init();
320 m0_xc_xcode_fops_fini();
325 .
ts_name =
"xcode_bufvec_fop-ut",
static void fop_verify(struct m0_fop *fop)
M0_INTERNAL void * m0_xcode_ctx_top(const struct m0_xcode_ctx *ctx)
#define M0_ALLOC_ARR(arr, nr)
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
struct m0_bufvec nb_buffer
#define M0_FOP_TYPE_INIT(ft,...)
static char * fop_test_buf
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
static void test_fop_encdec(void)
const struct m0_xcode_type * ft_xt
static int xcode_bufvec_fop_fini(void)
void *(* xcx_alloc)(struct m0_xcode_cursor *, size_t)
void * m0_fop_data(const struct m0_fop *fop)
void m0_fop_type_fini(struct m0_fop_type *fopt)
struct m0_bufvec_cursor xcx_buf
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
M0_INTERNAL int m0_xcode_decode(struct m0_xcode_ctx *ctx)
static struct m0_xcode_type ** xt[]
static void fop_free(struct m0_fop *fop)
M0_INTERNAL int m0_bufvec_alloc(struct m0_bufvec *bufvec, uint32_t num_segs, m0_bcount_t seg_size)
M0_INTERNAL int m0_xcode_length(struct m0_xcode_ctx *ctx)
M0_INTERNAL void m0_bufvec_free(struct m0_bufvec *bufvec)
struct m0_fop_type * f_type
static struct m0_addb2_callback c
static int xcode_bufvec_fop_init(void)
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
static struct m0_fop_type m0_fop_test_fopt
M0_INTERNAL void * m0_xcode_alloc(struct m0_xcode_cursor *it, size_t nob)
struct m0_rpc_machine machine
struct m0_fop_type_ops test_ops
struct m0_fop_data f_data
M0_INTERNAL void m0_fop_release(struct m0_ref *ref)
struct m0_ut_suite xcode_bufvec_fop_ut
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL int m0_xcode_encode(struct m0_xcode_ctx *ctx)
static struct m0_fop * fop
M0_INTERNAL void m0_xcode_ctx_init(struct m0_xcode_ctx *ctx, const struct m0_xcode_obj *obj)
#define M0_IS_8ALIGNED(val)
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)