Motr  M0
fom_simple.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_FOP_FOM_SIMPLE_H__
26 #define __MOTR_FOP_FOM_SIMPLE_H__
27 
40 #include "fop/fom.h"
41 
120  struct m0_fom si_fom;
121  int (*si_tick)(struct m0_fom *fom, void *data, int *phase);
123  void *si_data;
125  size_t si_locality;
129  void (*si_free)(struct m0_fom_simple *sfom);
130 };
131 
132 enum {
137  M0_FOM_SIMPLE_HERE = 0xbedabedabedabeda
138 };
139 
143 M0_INTERNAL void m0_fom_simple_post(struct m0_fom_simple *simpleton,
144  struct m0_reqh *reqh,
145  struct m0_sm_conf *conf,
146  int (*tick)(struct m0_fom *, void *, int *),
147  void (*free)(struct m0_fom_simple *sfom),
148  void *data, size_t locality);
154 M0_INTERNAL void m0_fom_simple_hoard(struct m0_fom_simple *cat, size_t nr,
155  struct m0_reqh *reqh,
156  struct m0_sm_conf *conf,
157  int (*tick)(struct m0_fom *, void *,
158  int *),
159  void (*free)(struct m0_fom_simple *sfom),
160  void *data);
161 
165 #define M0_FOM_SIMPLE_POST(s, r, c, t, f, d, l) \
166 ({ \
167  /* check that "t" and "d" match. */ \
168  (void)(sizeof((t)(NULL, (d), 0))); \
169  m0_fom_simple_post((s), (r), (c), \
170  (int (*)(struct m0_fom *, void *, int *))(t),\
171  (void (*)(struct m0_fom_simple *))(f), \
172  (void *)(d), (l)); \
173 })
174 
175 M0_INTERNAL int m0_fom_simples_init(void);
176 M0_INTERNAL void m0_fom_simples_fini(void);
177 
180 #endif /* __MOTR_FOP_FOM_SIMPLE_H__ */
181 
182 /*
183  * Local variables:
184  * c-indentation-style: "K&R"
185  * c-basic-offset: 8
186  * tab-width: 8
187  * fill-column: 80
188  * scroll-step: 1
189  * End:
190  */
191 /*
192  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
193  */
static size_t nr
Definition: dump.c:1505
static void tick(struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
Definition: locality.c:326
static size_t locality(const struct m0_fom *fom)
Definition: rm_foms.c:269
Definition: sm.h:350
struct m0_bufvec data
Definition: di.c:40
Definition: conf.py:1
M0_INTERNAL void m0_fom_simples_fini(void)
Definition: fom_simple.c:100
M0_INTERNAL void m0_fom_simple_post(struct m0_fom_simple *simpleton, struct m0_reqh *reqh, struct m0_sm_conf *conf, int(*tick)(struct m0_fom *, void *, int *), void(*free)(struct m0_fom_simple *sfom), void *data, size_t locality)
Definition: fom_simple.c:49
size_t si_locality
Definition: fom_simple.h:125
int(* si_tick)(struct m0_fom *fom, void *data, int *phase)
Definition: fom_simple.h:121
void(* si_free)(struct m0_fom_simple *sfom)
Definition: fom_simple.h:129
void * si_data
Definition: fom_simple.h:123
Definition: reqh.h:94
Definition: dump.c:103
M0_INTERNAL void m0_fom_simple_hoard(struct m0_fom_simple *cat, size_t nr, struct m0_reqh *reqh, struct m0_sm_conf *conf, int(*tick)(struct m0_fom *, void *, int *), void(*free)(struct m0_fom_simple *sfom), void *data)
Definition: fom_simple.c:81
struct m0_fom_type si_type
Definition: fom_simple.h:127
struct m0_fom si_fom
Definition: fom_simple.h:120
Definition: fom.h:481
struct m0_reqh reqh
Definition: rm_foms.c:48
M0_INTERNAL int m0_fom_simples_init(void)
Definition: fom_simple.c:95