Skip to content

Commit

Permalink
HG: associate handle to HG proc
Browse files Browse the repository at this point in the history
hg_proc_get_handle() can be used to retrieve handle from proc
  • Loading branch information
soumagne committed Jul 1, 2024
1 parent ac0a290 commit db0b160
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mercury.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ hg_handle_create(struct hg_private_class *hg_class)
/* CRC32 is enough for small size buffers */
ret = hg_proc_create((hg_class_t *) hg_class, hash, &hg_handle->in_proc);
HG_CHECK_SUBSYS_HG_ERROR(rpc, error, ret, "Cannot create HG proc");
hg_proc_set_handle(hg_handle->in_proc, &hg_handle->handle);

ret = hg_proc_create((hg_class_t *) hg_class, hash, &hg_handle->out_proc);
HG_CHECK_SUBSYS_HG_ERROR(rpc, error, ret, "Cannot create HG proc");
hg_proc_set_handle(hg_handle->out_proc, &hg_handle->handle);

return hg_handle;

Expand Down
35 changes: 35 additions & 0 deletions src/mercury_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ hg_proc_reset(hg_proc_t proc, void *buf, hg_size_t buf_size, hg_proc_op_t op);
static HG_INLINE hg_class_t *
hg_proc_get_class(hg_proc_t proc);

/**
* Associate an HG handle with the processor.
*
* \param proc [IN] abstract processor object
* \param handle [IN] HG handle
*
*/
static HG_INLINE void
hg_proc_set_handle(hg_proc_t proc, hg_handle_t handle);

/**
* Get the HG handle associated to the processor.
*
* \param proc [IN] abstract processor object
*
* \return HG handle
*/
static HG_INLINE hg_handle_t
hg_proc_get_handle(hg_proc_t proc);

/**
* Get the operation type associated to the processor.
*
Expand Down Expand Up @@ -588,6 +608,7 @@ struct hg_proc {
struct hg_proc_buf proc_buf;
struct hg_proc_buf extra_buf;
hg_class_t *hg_class; /* HG class */
hg_handle_t handle; /* HG handle */
struct hg_proc_buf *current_buf;
#ifdef HG_HAS_CHECKSUMS
struct mchecksum_object *checksum; /* Checksum */
Expand All @@ -605,6 +626,20 @@ hg_proc_get_class(hg_proc_t proc)
return ((struct hg_proc *) proc)->hg_class;
}

/*---------------------------------------------------------------------------*/
static HG_INLINE void
hg_proc_set_handle(hg_proc_t proc, hg_handle_t handle)
{
((struct hg_proc *) proc)->handle = handle;
}

/*---------------------------------------------------------------------------*/
static HG_INLINE hg_handle_t
hg_proc_get_handle(hg_proc_t proc)
{
return ((struct hg_proc *) proc)->handle;
}

/*---------------------------------------------------------------------------*/
static HG_INLINE hg_proc_op_t
hg_proc_get_op(hg_proc_t proc)
Expand Down

0 comments on commit db0b160

Please sign in to comment.