Motr  M0
be.c
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 
29 #include "ut/be.h"
30 
31 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_UT
32 #include "lib/trace.h"
33 
34 #include "ut/ut.h" /* M0_UT_ASSERT */
35 #include "be/ut/helper.h" /* m0_be_ut_backend */
36 #include "be/op.h" /* M0_BE_OP_SYNC */
37 #include "lib/misc.h" /* M0_BITS */
38 #include "lib/memory.h" /* M0_ALLOC_PTR */
39 
40 #include "reqh/reqh.h"
41 
42 M0_INTERNAL void
44 {
46  m0_be_ut_seg_init(seg, be, 1 << 20 /* 1 MB */);
47 }
48 
49 M0_INTERNAL void
51 {
54 }
55 
56 M0_INTERNAL void m0_ut_be_tx_begin(struct m0_be_tx *tx,
57  struct m0_be_ut_backend *ut_be,
58  struct m0_be_tx_credit *cred)
59 {
60  int rc;
61 
63  m0_be_tx_prep(tx, cred);
64  rc = m0_be_tx_open_sync(tx);
65  M0_ASSERT(rc == 0);
66 }
67 
68 M0_INTERNAL void m0_ut_be_tx_begin2(struct m0_be_tx *tx,
69  struct m0_be_ut_backend *ut_be,
70  struct m0_be_tx_credit *cred,
71  m0_bcount_t payload_cred)
72 {
73  int rc;
74 
76  m0_be_tx_prep(tx, cred);
77  m0_be_tx_payload_prep(tx, payload_cred);
78  rc = m0_be_tx_open_sync(tx);
79  M0_ASSERT(rc == 0);
80 }
81 
82 M0_INTERNAL void m0_ut_be_tx_end(struct m0_be_tx *tx)
83 {
85  m0_be_tx_fini(tx);
86 }
87 
88 #undef M0_TRACE_SUBSYSTEM
89 
92 /*
93  * Local variables:
94  * c-indentation-style: "K&R"
95  * c-basic-offset: 8
96  * tab-width: 8
97  * fill-column: 80
98  * scroll-step: 1
99  * End:
100  */
101 /*
102  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
103  */
void m0_be_ut_seg_fini(struct m0_be_ut_seg *ut_seg)
Definition: stubs.c:267
M0_INTERNAL void m0_ut_backend_fini(struct m0_be_ut_backend *be, struct m0_be_ut_seg *seg)
Definition: be.c:50
M0_INTERNAL void m0_be_tx_fini(struct m0_be_tx *tx)
Definition: stubs.c:163
M0_INTERNAL void m0_ut_be_tx_end(struct m0_be_tx *tx)
Definition: be.c:82
M0_INTERNAL void m0_be_tx_prep(struct m0_be_tx *tx, const struct m0_be_tx_credit *credit)
Definition: stubs.c:175
void m0_be_ut_seg_init(struct m0_be_ut_seg *ut_seg, struct m0_be_ut_backend *ut_be, m0_bcount_t size)
Definition: stubs.c:256
uint64_t m0_bcount_t
Definition: types.h:77
M0_INTERNAL void m0_ut_be_tx_begin2(struct m0_be_tx *tx, struct m0_be_ut_backend *ut_be, struct m0_be_tx_credit *cred, m0_bcount_t payload_cred)
Definition: be.c:68
struct m0_be_ut_backend ut_be
Definition: ad.c:72
M0_INTERNAL void m0_ut_be_tx_begin(struct m0_be_tx *tx, struct m0_be_ut_backend *ut_be, struct m0_be_tx_credit *cred)
Definition: be.c:56
#define M0_ASSERT(cond)
M0_INTERNAL int m0_be_tx_open_sync(struct m0_be_tx *tx)
Definition: stubs.c:199
void m0_be_ut_backend_init(struct m0_be_ut_backend *ut_be)
Definition: stubs.c:238
void m0_be_ut_tx_init(struct m0_be_tx *tx, struct m0_be_ut_backend *ut_be)
Definition: stubs.c:286
void m0_be_ut_backend_fini(struct m0_be_ut_backend *ut_be)
Definition: stubs.c:242
static struct m0_be_seg * seg
Definition: btree.c:40
M0_INTERNAL void m0_be_tx_payload_prep(struct m0_be_tx *tx, m0_bcount_t size)
Definition: stubs.c:180
int32_t rc
Definition: trigger_fop.h:47
static struct m0_be_ut_backend be
Definition: service_ut.c:59
M0_INTERNAL void m0_ut_backend_init(struct m0_be_ut_backend *be, struct m0_be_ut_seg *seg)
Definition: be.c:43
M0_INTERNAL void m0_be_tx_close_sync(struct m0_be_tx *tx)
Definition: stubs.c:205
Definition: tx.h:280