con->in_hdr.type, con->in_hdr.front_len, con->in_hdr.data_len);
/* allocate message */
- con->in_msg = ceph_msg_new(0, front_len, 0, 0, NULL);
+ con->in_msg = con->msgr->alloc_msg(con->msgr->parent, &con->in_hdr);
if (IS_ERR(con->in_msg)) {
ret = PTR_ERR(con->in_msg);
con->in_msg = NULL;
typedef void (*ceph_msgr_peer_reset_t) (void *p, struct ceph_entity_addr *addr,
struct ceph_entity_name *pn);
+typedef struct ceph_msg * (*ceph_msgr_alloc_msg_t) (void *p,
+ struct ceph_msg_header *hdr);
+
static inline const char *ceph_name_type_str(int t)
{
switch (t) {
ceph_msgr_dispatch_t dispatch;
ceph_msgr_peer_reset_t peer_reset;
ceph_msgr_prepare_pages_t prepare_pages;
+ ceph_msgr_alloc_msg_t alloc_msg;
struct ceph_entity_inst inst; /* my name+address */
* types to appropriate handlers and subsystems.
*/
-void ceph_dispatch(void *p, struct ceph_msg *msg);
-void ceph_peer_reset(void *p, struct ceph_entity_addr *peer_addr,
- struct ceph_entity_name *peer_name);
+static void ceph_dispatch(void *p, struct ceph_msg *msg);
+static void ceph_peer_reset(void *p, struct ceph_entity_addr *peer_addr,
+ struct ceph_entity_name *peer_name);
+static struct ceph_msg *ceph_alloc_msg(void *p, struct ceph_msg_header *hdr);
/*
* find filename portion of a path (/foo/bar/baz -> baz)
client->msgr->dispatch = ceph_dispatch;
client->msgr->prepare_pages = ceph_osdc_prepare_pages;
client->msgr->peer_reset = ceph_peer_reset;
+ client->msgr->alloc_msg = ceph_alloc_msg;
}
/* send mount request, and wait for mon, mds, and osd maps */
}
+/*
+ * Allocate incoming message.
+ */
+static struct ceph_msg *ceph_alloc_msg(void *p, struct ceph_msg_header *hdr)
+{
+ int type = le32_to_cpu(hdr->type);
+ int front_len = le32_to_cpu(hdr->front_len);
+
+ return ceph_msg_new(type, front_len, 0, 0, NULL);
+}
+
/*
* Process an incoming message.
*