Motr  M0
source_dock.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-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_FDMI_FDMI_SOURCE_DOCK_H__
26 #define __MOTR_FDMI_FDMI_SOURCE_DOCK_H__
27 
28 #include "lib/buf.h"
29 #include "lib/tlist.h"
30 #include "lib/mutex.h"
31 #include "fop/fom.h"
32 #include "fdmi/fdmi.h"
33 #include "fdmi/filter.h"
34 #include "fdmi/src_rec.h"
35 
36 /* This file describes FDMI source dock public API */
37 
47 struct m0_fdmi_src {
50 
51  /* Data owned and populated by source dock. */
52 
54  void (*fs_record_post)(struct m0_fdmi_src_rec *src_rec);
55 
56  /* Data owned and populated by source. */
57 
62  int (*fs_node_eval)(struct m0_fdmi_src_rec *src_rec,
63  struct m0_fdmi_flt_var_node *value_desc,
64  struct m0_fdmi_flt_operand *value);
66  void (*fs_get)(struct m0_fdmi_src_rec *src_rec);
68  void (*fs_put)(struct m0_fdmi_src_rec *src_rec);
70  void (*fs_begin)(struct m0_fdmi_src_rec *src_rec);
72  void (*fs_end)(struct m0_fdmi_src_rec *src_rec);
73 
82  int (*fs_encode)(struct m0_fdmi_src_rec *src_rec, struct m0_buf *buf);
83 
92  int (*fs_decode)(struct m0_buf *buf, void **handle);
93 
94 };
95 
98 M0_INTERNAL int m0_fdmi_source_alloc(enum m0_fdmi_rec_type_id type_id,
99  struct m0_fdmi_src **source);
100 
103 M0_INTERNAL void m0_fdmi_source_free(struct m0_fdmi_src *source);
104 
111 M0_INTERNAL int m0_fdmi_source_register(struct m0_fdmi_src *src);
112 
128 M0_INTERNAL void m0_fdmi_source_deregister(struct m0_fdmi_src *src);
129 
130 
132 M0_INTERNAL void
134 
136 M0_INTERNAL void
138 
148 #define M0_FDMI_SOURCE_POST_RECORD(_src_rec_ptr) \
149  ((_src_rec_ptr)->fsr_src)->fs_record_post(_src_rec_ptr)
150 
153 #endif /* __MOTR_FDMI_FDMI_SOURCE_DOCK_H__ */
154 
155 /*
156  * Local variables:
157  * c-indentation-style: "K&R"
158  * c-basic-offset: 8
159  * tab-width: 8
160  * fill-column: 80
161  * scroll-step: 1
162  * End:
163  */
164 /*
165  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
166  */
void(* fs_get)(struct m0_fdmi_src_rec *src_rec)
Definition: source_dock.h:66
int(* fs_node_eval)(struct m0_fdmi_src_rec *src_rec, struct m0_fdmi_flt_var_node *value_desc, struct m0_fdmi_flt_operand *value)
Definition: source_dock.h:62
int const char const void * value
Definition: dir.c:325
M0_INTERNAL void m0_fdmi_source_free(struct m0_fdmi_src *source)
Definition: source_dock.c:301
static int void * buf
Definition: dir.c:1019
void(* fs_put)(struct m0_fdmi_src_rec *src_rec)
Definition: source_dock.h:68
int(* fs_decode)(struct m0_buf *buf, void **handle)
Definition: source_dock.h:92
Definition: buf.h:37
int(* fs_encode)(struct m0_fdmi_src_rec *src_rec, struct m0_buf *buf)
Definition: source_dock.h:82
M0_INTERNAL int m0_fdmi_source_alloc(enum m0_fdmi_rec_type_id type_id, struct m0_fdmi_src **source)
Definition: source_dock.c:285
M0_INTERNAL void m0_fdmi_source_deregister(struct m0_fdmi_src *src)
Definition: source_dock.c:337
M0_INTERNAL int m0_fdmi_source_register(struct m0_fdmi_src *src)
Definition: source_dock.c:311
m0_fdmi_rec_type_id
Definition: fdmi.h:234
enum m0_fdmi_rec_type_id fs_type_id
Definition: source_dock.h:49
M0_INTERNAL void m0_fdmi_source_dock_fini(struct m0_fdmi_src_dock *src_dock)
Definition: source_dock.c:97
void(* fs_begin)(struct m0_fdmi_src_rec *src_rec)
Definition: source_dock.h:70
void(* fs_record_post)(struct m0_fdmi_src_rec *src_rec)
Definition: source_dock.h:54
void(* fs_end)(struct m0_fdmi_src_rec *src_rec)
Definition: source_dock.h:72
Definition: net.c:93
struct m0_pdclust_src_addr src
Definition: fd.c:108
M0_INTERNAL void m0_fdmi_source_dock_init(struct m0_fdmi_src_dock *src_dock)
Definition: source_dock.c:85