23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_FORMATION 46 #define PACKHD_XCODE_OBJ(ptr) M0_XCODE_OBJ(m0_rpc_packet_onwire_header_xc, ptr) 47 #define PACKFT_XCODE_OBJ(ptr) M0_XCODE_OBJ(m0_rpc_packet_onwire_footer_xc, ptr) 60 if (packet_header_size == 0) {
65 return packet_header_size;
74 if (packet_footer_size == 0) {
79 return packet_footer_size;
94 _0C(
p->rp_ow.poh_version != 0) &&
97 _0C(
p->rp_ow.poh_nr_items ==
98 packet_item_tlist_length(&
p->rp_items)) &&
115 packet_item_tlist_init(&
p->rp_items);
116 p->rp_rmachine = rmach;
125 (
unsigned long long)
p->rp_ow.poh_nr_items);
128 packet_item_tlist_fini(&
p->rp_items);
153 packet_item_tlink_init_at_tail(
item, &
p->rp_items);
154 ++
p->rp_ow.poh_nr_items;
158 p, (
unsigned long long)
p->rp_ow.poh_nr_items,
159 (
unsigned long long)
p->rp_size);
174 packet_item_tlink_del_fini(
item);
176 --
p->rp_ow.poh_nr_items;
179 M0_LOG(
M0_DEBUG,
"p %p, nr_items: %llu->%llu packet size: %llu->%llu",
180 p, (
unsigned long long)
p->rp_ow.poh_nr_items + 1,
181 (
unsigned long long)
p->rp_ow.poh_nr_items,
183 (
unsigned long long)
p->rp_size);
211 return packet_item_tlist_contains(&
p->rp_items,
item);
218 return p->rp_ow.poh_nr_items == 0;
227 M0_ENTRY(
"packet: %p bufvec: %p",
p, bufvec);
296 .ioh_ha_epoch = epoch,
421 if (item_type ==
NULL)
467 return M0_RC(-EPROTO);
473 return M0_RC(-EPROTO);
487 }
else if (
rc != 0) {
533 (
unsigned int)
p->rp_ow.poh_nr_items);
536 visit(
p,
item, opaque_data);
544 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL int m0_xcode_encdec(struct m0_xcode_obj *obj, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
static struct m0_addb2_philter p
struct m0_ha_domain rh_hadom
M0_TL_DESCR_DEFINE(packet_item, "packet_item", M0_INTERNAL, struct m0_rpc_item, ri_plink, ri_magic, M0_RPC_ITEM_MAGIC, M0_RPC_PACKET_HEAD_MAGIC)
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
static int packet_footer_encdec(struct m0_rpc_packet_onwire_footer *pf, struct m0_bufvec_cursor *cursor, enum m0_xcode_what what)
const struct m0_rpc_item_type_ops * rit_ops
M0_INTERNAL int m0_rpc_packet_decode(struct m0_rpc_packet *p, struct m0_bufvec *bufvec, m0_bindex_t off, m0_bcount_t len)
void m0_rpc_item_put(struct m0_rpc_item *item)
#define M0_LOG(level,...)
static int item_encode(struct m0_rpc_item *item, struct m0_bufvec_cursor *cursor)
M0_INTERNAL const uint64_t M0_HA_EPOCH_NONE
M0_INTERNAL void m0_rpc_packet_traverse_items(struct m0_rpc_packet *p, item_visit_fn *visit, int opaque_data)
M0_INTERNAL int m0_rpc_item_header1_encdec(struct m0_rpc_item_header1 *ioh, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
void m0_rpc_item_get(struct m0_rpc_item *item)
M0_INTERNAL struct m0_rpc_item_type * m0_rpc_item_type_lookup(uint32_t opcode)
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
M0_INTERNAL const char * item_kind(const struct m0_rpc_item *item)
M0_INTERNAL void m0_rpc_packet_add_item(struct m0_rpc_packet *p, struct m0_rpc_item *item)
M0_ADDB2_ADD(M0_AVI_FS_CREATE, new_fid.f_container, new_fid.f_key, mode, rc)
static struct m0_rpc_item * item
M0_INTERNAL bool m0_rpc_packet_invariant(const struct m0_rpc_packet *p)
M0_INTERNAL int m0_xcode_length(struct m0_xcode_ctx *ctx)
#define PACKHD_XCODE_OBJ(ptr)
#define M0_ASSERT_EX(cond)
m0_bcount_t m0_rpc_item_size(struct m0_rpc_item *item)
M0_INTERNAL bool m0_bufvec_cursor_move(struct m0_bufvec_cursor *cur, m0_bcount_t count)
M0_INTERNAL void m0_rpc_packet_init(struct m0_rpc_packet *p, struct m0_rpc_machine *rmach)
M0_INTERNAL bool m0_rpc_machine_is_locked(const struct m0_rpc_machine *machine)
M0_INTERNAL void m0_rpc_packet_fini(struct m0_rpc_packet *p)
M0_INTERNAL int m0_rpc_packet_decode_using_cursor(struct m0_rpc_packet *p, struct m0_bufvec_cursor *cursor, m0_bcount_t len)
M0_INTERNAL void m0_ref_put(struct m0_ref *ref)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_rpc_machine_unlock(struct m0_rpc_machine *machine)
static int item_decode(struct m0_bufvec_cursor *cursor, struct m0_rpc_item **item_out)
M0_INTERNAL int m0_rpc_packet_encode_using_cursor(struct m0_rpc_packet *packet, struct m0_bufvec_cursor *cursor)
struct m0_rpc_item_header2 ri_header
int(* rito_decode)(const struct m0_rpc_item_type *item_type, struct m0_rpc_item **item, struct m0_bufvec_cursor *cur)
static const struct pfamily pf[]
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
const struct m0_rpc_item_type * ri_type
M0_INTERNAL int m0_rpc_packet_encode(struct m0_rpc_packet *p, struct m0_bufvec *bufvec)
void item_visit_fn(struct m0_rpc_packet *packet, struct m0_rpc_item *item, int data)
M0_INTERNAL int m0_rpc_item_footer_encdec(struct m0_rpc_item_footer *iof, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
M0_INTERNAL m0_bcount_t m0_vec_count(const struct m0_vec *vec)
static int packet_header_encdec(struct m0_rpc_packet_onwire_header *ph, struct m0_bufvec_cursor *cursor, enum m0_xcode_what what)
#define m0_forall(var, nr,...)
M0_INTERNAL bool m0_rpc_packet_is_carrying_item(const struct m0_rpc_packet *p, const struct m0_rpc_item *item)
struct m0_rpc_packet * ri_packet
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
M0_INTERNAL void m0_rpc_item_xid_min_update(struct m0_rpc_item *item)
#define M0_FI_ENABLED(tag)
M0_INTERNAL void m0_rpc_machine_lock(struct m0_rpc_machine *machine)
M0_INTERNAL bool m0_bufvec_cursor_align(struct m0_bufvec_cursor *cur, uint64_t alignment)
M0_TL_DEFINE(packet_item, M0_INTERNAL, struct m0_rpc_item)
M0_INTERNAL m0_bcount_t m0_rpc_packet_onwire_footer_size(void)
M0_INTERNAL void m0_rpc_packet_discard(struct m0_rpc_packet *packet)
static struct m0_fop * fop
M0_INTERNAL void m0_rpc_packet_remove_item(struct m0_rpc_packet *p, struct m0_rpc_item *item)
#define PACKFT_XCODE_OBJ(ptr)
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
M0_INTERNAL void m0_rpc_item_xid_assign(struct m0_rpc_item *item)
#define for_each_item_in_packet(item, packet)
M0_INTERNAL void m0_rpc_packet_remove_all_items(struct m0_rpc_packet *p)
M0_INTERNAL void m0_xcode_ctx_init(struct m0_xcode_ctx *ctx, const struct m0_xcode_obj *obj)
#define M0_IS_8ALIGNED(val)
struct m0_rpc_machine * ri_rmachine
M0_INTERNAL bool m0_rpc_packet_is_empty(const struct m0_rpc_packet *p)
M0_INTERNAL uint64_t m0_sm_id_get(const struct m0_sm *sm)
M0_INTERNAL m0_bcount_t m0_rpc_packet_onwire_header_size(void)
int(* rito_encode)(const struct m0_rpc_item_type *item_type, struct m0_rpc_item *item, struct m0_bufvec_cursor *cur)
#define end_for_each_item_in_packet