Motr
M0
|
#include <fom_simple.h>
Data Fields | |
struct m0_fom | si_fom |
int(* | si_tick )(struct m0_fom *fom, void *data, int *phase) |
void * | si_data |
size_t | si_locality |
struct m0_fom_type | si_type |
void(* | si_free )(struct m0_fom_simple *sfom) |
Simple fom executes m0_fom_simple::si_tick() in each tick.
Simplest m0_fom_simple::si_tick() is created by calling m0_fom_simple_post() with NULL "conf" parameter. Such call initialises a fom with the following trivial state machine:
* +-----+ * | | * V | * INIT---+ * | * | * V * FINISH *
The useful work is done by m0_fom_simple::si_tick() function (initialised to the "tick" argument of m0_fom_simple_post()) in INIT state. To terminate the fom, m0_fom_simple::si_tick() should return a negative value.
Typical m0_fom_simple::si_tick() function in such case would look like:
That is, m0_fom_simple::si_tick() is very similar to m0_fom_ops::fo_tick(), except that it gets an additional "data" parameter, originally passed by the user to m0_fom_simple_post() and uses some fom-specific "subphase" instead of fom phase.
Passing a non-NULL conf to m0_fom_simple_post() creates a "semisimple" fom with the user-supplied configuration. Such fom can use usual fom phases to keep track of it current state. For a semisimple fom, current phase is passed in "phase" parameter to m0_fom_simple::si_tick().
A typical semisimple m0_fom_simple::si_tick() looks like:
Note that the type of the second parameter can be different from void *, see M0_FOM_SIMPLE_POST().
Definition at line 119 of file fom_simple.h.
void* si_data |
User provided data, passed to ->si_tick().
Definition at line 123 of file fom_simple.h.
struct m0_fom si_fom |
Definition at line 120 of file fom_simple.h.
void(* si_free) (struct m0_fom_simple *sfom) |
Cleanup function pointer called by fom_simple_fini()
Definition at line 129 of file fom_simple.h.
size_t si_locality |
User supplied locality.
Definition at line 125 of file fom_simple.h.
Definition at line 121 of file fom_simple.h.
struct m0_fom_type si_type |
Embedded fom type for "semisimple" fom.
Definition at line 127 of file fom_simple.h.