static int
glusterd_mgmt_v3_unlock_send_resp (rpcsvc_request_t *req, int32_t status)
{

        gd1_mgmt_v3_unlock_rsp          rsp   = {{0},};
        int                             ret   = -1;
        xlator_t                       *this  = NULL;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);

        rsp.op_ret = status;
        if (rsp.op_ret)
                rsp.op_errno = errno;

        glusterd_get_uuid (&rsp.uuid);

        ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
                                     (xdrproc_t)xdr_gd1_mgmt_v3_unlock_rsp);

        gf_log (this->name, GF_LOG_DEBUG,
                "Responded to mgmt_v3 unlock, ret: %d", ret);

        return ret;
}
示例#2
0
static int
glusterd_mgmt_v3_post_validate_send_resp (rpcsvc_request_t   *req,
                                         int32_t op, int32_t status,
                                         char *op_errstr, dict_t *rsp_dict)
{
        gd1_mgmt_v3_post_val_rsp         rsp      = {{0},};
        int                             ret      = -1;
        xlator_t                       *this     = NULL;

        this = THIS;
        GF_ASSERT (this);
        GF_ASSERT (req);

        rsp.op_ret = status;
        glusterd_get_uuid (&rsp.uuid);
        rsp.op = op;
        if (op_errstr)
                rsp.op_errstr = op_errstr;
        else
                rsp.op_errstr = "";

        ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val,
                                           &rsp.dict.dict_len);
        if (ret < 0) {
                gf_msg (this->name, GF_LOG_ERROR, 0,
                        GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
                        "failed to get serialized length of dict");
                goto out;
        }

        ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
                                     (xdrproc_t)xdr_gd1_mgmt_v3_post_val_rsp);

        GF_FREE (rsp.dict.dict_val);
out:
        gf_msg_debug (this->name, 0,
                "Responded to post validation, ret: %d", ret);
        return ret;
}