Motr
M0
|
Data Structures | |
struct | m0_fop_data |
struct | m0_fop |
struct | m0_fop_type |
struct | m0_fop_type_ops |
struct | __m0_fop_type_init_args |
struct | m0_fop_type_batch |
struct | m0_fop_fol_frag |
Macros | |
#define | M0_FOP_DEFAULT_ITEM_TYPE_OPS |
#define | M0_FOP_TYPE_INIT(ft, ...) |
#define | M0_FOP_TYPE_INIT2_DECL struct __m0_fop_type_init_args __args |
#define | M0_FOP_TYPE_INIT2(ft, ...) |
#define | M0_FOP_XCODE_OBJ(f) |
Typedefs | |
typedef uint32_t | m0_fop_type_code_t |
Enumerations | |
enum | m0_addb2_fop_counter { M0_AFC_PHASE, M0_AFC_STATE, M0_AFC_RPC_OUT, M0_AFC_RPC_IN } |
Variables | |
static struct m0_mutex | fop_types_lock |
static struct m0_tl | fop_types_list |
M0_EXTERN struct m0_sm_conf | fom_states_conf |
const struct m0_rpc_item_type_ops | m0_fop_default_item_type_ops |
struct m0_fol_frag_type | m0_fop_fol_frag_type |
File Operation Packet (fop, struct m0_fop) is a description of particular file system or storage operation. fop code knows how to serialise a fop to the network wire or storage buffer, and how to de-serialise it back, which makes it functionally similar to ONCRPC XDR.
A fop consists of fields. The structure and arrangement of a fop fields is described by a fop type (m0_fop_type), that also has a pointer to a set of operations that are used to manipulate the fop.
The execution of an operation described by fop is carried out by a "fop machine" (fom, struct m0_fom).
This file contains definitions for encoding/decoding a fop type rpc item onto a bufvec.
#define M0_FOP_DEFAULT_ITEM_TYPE_OPS |
#define M0_FOP_TYPE_INIT | ( | ft, | |
... | |||
) |
#define M0_FOP_TYPE_INIT2 | ( | ft, | |
... | |||
) |
#define M0_FOP_TYPE_INIT2_DECL struct __m0_fop_type_init_args __args |
This variant of M0_FOP_TYPE_INIT() re-uses the same __args object in each M0_FOP_TYPE_INIT2() call instead of creating the new one on stack bloating its size (which may not overstep the 1K limit in kernel).
#define M0_FOP_XCODE_OBJ | ( | f | ) |
typedef uint32_t m0_fop_type_code_t |
enum m0_addb2_fop_counter |
|
static |
|
static |
M0_FOL_FRAG_TYPE_DECLARE | ( | m0_fop_fol_frag | , |
NULL | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
struct m0_fop * m0_fop_alloc | ( | struct m0_fop_type * | fopt, |
void * | data, | ||
struct m0_rpc_machine * | mach | ||
) |
Allocates and initialises fop object
fopt | fop type to assign to this fop object |
data | top level data object if data == NULL, data is allocated by this function |
mach | rpc machine needed to release the fop |
Definition at line 96 of file fop.c.
struct m0_fop * m0_fop_alloc_at | ( | struct m0_rpc_session * | sess, |
struct m0_fop_type * | fopt | ||
) |
void * m0_fop_data | ( | const struct m0_fop * | fop | ) |
M0_INTERNAL int m0_fop_data_alloc | ( | struct m0_fop * | fop | ) |
struct m0_net_domain * m0_fop_domain_get | ( | const struct m0_fop * | fop | ) |
M0_INTERNAL int m0_fop_encdec | ( | struct m0_fop * | fop, |
struct m0_bufvec_cursor * | cur, | ||
enum m0_xcode_what | what | ||
) |
M0_INTERNAL void m0_fop_fini | ( | struct m0_fop * | fop | ) |
Finalises fop.
Very likely you want to use m0_fop_put().
Use this only when you're sure that there are no other references on the fop other than the one you're holding. e.g. the fop is embedded in some other object and because of some error there is a need to finalise fop even before it is posted to RPC.
Definition at line 136 of file fop.c.
Adds fol record fragment for this fop (m0_fop_fol_frag) to the transaction.
Definition at line 427 of file fop.c.
M0_INTERNAL void m0_fop_init | ( | struct m0_fop * | fop, |
struct m0_fop_type * | fopt, | ||
void * | data, | ||
void(*)(struct m0_ref *) | fop_release | ||
) |
Initialises fop.
'data' argument if non-null specifies address of top level data object. 'fop_release' is a pointer to function that will be called when last reference on the fop is dropped. fop_release is expected to finalise and free the fop.
m0_fop_init sets fop reference count to 1. The caller is expected to drop the reference using m0_fop_put().
Definition at line 79 of file fop.c.
M0_INTERNAL int m0_fop_item_encdec | ( | struct m0_rpc_item * | item, |
struct m0_bufvec_cursor * | cur, | ||
enum m0_xcode_what | what | ||
) |
Helper function used by encode/decode ops of each item type (rito_encode, rito_decode) for decoding an rpc item into/from a bufvec
Definition at line 95 of file fop_item_type.c.
void m0_fop_item_get | ( | struct m0_rpc_item * | item | ) |
void m0_fop_item_put | ( | struct m0_rpc_item * | item | ) |
M0_INTERNAL int m0_fop_item_type_default_decode | ( | const struct m0_rpc_item_type * | item_type, |
struct m0_rpc_item ** | item_out, | ||
struct m0_bufvec_cursor * | cur | ||
) |
Generic deserialization routine for a fop rpc item type. Allocates a new rpc item and decodes the header and the payload into this item.
item_type | Pointer to the item type struct for the item. |
item | Pointer to the item containing deserialized rpc onwire data and payload. |
cur | current position of the cursor in the bufvec. |
0 | On success. |
-errno | if failure. |
Definition at line 58 of file fop_item_type.c.
M0_INTERNAL int m0_fop_item_type_default_encode | ( | const struct m0_rpc_item_type * | item_type, |
struct m0_rpc_item * | item, | ||
struct m0_bufvec_cursor * | cur | ||
) |
Generic bufvec serialization routine for a fop rpc item type.
item_type | Pointer to the item type struct for the item. |
item | pointer to the item which is to be serialized. |
cur | current position of the cursor in the bufvec. |
0 | On success. |
-errno | On failure. |
Definition at line 47 of file fop_item_type.c.
M0_INTERNAL const char * m0_fop_name | ( | const struct m0_fop * | fop | ) |
uint32_t m0_fop_opcode | ( | const struct m0_fop * | fop | ) |
M0_INTERNAL m0_bcount_t m0_fop_payload_size | ( | const struct m0_rpc_item * | item | ) |
Return the onwire size of the item type which is a fop in bytes. The onwire size of an item equals = size of (header + payload).
item | The rpc item for which the on wire size is to be calculated |
Size | of the item in bytes. |
Definition at line 32 of file fop_item_type.c.
void m0_fop_put | ( | struct m0_fop * | fop | ) |
Drops reference on the fop. If it was last reference the fop will be finalised and freed. Do not touch fop after call the this function.
Definition at line 177 of file fop.c.
void m0_fop_put0 | ( | struct m0_fop * | fop | ) |
void m0_fop_put0_lock | ( | struct m0_fop * | fop | ) |
void m0_fop_put_lock | ( | struct m0_fop * | fop | ) |
Same as m0_fop_put() but also locks/unlocks rpc machine.
Definition at line 199 of file fop.c.
M0_INTERNAL void m0_fop_release | ( | struct m0_ref * | ref | ) |
Default implementation of fop_release that can be passed to m0_fop_init() when fop is not embedded in any other object.
Definition at line 148 of file fop.c.
M0_INTERNAL int m0_fop_rep_xc_type | ( | const struct m0_xcode_obj * | par, |
const struct m0_xcode_type ** | out | ||
) |
struct m0_fop * m0_fop_reply_alloc | ( | struct m0_fop * | req, |
struct m0_fop_type * | rept | ||
) |
M0_INTERNAL bool m0_fop_rpc_is_locked | ( | struct m0_fop * | fop | ) |
struct m0_rpc_machine * m0_fop_rpc_machine | ( | const struct m0_fop * | fop | ) |
void m0_fop_rpc_machine_set | ( | struct m0_fop * | fop, |
struct m0_rpc_machine * | mach | ||
) |
struct m0_rpc_machine * m0_fop_session_machine | ( | const struct m0_rpc_session * | s | ) |
struct m0_net_transfer_mc * m0_fop_tm_get | ( | const struct m0_fop * | fop | ) |
struct m0_rpc_item * m0_fop_to_rpc_item | ( | const struct m0_fop * | fop | ) |
void m0_fop_type_addb2_deinstrument | ( | struct m0_fop_type * | type | ) |
int m0_fop_type_addb2_instrument | ( | struct m0_fop_type * | type | ) |
M0_INTERNAL struct m0_fop_type * m0_fop_type_find | ( | uint32_t | opcode | ) |
Finds the fop type corresponding to the opcode.
opcode | FOP opcode. |
Definition at line 388 of file fop.c.
void m0_fop_type_fini | ( | struct m0_fop_type * | fopt | ) |
M0_INTERNAL void m0_fop_type_fini_nr | ( | const struct m0_fop_type_batch * | batch | ) |
void m0_fop_type_init | ( | struct m0_fop_type * | ft, |
const struct __m0_fop_type_init_args * | args | ||
) |
M0_INTERNAL void m0_fop_type_init_nr | ( | const struct m0_fop_type_batch * | batch | ) |
M0_INTERNAL struct m0_fop_type * m0_fop_type_next | ( | struct m0_fop_type * | ftype | ) |
Iterates through the registered fop types.
To iterate across all registered fop types, first call this function with NULL parameter. NULL is returned to indicate end of the iteration.
If a fop type is registered or unregistered while an iteration is in progress, behaviour is undefined.
Definition at line 296 of file fop.c.
M0_INTERNAL int m0_fop_xc_type | ( | const struct m0_xcode_obj * | par, |
const struct m0_xcode_type ** | out | ||
) |
M0_INTERNAL void m0_fops_fini | ( | void | ) |
M0_INTERNAL int m0_fops_init | ( | void | ) |
M0_INTERNAL struct m0_fop_type * m0_item_type_to_fop_type | ( | const struct m0_rpc_item_type * | rit | ) |
struct m0_fop * m0_rpc_item_to_fop | ( | const struct m0_rpc_item * | item | ) |
M0_TL_DEFINE | ( | ft | , |
static | , | ||
struct m0_fop_type | |||
) |
M0_TL_DESCR_DEFINE | ( | ft | , |
"fop types" | , | ||
static | , | ||
struct m0_fop_type | , | ||
ft_linkage | , | ||
ft_magix | , | ||
M0_FOP_TYPE_MAGIC | , | ||
M0_FOP_TYPE_HEAD_MAGIC | |||
) |
M0_EXTERN struct m0_sm_conf fom_states_conf |
const struct m0_rpc_item_type_ops m0_fop_default_item_type_ops |
Default rpc item type ops for fop item types
Definition at line 118 of file fop_item_type.c.
struct m0_fol_frag_type m0_fop_fol_frag_type |