summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/legacy')
-rw-r--r--xlators/protocol/legacy/client/src/client-protocol.c67
-rw-r--r--xlators/protocol/legacy/server/src/server-protocol.c80
2 files changed, 11 insertions, 136 deletions
diff --git a/xlators/protocol/legacy/client/src/client-protocol.c b/xlators/protocol/legacy/client/src/client-protocol.c
index 0dc5bee5d56..e8d5d8f0139 100644
--- a/xlators/protocol/legacy/client/src/client-protocol.c
+++ b/xlators/protocol/legacy/client/src/client-protocol.c
@@ -5217,71 +5217,6 @@ client_getspec_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
return 0;
}
-int
-client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_checksum_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- ino_t ino = 0;
- uint64_t gen = 0;
-
- hdrlen = gf_hdr_len (req, strlen (loc->path) + 1);
- hdr = gf_hdr_new (req, strlen (loc->path) + 1);
- req = gf_param (hdr);
-
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CHECKSUM %"PRId64" (%s): "
- "failed to get remote inode number",
- loc->inode->ino, loc->path);
- STACK_UNWIND (frame, -1, EINVAL, NULL, NULL);
- return 0;
-
- }
-
- req->ino = hton64 (ino);
- req->gen = hton64 (gen);
- req->flag = hton32 (flag);
- strcpy (req->path, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_CHECKSUM,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
-}
-
-
-int
-client_checksum_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- gf_fop_checksum_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
- int32_t gf_errno = 0;
- unsigned char *fchecksum = NULL;
- unsigned char *dchecksum = NULL;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- gf_errno = ntoh32 (hdr->rsp.op_errno);
- op_errno = gf_error_to_errno (gf_errno);
-
- if (op_ret >= 0) {
- fchecksum = rsp->fchecksum;
- dchecksum = rsp->dchecksum + NAME_MAX;
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, fchecksum, dchecksum);
- return 0;
-}
-
int
client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
@@ -6023,7 +5958,6 @@ static gf_op_t gf_fops[] = {
[GF_PROTO_FOP_FINODELK] = client_finodelk_cbk,
[GF_PROTO_FOP_ENTRYLK] = client_entrylk_cbk,
[GF_PROTO_FOP_FENTRYLK] = client_fentrylk_cbk,
- [GF_PROTO_FOP_CHECKSUM] = client_checksum_cbk,
[GF_PROTO_FOP_RCHECKSUM] = client_rchecksum_cbk,
[GF_PROTO_FOP_XATTROP] = client_xattrop_cbk,
[GF_PROTO_FOP_FXATTROP] = client_fxattrop_cbk,
@@ -6687,7 +6621,6 @@ struct xlator_fops fops = {
.entrylk = client_entrylk,
.fentrylk = client_fentrylk,
.lookup = client_lookup,
- .checksum = client_checksum,
.rchecksum = client_rchecksum,
.xattrop = client_xattrop,
.fxattrop = client_fxattrop,
diff --git a/xlators/protocol/legacy/server/src/server-protocol.c b/xlators/protocol/legacy/server/src/server-protocol.c
index da0303019a3..a6d30ca4a2e 100644
--- a/xlators/protocol/legacy/server/src/server-protocol.c
+++ b/xlators/protocol/legacy/server/src/server-protocol.c
@@ -5193,84 +5193,26 @@ fail:
}
-static int
-server_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- uint8_t *fchecksum, uint8_t *dchecksum)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_checksum_rsp_t *rsp = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
-
- hdrlen = gf_hdr_len (rsp, NAME_MAX + 1 + NAME_MAX + 1);
- hdr = gf_hdr_new (rsp, NAME_MAX + 1 + NAME_MAX + 1);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret >= 0) {
- memcpy (rsp->fchecksum, fchecksum, NAME_MAX);
- rsp->fchecksum[NAME_MAX] = '\0';
- memcpy (rsp->dchecksum + NAME_MAX,
- dchecksum, NAME_MAX);
- rsp->dchecksum[NAME_MAX + NAME_MAX] = '\0';
- }
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_CHECKSUM,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-static int
-server_checksum_resume (call_frame_t *frame, xlator_t *bound_xl)
-{
- server_state_t *state = NULL;
- int op_ret = 0;
- int op_errno = 0;
-
- state = CALL_STATE (frame);
-
- if (state->resolve.op_ret != 0) {
- op_ret = state->resolve.op_ret;
- op_errno = state->resolve.op_errno;
- goto err;
- }
-
- STACK_WIND (frame, server_checksum_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->checksum,
- &state->loc, state->flags);
-
- return 0;
-err:
- server_checksum_cbk (frame, NULL, frame->this, state->resolve.op_ret,
- state->resolve.op_errno, NULL, NULL);
-
- return 0;
-}
static int
server_checksum (call_frame_t *frame, xlator_t *bound_xl,
gf_hdr_common_t *hdr, size_t hdrlen,
struct iobuf *iobuf)
{
- gf_fop_checksum_req_t *req = NULL;
- server_state_t *state = NULL;
+ gf_hdr_common_t *rsp_hdr = NULL;
+ gf_mop_ping_rsp_t *rsp = NULL; /* Using for NULL */
+ size_t rsp_hdrlen = 0;
+ int32_t gf_errno = 0;
- req = gf_param (hdr);
- state = CALL_STATE (frame);
+ rsp_hdrlen = gf_hdr_len (rsp, 0);
+ rsp_hdr = gf_hdr_new (rsp, 0);
- state->resolve.type = RESOLVE_MAY;
- state->resolve.path = gf_strdup (req->path);
- state->resolve.gen = ntoh64 (req->gen);
- state->resolve.ino = ntoh64 (req->ino);
- state->flags = ntoh32 (req->flag);
+ gf_errno = gf_errno_to_error (ENOSYS);
+ hdr->rsp.op_errno = hton32 (gf_errno);
+ hdr->rsp.op_ret = -1;
- gf_resolve_and_resume (frame, server_checksum_resume);
+ protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_CHECKSUM,
+ rsp_hdr, rsp_hdrlen, NULL, 0, NULL);
return 0;
}