diff options
Diffstat (limited to 'xlators')
23 files changed, 11 insertions, 990 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 4ae128bbb55..5f73944206b 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -376,13 +376,6 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this) GF_FREE (local->cont.lk.locked_nodes); } - { /* checksum */ - if (local->cont.checksum.file_checksum) - GF_FREE (local->cont.checksum.file_checksum); - if (local->cont.checksum.dir_checksum) - GF_FREE (local->cont.checksum.dir_checksum); - } - { /* create */ if (local->cont.create.fd) fd_unref (local->cont.create.fd); @@ -2167,104 +2160,6 @@ out: return 0; } - -int32_t -afr_checksum_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno, - uint8_t *file_checksum, uint8_t *dir_checksum) - -{ - afr_local_t *local = NULL; - - int call_count = -1; - - local = frame->local; - - LOCK (&frame->lock); - { - if (op_ret == 0 && (local->op_ret != 0)) { - local->op_ret = 0; - - local->cont.checksum.file_checksum = - GF_MALLOC (NAME_MAX, gf_afr_mt_char); - memcpy (local->cont.checksum.file_checksum, file_checksum, - NAME_MAX); - - local->cont.checksum.dir_checksum = - GF_MALLOC (NAME_MAX, gf_afr_mt_char); - memcpy (local->cont.checksum.dir_checksum, dir_checksum, - NAME_MAX); - - } - - local->op_errno = op_errno; - } - UNLOCK (&frame->lock); - - call_count = afr_frame_return (frame); - - if (call_count == 0) - AFR_STACK_UNWIND (checksum, frame, local->op_ret, local->op_errno, - local->cont.checksum.file_checksum, - local->cont.checksum.dir_checksum); - - return 0; -} - - -int32_t -afr_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flag) -{ - afr_private_t *priv = NULL; - afr_local_t *local = NULL; - - int ret = -1; - - int i = 0; - int32_t call_count = 0; - int32_t op_ret = -1; - int32_t op_errno = 0; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (this->private, out); - - priv = this->private; - - ALLOC_OR_GOTO (local, afr_local_t, out); - - ret = AFR_LOCAL_INIT (local, priv); - if (ret < 0) { - op_errno = -ret; - goto out; - } - - call_count = local->call_count; - frame->local = local; - - for (i = 0; i < priv->child_count; i++) { - if (local->child_up[i]) { - STACK_WIND (frame, afr_checksum_cbk, - priv->children[i], - priv->children[i]->fops->checksum, - loc, flag); - - if (!--call_count) - break; - } - } - - op_ret = 0; -out: - if (op_ret == -1) { - AFR_STACK_UNWIND (checksum, frame, op_ret, op_errno, - NULL, NULL); - } - return 0; -} - - int32_t afr_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @@ -3054,7 +2949,6 @@ struct xlator_fops fops = { .finodelk = afr_finodelk, .entrylk = afr_entrylk, .fentrylk = afr_fentrylk, - .checksum = afr_checksum, /* inode read */ .access = afr_access, diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 4580bcda278..125f5c2a2f4 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -273,11 +273,6 @@ typedef struct _afr_local { unsigned char *locked_nodes; } lk; - struct { - uint8_t *file_checksum; - uint8_t *dir_checksum; - } checksum; - /* inode read */ struct { diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 0fc5d45a317..8a8a89c8823 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -406,11 +406,6 @@ struct xlator_fops fops = { .fxattrop = dht_fxattrop, .setattr = dht_setattr, .fsetattr = dht_fsetattr, -#if 0 - .setdents = dht_setdents, - .getdents = dht_getdents, - .checksum = dht_checksum, -#endif }; struct xlator_dumpops dumpops = { diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 8d181fa507a..015f8e77b1e 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -721,11 +721,6 @@ struct xlator_fops fops = { .xattrop = dht_xattrop, .fxattrop = dht_fxattrop, .setattr = dht_setattr, -#if 0 - .setdents = dht_setdents, - .getdents = dht_getdents, - .checksum = dht_checksum, -#endif }; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index 22289b3a1bf..7c52767f4a9 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -1032,11 +1032,6 @@ struct xlator_fops fops = { .xattrop = dht_xattrop, .fxattrop = dht_fxattrop, .setattr = dht_setattr, -#if 0 - .setdents = dht_setdents, - .getdents = dht_getdents, - .checksum = dht_checksum, -#endif }; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 5d5b1e82d48..bfd5797b554 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -141,9 +141,6 @@ sys_error_t error_no_list[] = { [GF_FOP_LK] = { .error_no_count = 4, .error_no = {EACCES,EFAULT,ENOENT, EINTR}}, - [GF_FOP_CHECKSUM] = { .error_no_count = 4, - .error_no = {EACCES,EBADF, - ENAMETOOLONG,EINTR}}, [GF_FOP_XATTROP] = { .error_no_count = 5, .error_no = {EACCES,EFAULT, ENAMETOOLONG,ENOSYS, @@ -305,8 +302,6 @@ get_fop_int (char **op_no_str) return GF_FOP_FSTAT; else if (!strcmp ((*op_no_str), "lk")) return GF_FOP_LK; - else if (!strcmp ((*op_no_str), "checksum")) - return GF_FOP_CHECKSUM; else if (!strcmp ((*op_no_str), "xattrop")) return GF_FOP_XATTROP; else if (!strcmp ((*op_no_str), "fxattrop")) @@ -1764,45 +1759,6 @@ error_gen_getspec (call_frame_t *frame, xlator_t *this, const char *key, int -error_gen_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - uint8_t *file_checksum, uint8_t *dir_checksum) -{ - STACK_UNWIND (frame, op_ret, op_errno, - file_checksum, dir_checksum); - return 0; -} - - -int -error_gen_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flag) -{ - int op_errno = 0; - eg_t *egp = NULL; - int enable = 1; - - egp = this->private; - enable = egp->enable[GF_FOP_CHECKSUM]; - - if (enable) - op_errno = error_gen (this, GF_FOP_CHECKSUM); - - if (op_errno) { - GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); - STACK_UNWIND (frame, -1, op_errno, NULL, NULL); - return 0; - } - - STACK_WIND (frame, error_gen_checksum_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, - loc, flag); - return 0; -} - - -int error_gen_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) { @@ -2036,7 +1992,6 @@ struct xlator_fops fops = { .fstat = error_gen_fstat, .lk = error_gen_lk, .lookup_cbk = error_gen_lookup_cbk, - .checksum = error_gen_checksum, .xattrop = error_gen_xattrop, .fxattrop = error_gen_fxattrop, .inodelk = error_gen_inodelk, diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index ee9c29e69a0..ae01e455726 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1328,32 +1328,6 @@ io_stats_lk (call_frame_t *frame, xlator_t *this, int -io_stats_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) -{ - STACK_UNWIND_STRICT (checksum, frame, op_ret, op_errno, - fchecksum, dchecksum); - - return 0; -} - - -int -io_stats_checksum (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flag) -{ - STACK_WIND (frame, io_stats_checksum_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, - loc, flag); - - return 0; -} - - - -int io_stats_release (xlator_t *this, fd_t *fd) { struct ios_fd *iosfd = NULL; @@ -1518,7 +1492,6 @@ struct xlator_fops fops = { .finodelk = io_stats_finodelk, .entrylk = io_stats_entrylk, .lookup = io_stats_lookup, - .checksum = io_stats_checksum, .xattrop = io_stats_xattrop, .fxattrop = io_stats_fxattrop, .setattr = io_stats_setattr, diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 31a1489b5d0..b9372c244c4 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -1902,37 +1902,6 @@ trace_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, } -int -trace_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_log (this->name, GF_LOG_NORMAL, - "%"PRId64": op_ret (%d), op_errno(%d)", - frame->root->unique, op_ret, op_errno); - - STACK_UNWIND_STRICT (checksum, frame, op_ret, op_errno, - fchecksum, dchecksum); - - return 0; -} - - -int -trace_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) -{ - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": loc->path (%s) flag (%d)", - frame->root->unique, loc->path, flag); - - STACK_WIND (frame, trace_checksum_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, - loc, flag); - - return 0; -} - void enable_all_calls (int enabled) @@ -2089,7 +2058,6 @@ struct xlator_fops fops = { .finodelk = trace_finodelk, .entrylk = trace_entrylk, .lookup = trace_lookup, - .checksum = trace_checksum, .xattrop = trace_xattrop, .fxattrop = trace_fxattrop, .setattr = trace_setattr, diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 7f265d1dd26..0aef6623f0d 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -1269,58 +1269,6 @@ out: } -int -iot_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, uint8_t *file_checksum, - uint8_t *dir_checksum) -{ - STACK_UNWIND_STRICT (checksum, frame, op_ret, op_errno, file_checksum, - dir_checksum); - return 0; -} - - -int -iot_checksum_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags) -{ - STACK_WIND (frame, iot_checksum_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, - loc, flags); - - return 0; -} - - -int -iot_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags) -{ - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_checksum_stub (frame, iot_checksum_wrapper, loc, flags); - - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_checksum call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - ret = iot_schedule_unordered ((iot_conf_t *)this->private, loc->inode, - stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (checksum, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - int iot_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -2231,7 +2179,6 @@ struct xlator_fops fops = { .fstat = iot_fstat, /* O */ .truncate = iot_truncate, /* V */ .ftruncate = iot_ftruncate, /* O */ - .checksum = iot_checksum, /* U */ .unlink = iot_unlink, /* U */ .lookup = iot_lookup, /* U */ .setattr = iot_setattr, /* U */ diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index fb338491e0c..a02264c9398 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -3082,103 +3082,6 @@ out: return 0; } -int32_t -sp_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, uint8_t *file_checksum, - uint8_t *dir_checksum) -{ - SP_STACK_UNWIND (checksum, frame, op_ret, op_errno, file_checksum, - dir_checksum); - return 0; -} - - -int32_t -sp_checksum_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flag) -{ - uint64_t value = 0; - sp_inode_ctx_t *inode_ctx = NULL; - int32_t ret = 0, op_ret = -1, op_errno = -1; - - ret = inode_ctx_get (loc->inode, this, &value); - if (ret == -1) { - gf_log (this->name, GF_LOG_DEBUG, "context not set in inode " - "(%p)", loc->inode); - op_errno = EINVAL; - goto unwind; - } - - inode_ctx = (sp_inode_ctx_t *)(long) value; - GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, inode_ctx, unwind, op_errno, - EINVAL); - - LOCK (&inode_ctx->lock); - { - op_ret = inode_ctx->op_ret; - op_errno = inode_ctx->op_errno; - } - UNLOCK (&inode_ctx->lock); - - if (op_ret == -1) { - goto unwind; - } - - STACK_WIND (frame, sp_checksum_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, loc, flag); - - return 0; - -unwind: - SP_STACK_UNWIND (checksum, frame, -1, op_errno, NULL, NULL); - return 0; -} - - -int32_t -sp_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) -{ - sp_cache_t *cache = NULL; - int32_t op_errno = -1; - call_stub_t *stub = NULL; - char can_wind = 0, need_lookup = 0, need_unwind = 1; - - GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno, - EINVAL); - GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, - op_errno, EINVAL); - - cache = sp_get_cache_inode (this, loc->parent, frame->root->pid); - if (cache) { - sp_cache_remove_entry (cache, (char *)loc->name, 0); - sp_cache_unref (cache); - } - - stub = fop_checksum_stub (frame, sp_checksum_helper, loc, flag); - if (stub == NULL) { - op_errno = ENOMEM; - gf_log (this->name, GF_LOG_ERROR, "out of memory"); - goto out; - } - - sp_process_inode_ctx (frame, this, loc, stub, &need_unwind, - &need_lookup, &can_wind, &op_errno, - GF_FOP_CHECKSUM); - -out: - if (need_unwind) { - SP_STACK_UNWIND (checksum, frame, -1, op_errno, NULL, NULL); - } else if (need_lookup) { - STACK_WIND (frame, sp_lookup_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->lookup, loc, NULL); - } else if (can_wind) { - STACK_WIND (frame, sp_checksum_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->checksum, loc, flag); - } - - return 0; -} - int32_t sp_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -3761,7 +3664,6 @@ struct xlator_fops fops = { .rename = sp_rename, .setxattr = sp_setxattr, .removexattr = sp_removexattr, - .checksum = sp_checksum, .xattrop = sp_xattrop, .fxattrop = sp_fxattrop, .setattr = sp_setattr, diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index bad814a8198..6ad5944007f 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1169,34 +1169,6 @@ out: int32_t -client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flag) -{ - int ret = -1; - clnt_conf_t *conf = NULL; - rpc_clnt_procedure_t *proc = NULL; - clnt_args_t args = {0,}; - - conf = this->private; - if (!conf->fops) - goto out; - - args.loc = loc; - args.flags = flag; - - proc = &conf->fops->proctable[GF_FOP_CHECKSUM]; - if (proc->fn) - ret = proc->fn (frame, this, &args); -out: - if (ret) - STACK_UNWIND_STRICT (checksum, frame, -1, ENOTCONN, NULL, NULL); - - return 0; -} - - - -int32_t client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, int32_t len) { @@ -1741,7 +1713,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/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 5204ef032da..07145a097cd 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -1549,47 +1549,6 @@ out: } int -client3_1_checksum_cbk (struct rpc_req *req, struct iovec *iov, int count, - void *myframe) -{ - call_frame_t *frame = NULL; - gfs3_checksum_rsp rsp = {0,}; - int ret = 0; - - frame = myframe; - - if (-1 == req->rpc_status) { - rsp.op_ret = -1; - rsp.op_errno = ENOTCONN; - goto out; - } - - ret = xdr_to_checksum_rsp (*iov, &rsp); - if (ret < 0) { - gf_log ("", GF_LOG_ERROR, "error"); - rsp.op_ret = -1; - rsp.op_errno = EINVAL; - goto out; - } - -out: - STACK_UNWIND_STRICT (checksum, frame, rsp.op_ret, - gf_error_to_errno (rsp.op_errno), - (uint8_t *)rsp.fchecksum.fchecksum_val, - (uint8_t *)rsp.dchecksum.dchecksum_val); - - /* This is allocated by the libc while decoding RPC msg */ - /* Hence no 'GF_FREE', but just 'free' */ - if (rsp.fchecksum.fchecksum_val) { - free (rsp.fchecksum.fchecksum_val); - } - if (rsp.dchecksum.dchecksum_val) { - free (rsp.dchecksum.dchecksum_val); - } - return 0; -} - -int client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { @@ -4421,48 +4380,6 @@ unwind: } - - -int32_t -client3_1_checksum (call_frame_t *frame, xlator_t *this, - void *data) -{ - clnt_conf_t *conf = NULL; - clnt_args_t *args = NULL; - gfs3_checksum_req req = {0,}; - int ret = 0; - int op_errno = ESTALE; - - if (!frame || !this || !data) - goto unwind; - - args = data; - - ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen); - if (args->loc->inode->ino && ret < 0) { - gf_log (this->name, GF_LOG_TRACE, - "STAT %"PRId64" (%s): " - "failed to get remote inode number", - args->loc->inode->ino, args->loc->path); - goto unwind; - } - req.path = (char *)args->loc->path; - req.flag = args->flags; - req.gfs_id = GFS3_OP_CHECKSUM; - - conf = this->private; - - client_submit_request (this, &req, frame, conf->fops, GFS3_OP_CHECKSUM, - client3_1_checksum_cbk, NULL, xdr_from_checksum_req); - - return 0; -unwind: - STACK_UNWIND_STRICT (checksum, frame, -1, op_errno, NULL, NULL); - return 0; -} - - - int32_t client3_1_rchecksum (call_frame_t *frame, xlator_t *this, void *data) @@ -4748,7 +4665,6 @@ rpc_clnt_procedure_t clnt3_1_fop_actors[GF_FOP_MAXVALUE] = { [GF_FOP_FINODELK] = { "FINODELK", client3_1_finodelk }, [GF_FOP_ENTRYLK] = { "ENTRYLK", client3_1_entrylk }, [GF_FOP_FENTRYLK] = { "FENTRYLK", client3_1_fentrylk }, - [GF_FOP_CHECKSUM] = { "CHECKSUM", client3_1_checksum }, [GF_FOP_XATTROP] = { "XATTROP", client3_1_xattrop }, [GF_FOP_FXATTROP] = { "FXATTROP", client3_1_fxattrop }, [GF_FOP_FGETXATTR] = { "FGETXATTR", client3_1_fgetxattr }, @@ -4797,7 +4713,6 @@ char *clnt3_1_fop_names[GFS3_OP_MAXVALUE] = { [GFS3_OP_FINODELK] = "FINODELK", [GFS3_OP_ENTRYLK] = "ENTRYLK", [GFS3_OP_FENTRYLK] = "FENTRYLK", - [GFS3_OP_CHECKSUM] = "CHECKSUM", [GFS3_OP_XATTROP] = "XATTROP", [GFS3_OP_FXATTROP] = "FXATTROP", [GFS3_OP_FGETXATTR] = "FGETXATTR", 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; } diff --git a/xlators/protocol/lib/src/glusterfs-xdr.c b/xlators/protocol/lib/src/glusterfs-xdr.c index e8a254094f9..cbc4d7cef47 100644 --- a/xlators/protocol/lib/src/glusterfs-xdr.c +++ b/xlators/protocol/lib/src/glusterfs-xdr.c @@ -1365,39 +1365,6 @@ xdr_gfs3_fentrylk_req (XDR *xdrs, gfs3_fentrylk_req *objp) return TRUE; } -bool_t -xdr_gfs3_checksum_req (XDR *xdrs, gfs3_checksum_req *objp) -{ - - if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) - return FALSE; - if (!xdr_u_quad_t (xdrs, &objp->ino)) - return FALSE; - if (!xdr_u_quad_t (xdrs, &objp->gen)) - return FALSE; - if (!xdr_u_int (xdrs, &objp->flag)) - return FALSE; - if (!xdr_string (xdrs, &objp->path, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_gfs3_checksum_rsp (XDR *xdrs, gfs3_checksum_rsp *objp) -{ - - if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) - return FALSE; - if (!xdr_int (xdrs, &objp->op_ret)) - return FALSE; - if (!xdr_int (xdrs, &objp->op_errno)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->fchecksum.fchecksum_val, (u_int *) &objp->fchecksum.fchecksum_len, ~0)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->dchecksum.dchecksum_val, (u_int *) &objp->dchecksum.dchecksum_len, ~0)) - return FALSE; - return TRUE; -} bool_t xdr_gfs3_setattr_req (XDR *xdrs, gfs3_setattr_req *objp) diff --git a/xlators/protocol/lib/src/glusterfs-xdr.h b/xlators/protocol/lib/src/glusterfs-xdr.h index 72f131c746c..45ce3ff9bed 100644 --- a/xlators/protocol/lib/src/glusterfs-xdr.h +++ b/xlators/protocol/lib/src/glusterfs-xdr.h @@ -943,29 +943,6 @@ struct gfs3_fentrylk_req { }; typedef struct gfs3_fentrylk_req gfs3_fentrylk_req; -struct gfs3_checksum_req { - u_quad_t gfs_id; - u_quad_t ino; - u_quad_t gen; - u_int flag; - char *path; -}; -typedef struct gfs3_checksum_req gfs3_checksum_req; - -struct gfs3_checksum_rsp { - u_quad_t gfs_id; - int op_ret; - int op_errno; - struct { - u_int fchecksum_len; - char *fchecksum_val; - } fchecksum; - struct { - u_int dchecksum_len; - char *dchecksum_val; - } dchecksum; -}; -typedef struct gfs3_checksum_rsp gfs3_checksum_rsp; struct gfs3_setattr_req { u_quad_t gfs_id; @@ -1217,8 +1194,6 @@ extern bool_t xdr_gfs3_fstat_req (XDR *, gfs3_fstat_req*); extern bool_t xdr_gfs3_fstat_rsp (XDR *, gfs3_fstat_rsp*); extern bool_t xdr_gfs3_entrylk_req (XDR *, gfs3_entrylk_req*); extern bool_t xdr_gfs3_fentrylk_req (XDR *, gfs3_fentrylk_req*); -extern bool_t xdr_gfs3_checksum_req (XDR *, gfs3_checksum_req*); -extern bool_t xdr_gfs3_checksum_rsp (XDR *, gfs3_checksum_rsp*); extern bool_t xdr_gfs3_setattr_req (XDR *, gfs3_setattr_req*); extern bool_t xdr_gfs3_setattr_rsp (XDR *, gfs3_setattr_rsp*); extern bool_t xdr_gfs3_fsetattr_req (XDR *, gfs3_fsetattr_req*); @@ -1308,8 +1283,6 @@ extern bool_t xdr_gfs3_fstat_req (); extern bool_t xdr_gfs3_fstat_rsp (); extern bool_t xdr_gfs3_entrylk_req (); extern bool_t xdr_gfs3_fentrylk_req (); -extern bool_t xdr_gfs3_checksum_req (); -extern bool_t xdr_gfs3_checksum_rsp (); extern bool_t xdr_gfs3_setattr_req (); extern bool_t xdr_gfs3_setattr_rsp (); extern bool_t xdr_gfs3_fsetattr_req (); diff --git a/xlators/protocol/lib/src/glusterfs3.x b/xlators/protocol/lib/src/glusterfs3.x index c9510527c27..b2eb9556c02 100644 --- a/xlators/protocol/lib/src/glusterfs3.x +++ b/xlators/protocol/lib/src/glusterfs3.x @@ -634,21 +634,6 @@ struct gfs3_fstat_req { }; -struct gfs3_checksum_req { - unsigned hyper gfs_id; - unsigned hyper ino; - unsigned hyper gen; - unsigned int flag; - string path<>; -}; - struct gfs3_checksum_rsp { - unsigned hyper gfs_id; - int op_ret; - int op_errno; - opaque fchecksum<>; - opaque dchecksum<>; -} ; - struct gfs3_setattr_req { unsigned hyper gfs_id; unsigned hyper ino; diff --git a/xlators/protocol/lib/src/msg-xdr.c b/xlators/protocol/lib/src/msg-xdr.c index 8cab3726c3d..3fe5ad5f65d 100644 --- a/xlators/protocol/lib/src/msg-xdr.c +++ b/xlators/protocol/lib/src/msg-xdr.c @@ -333,13 +333,6 @@ xdr_serialize_opendir_rsp (struct iovec outmsg, void *rsp) } ssize_t -xdr_serialize_checksum_rsp (struct iovec outmsg, void *rsp) -{ - return xdr_serialize_generic (outmsg, (void *)rsp, - (xdrproc_t)xdr_gfs3_checksum_rsp); -} - -ssize_t xdr_serialize_ftruncate_rsp (struct iovec outmsg, void *rsp) { return xdr_serialize_generic (outmsg, (void *)rsp, @@ -579,13 +572,6 @@ xdr_to_fstat_req (struct iovec inmsg, void *args) return xdr_to_generic (inmsg, (void *)args, (xdrproc_t)xdr_gfs3_fstat_req); } - -ssize_t -xdr_to_checksum_req (struct iovec inmsg, void *args) -{ - return xdr_to_generic (inmsg, (void *)args, - (xdrproc_t)xdr_gfs3_checksum_req); -} ssize_t xdr_to_rchecksum_req (struct iovec inmsg, void *args) { @@ -953,13 +939,6 @@ xdr_from_statfs_req (struct iovec outmsg, void *req) } ssize_t -xdr_from_checksum_req (struct iovec outmsg, void *req) -{ - return xdr_serialize_generic (outmsg, (void *)req, - (xdrproc_t)xdr_gfs3_checksum_req); - -} -ssize_t xdr_from_rchecksum_req (struct iovec outmsg, void *req) { return xdr_serialize_generic (outmsg, (void *)req, @@ -1207,13 +1186,6 @@ xdr_to_statfs_rsp (struct iovec outmsg, void *rsp) } ssize_t -xdr_to_checksum_rsp (struct iovec outmsg, void *rsp) -{ - return xdr_to_generic (outmsg, (void *)rsp, - (xdrproc_t)xdr_gfs3_checksum_rsp); - -} -ssize_t xdr_to_rchecksum_rsp (struct iovec outmsg, void *rsp) { return xdr_to_generic (outmsg, (void *)rsp, diff --git a/xlators/protocol/lib/src/msg-xdr.h b/xlators/protocol/lib/src/msg-xdr.h index 872d9401e48..59b6ca30112 100644 --- a/xlators/protocol/lib/src/msg-xdr.h +++ b/xlators/protocol/lib/src/msg-xdr.h @@ -93,9 +93,6 @@ ssize_t xdr_serialize_ftruncate_rsp (struct iovec outmsg, void *rsp); ssize_t -xdr_serialize_checksum_rsp (struct iovec outmsg, void *rsp); - -ssize_t xdr_serialize_statfs_rsp (struct iovec outmsg, void *rsp); @@ -266,9 +263,6 @@ ssize_t xdr_to_rmdir_req (struct iovec inmsg, void *args); ssize_t -xdr_to_checksum_req (struct iovec inmsg, void *args); - -ssize_t xdr_to_rchecksum_req (struct iovec inmsg, void *args); ssize_t @@ -369,9 +363,6 @@ ssize_t xdr_from_fxattrop_req (struct iovec outmsg, void *args); ssize_t -xdr_from_checksum_req (struct iovec outmsg, void *args); - -ssize_t xdr_from_rchecksum_req (struct iovec outmsg, void *args); ssize_t @@ -515,8 +506,6 @@ ssize_t xdr_to_fgetxattr_rsp (struct iovec inmsg, void *args); ssize_t -xdr_to_checksum_rsp (struct iovec inmsg, void *args); -ssize_t xdr_to_rchecksum_rsp (struct iovec inmsg, void *args); ssize_t diff --git a/xlators/protocol/lib/src/protocol-common.h b/xlators/protocol/lib/src/protocol-common.h index 5378d90ba45..5590960a6d9 100644 --- a/xlators/protocol/lib/src/protocol-common.h +++ b/xlators/protocol/lib/src/protocol-common.h @@ -54,7 +54,6 @@ enum gf_fop_procnum { GFS3_OP_FINODELK, GFS3_OP_ENTRYLK, GFS3_OP_FENTRYLK, - GFS3_OP_CHECKSUM, GFS3_OP_XATTROP, GFS3_OP_FXATTROP, GFS3_OP_FGETXATTR, diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 1210a807a9a..00247c1eef8 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -167,79 +167,6 @@ xdr_to_glusterfs_req (rpcsvc_request_t *req, void *arg, gfs_serialize_t sfunc) return ret; } - -#if 0 -/* - * prototype of operations function for each of mop and - * fop at server protocol level - * - * @frame: call frame pointer - * @bound_xl: the xlator that this frame is bound to - * @params: parameters dictionary - * - * to be used by protocol interpret, _not_ for exterenal reference - */ -typedef int32_t (*gf_op_t) (call_frame_t *frame, xlator_t *bould_xl, - gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf); - - -static gf_op_t gf_fops[] = { - [GF_FOP_STAT] = server_stat, - [GF_FOP_READLINK] = server_readlink, - [GF_FOP_MKNOD] = server_mknod, - [GF_FOP_MKDIR] = server_mkdir, - [GF_FOP_UNLINK] = server_unlink, - [GF_FOP_RMDIR] = server_rmdir, - [GF_FOP_SYMLINK] = server_symlink, - [GF_FOP_RENAME] = server_rename, - [GF_FOP_LINK] = server_link, - [GF_FOP_TRUNCATE] = server_truncate, - [GF_FOP_OPEN] = server_open, - [GF_FOP_READ] = server_readv, - [GF_FOP_WRITE] = server_writev, - [GF_FOP_STATFS] = server_statfs, - [GF_FOP_FLUSH] = server_flush, - [GF_FOP_FSYNC] = server_fsync, - [GF_FOP_SETXATTR] = server_setxattr, - [GF_FOP_GETXATTR] = server_getxattr, - [GF_FOP_FGETXATTR] = server_fgetxattr, - [GF_FOP_FSETXATTR] = server_fsetxattr, - [GF_FOP_REMOVEXATTR] = server_removexattr, - [GF_FOP_OPENDIR] = server_opendir, - [GF_FOP_FSYNCDIR] = server_fsyncdir, - [GF_FOP_ACCESS] = server_access, - [GF_FOP_CREATE] = server_create, - [GF_FOP_FTRUNCATE] = server_ftruncate, - [GF_FOP_FSTAT] = server_fstat, - [GF_FOP_LK] = server_lk, - [GF_FOP_LOOKUP] = server_lookup, - [GF_FOP_READDIR] = server_readdir, - [GF_FOP_READDIRP] = server_readdirp, - [GF_FOP_INODELK] = server_inodelk, - [GF_FOP_FINODELK] = server_finodelk, - [GF_FOP_ENTRYLK] = server_entrylk, - [GF_FOP_FENTRYLK] = server_fentrylk, - [GF_FOP_CHECKSUM] = server_checksum, - [GF_FOP_RCHECKSUM] = server_rchecksum, - [GF_FOP_XATTROP] = server_xattrop, - [GF_FOP_FXATTROP] = server_fxattrop, - [GF_FOP_SETATTR] = server_setattr, - [GF_FOP_FSETATTR] = server_fsetattr, - [GF_FOP_SETDENTS] = server_setdents, - [GF_FOP_GETDENTS] = server_getdents, - [GF_FOP_LOCK_NOTIFY] = server_lock_notify, - [GF_FOP_LOCK_FNOTIFY] = server_lock_fnotify, -}; - -static gf_op_t gf_cbks[] = { - [GF_CBK_FORGET] = server_forget, - [GF_CBK_RELEASE] = server_release, - [GF_CBK_RELEASEDIR] = server_releasedir -}; - -#endif - int server_fd (xlator_t *this) { diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 825e66c3c0b..1cf4e0ded33 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -1258,34 +1258,6 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } 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) -{ - gfs3_checksum_rsp rsp = {0,}; - rpcsvc_request_t *req = NULL; - - req = frame->local; - - rsp.gfs_id = req->gfs_id; - rsp.op_ret = op_ret; - rsp.op_errno = gf_errno_to_error (op_errno); - - if (op_ret >= 0) { - rsp.fchecksum.fchecksum_val = (char *)fchecksum; - rsp.fchecksum.fchecksum_len = NAME_MAX; - rsp.dchecksum.dchecksum_val = (char *)dchecksum; - rsp.dchecksum.dchecksum_len = NAME_MAX; - } - - server_submit_reply (frame, req, &rsp, NULL, 0, NULL, - xdr_serialize_checksum_rsp); - - return 0; -} - - -int server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, uint8_t *strong_checksum) @@ -1777,32 +1749,6 @@ err: } 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, - bound_xl->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; -} - -int server_lk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4536,48 +4482,6 @@ out: return 0; } -int -server_checksum (rpcsvc_request_t *req) -{ - server_state_t *state = NULL; - server_connection_t *conn = NULL; - call_frame_t *frame = NULL; - gfs3_checksum_req args = {0,}; - char path[SERVER_PATH_MAX] = {0,}; - - if (!req) - return 0; - - conn = req->conn->trans->xl_private; - - args.path = path; - if (!xdr_to_checksum_req (req->msg[0], &args)) { - //failed to decode msg; - req->rpc_err = GARBAGE_ARGS; - goto out; - } - - frame = get_frame_from_request (req); - if (!frame) { - // something wrong, mostly insufficient memory - req->rpc_err = GARBAGE_ARGS; /* TODO */ - goto out; - } - - state = CALL_STATE (frame); - - state->resolve.type = RESOLVE_MAY; - state->resolve.path = gf_strdup (args.path); - state->resolve.gen = args.gen; - state->resolve.ino = args.ino; - state->flags = args.flag; - - resolve_and_resume (frame, server_checksum_resume); -out: - return 0; -} - - int server_rchecksum (rpcsvc_request_t *req) @@ -4808,7 +4712,6 @@ rpcsvc_actor_t glusterfs3_1_fop_actors[] = { [GFS3_OP_FINODELK] = { "FINODELK", GFS3_OP_FINODELK, server_finodelk, NULL, NULL }, [GFS3_OP_ENTRYLK] = { "ENTRYLK", GFS3_OP_ENTRYLK, server_entrylk, NULL, NULL }, [GFS3_OP_FENTRYLK] = { "FENTRYLK", GFS3_OP_FENTRYLK, server_fentrylk, NULL, NULL }, - [GFS3_OP_CHECKSUM] = { "CHECKSUM", GFS3_OP_CHECKSUM, server_checksum, NULL, NULL }, [GFS3_OP_XATTROP] = { "XATTROP", GFS3_OP_XATTROP, server_xattrop, NULL, NULL }, [GFS3_OP_FXATTROP] = { "FXATTROP", GFS3_OP_FXATTROP, server_fxattrop, NULL, NULL }, [GFS3_OP_FGETXATTR] = { "FGETXATTR", GFS3_OP_FGETXATTR, server_fgetxattr, NULL, NULL }, diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 2aba365e62b..7c0d165ac99 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4104,79 +4104,6 @@ posix_readdirp (call_frame_t *frame, xlator_t *this, return 0; } - -int32_t -posix_checksum (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flag) -{ - char * real_path = NULL; - DIR * dir = NULL; - struct dirent * dirent = NULL; - uint8_t file_checksum[NAME_MAX] = {0,}; - uint8_t dir_checksum[NAME_MAX] = {0,}; - int32_t op_ret = -1; - int32_t op_errno = 0; - int i = 0; - int length = 0; - - struct iatt buf = {0,}; - char tmp_real_path[ZR_PATH_MAX] = {0,}; - int ret = -1; - - MAKE_REAL_PATH (real_path, this, loc->path); - - dir = opendir (real_path); - - if (!dir){ - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "opendir() failed on `%s': %s", - real_path, strerror (op_errno)); - goto out; - } - - while ((dirent = readdir (dir))) { - errno = 0; - if (!dirent) { - if (errno != 0) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "readdir() failed on dir=%p: %s", - dir, strerror (errno)); - goto out; - } - break; - } - - length = strlen (dirent->d_name); - - strcpy (tmp_real_path, real_path); - strcat (tmp_real_path, "/"); - strcat (tmp_real_path, dirent->d_name); - ret = posix_lstat_with_gen (this, tmp_real_path, &buf); - - if (ret == -1) - continue; - - if (IA_ISDIR (buf.ia_type)) { - for (i = 0; i < length; i++) - dir_checksum[i] ^= dirent->d_name[i]; - } else { - for (i = 0; i < length; i++) - file_checksum[i] ^= dirent->d_name[i]; - } - } - closedir (dir); - - op_ret = 0; - - out: - STACK_UNWIND_STRICT (checksum, frame, op_ret, op_errno, - file_checksum, dir_checksum); - - return 0; -} - int32_t posix_priv (xlator_t *this) { @@ -4629,7 +4556,6 @@ struct xlator_fops fops = { .finodelk = posix_finodelk, .entrylk = posix_entrylk, .fentrylk = posix_fentrylk, - .checksum = posix_checksum, .rchecksum = posix_rchecksum, .xattrop = posix_xattrop, .fxattrop = posix_fxattrop, |