Motr  M0
cp_common.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_SNS_CM_UT_CP_COMMON_H__
26 #define __MOTR_SNS_CM_UT_CP_COMMON_H__
27 
28 #include "ut/ut.h"
29 #include "sns/cm/cp.h"
30 #include "sns/cm/ag.h"
31 
32 extern struct m0_motr sctx;
33 
34 /* Populates the bufvec with a character value. */
35 void bv_populate(struct m0_bufvec *b, char data, uint32_t seg_nr,
36  uint32_t seg_size);
37 void bv_alloc_populate(struct m0_bufvec *b, char data, uint32_t seg_nr,
38  uint32_t seg_size);
39 
40 /* Compares 2 bufvecs and asserts if not equal. */
41 void bv_compare(struct m0_bufvec *b1, struct m0_bufvec *b2, uint32_t seg_nr,
42  uint32_t seg_size);
43 
44 void bv_free(struct m0_bufvec *b);
45 
46 void cp_prepare(struct m0_cm_cp *cp, struct m0_net_buffer *buf,
47  uint32_t bv_seg_nr, uint32_t bv_seg_size,
48  struct m0_sns_cm_ag *sns_ag, char data,
49  struct m0_fom_ops *cp_fom_ops, struct m0_reqh *reqh,
50  uint64_t cp_ag_idx, bool is_acc_cp, struct m0_cm *scm);
51 struct m0_sns_cm *reqh2snscm(struct m0_reqh *reqh);
52 
53 void layout_gen(struct m0_pdclust_layout **pdlay, struct m0_reqh *reqh);
55 
56 int cs_init(struct m0_motr *sctx);
57 int cs_init_with_ad_stob(struct m0_motr *sctx);
58 void cs_fini(struct m0_motr *sctx);
59 
60 void pool_mach_transit(struct m0_reqh *reqh, struct m0_poolmach *pm,
61  uint64_t fd, enum m0_pool_nd_state state);
62 
63 #endif /* __MOTR_SNS_CM_UT_CP_COMMON_H__ */
64 
65 /*
66  * Local variables:
67  * c-indentation-style: "K&R"
68  * c-basic-offset: 8
69  * tab-width: 8
70  * fill-column: 80
71  * scroll-step: 1
72  * End:
73  */
static m0_bcount_t seg_size
Definition: net.c:118
Definition: cm.h:205
void cp_prepare(struct m0_cm_cp *cp, struct m0_net_buffer *buf, uint32_t bv_seg_nr, uint32_t bv_seg_size, struct m0_sns_cm_ag *sns_ag, char data, struct m0_fom_ops *cp_fom_ops, struct m0_reqh *reqh, uint64_t cp_ag_idx, bool is_acc_cp, struct m0_cm *scm)
Definition: cp_common.c:120
int cs_init(struct m0_motr *sctx)
Definition: cp_common.c:206
static uint32_t seg_nr
Definition: net.c:119
void cs_fini(struct m0_motr *sctx)
Definition: cp_common.c:221
Definition: cp.h:160
struct m0_bufvec data
Definition: di.c:40
static struct m0_sns_cm * scm
Definition: cm.c:64
struct m0_pdclust_layout * pdlay
Definition: xform.c:51
Definition: sock.c:887
int cs_init_with_ad_stob(struct m0_motr *sctx)
Definition: cp_common.c:215
void layout_gen(struct m0_pdclust_layout **pdlay, struct m0_reqh *reqh)
Definition: cp_common.c:227
void bv_populate(struct m0_bufvec *b, char data, uint32_t seg_nr, uint32_t seg_size)
Definition: cp_common.c:71
m0_pool_nd_state
Definition: pool_machine.h:57
void bv_free(struct m0_bufvec *b)
Definition: cp_common.c:115
void layout_destroy(struct m0_pdclust_layout *pdlay)
Definition: cp_common.c:257
Definition: reqh.h:94
void bv_alloc_populate(struct m0_bufvec *b, char data, uint32_t seg_nr, uint32_t seg_size)
Definition: cp_common.c:84
Definition: setup.h:354
struct m0_reqh reqh
Definition: rm_foms.c:48
static const struct m0_fom_ops cp_fom_ops
Definition: cp.c:448
Definition: cm.h:166
struct m0t1fs_filedata * fd
Definition: dir.c:1030
void pool_mach_transit(struct m0_reqh *reqh, struct m0_poolmach *pm, uint64_t fd, enum m0_pool_nd_state state)
Definition: cp_common.c:262
struct m0_sns_cm * reqh2snscm(struct m0_reqh *reqh)
Definition: cp_common.c:160
struct m0_motr sctx
Definition: main.c:80
void bv_compare(struct m0_bufvec *b1, struct m0_bufvec *b2, uint32_t seg_nr, uint32_t seg_size)
Definition: cp_common.c:95
Definition: vec.h:145