Motr  M0
onwire.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-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 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_RPC
24 #include "lib/trace.h"
25 
26 #include "lib/errno.h"
27 #include "rpc/onwire.h"
28 #include "rpc/onwire_xc.h"
29 #include "rpc/item.h" /* m0_rpc_item_header2 */
30 #include "rpc/rpc_helpers.h"
31 #include "xcode/xcode.h" /* M0_XCODE_OBJ */
32 
38 #define ITEM_HEAD1_XCODE_OBJ(ptr) M0_XCODE_OBJ(m0_rpc_item_header1_xc, ptr)
39 #define ITEM_HEAD2_XCODE_OBJ(ptr) M0_XCODE_OBJ(m0_rpc_item_header2_xc, ptr)
40 #define ITEM_FOOTER_XCODE_OBJ(ptr) M0_XCODE_OBJ(m0_rpc_item_footer_xc, ptr)
41 
42 M0_INTERNAL int m0_rpc_item_header1_encdec(struct m0_rpc_item_header1 *ioh,
43  struct m0_bufvec_cursor *cur,
44  enum m0_xcode_what what)
45 {
46  M0_ENTRY("item header1: %p", ioh);
47  return M0_RC(m0_xcode_encdec(&ITEM_HEAD1_XCODE_OBJ(ioh), cur, what));
48 }
49 
50 M0_INTERNAL int m0_rpc_item_header2_encdec(struct m0_rpc_item_header2 *ioh,
51  struct m0_bufvec_cursor *cur,
52  enum m0_xcode_what what)
53 {
54  M0_ENTRY("item header2: %p", ioh);
55  return M0_RC(m0_xcode_encdec(&ITEM_HEAD2_XCODE_OBJ(ioh), cur, what));
56 }
57 
58 M0_INTERNAL int m0_rpc_item_footer_encdec(struct m0_rpc_item_footer *iof,
59  struct m0_bufvec_cursor *cur,
60  enum m0_xcode_what what)
61 {
62  M0_ENTRY("item footer: %p", iof);
63  return M0_RC(m0_xcode_encdec(&ITEM_FOOTER_XCODE_OBJ(iof), cur, what));
64 }
65 
66 #undef M0_TRACE_SUBSYSTEM
67 
70 /*
71  * Local variables:
72  * c-indentation-style: "K&R"
73  * c-basic-offset: 8
74  * tab-width: 8
75  * fill-column: 79
76  * scroll-step: 1
77  * End:
78  */
M0_INTERNAL int m0_xcode_encdec(struct m0_xcode_obj *obj, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: xcode.c:416
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
Definition: addb2.c:791
M0_INTERNAL int m0_rpc_item_header1_encdec(struct m0_rpc_item_header1 *ioh, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: onwire.c:42
m0_xcode_what
Definition: xcode.h:647
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
#define ITEM_HEAD2_XCODE_OBJ(ptr)
Definition: onwire.c:39
M0_INTERNAL int m0_rpc_item_footer_encdec(struct m0_rpc_item_footer *iof, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: onwire.c:58
#define ITEM_FOOTER_XCODE_OBJ(ptr)
Definition: onwire.c:40
M0_INTERNAL int m0_rpc_item_header2_encdec(struct m0_rpc_item_header2 *ioh, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
Definition: onwire.c:50
#define ITEM_HEAD1_XCODE_OBJ(ptr)
Definition: onwire.c:38