From 7840d9de272ef2f24c4c755a857ad8ae06703b55 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 4 May 2010 00:37:01 +0000 Subject: frame's 'op', 'type' restructured Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 875 (Implement a new protocol to provide proper backward/forward compatibility) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=875 --- xlators/bindings/python/src/python.c | 3 - xlators/cluster/afr/src/afr.c | 3 - xlators/cluster/afr/src/afr.h | 1 - xlators/cluster/dht/src/dht.c | 4 - xlators/cluster/dht/src/nufa.c | 4 - xlators/cluster/dht/src/switch.c | 4 - xlators/cluster/ha/src/ha.c | 5 - xlators/cluster/map/src/map.c | 3 - xlators/cluster/stripe/src/stripe.c | 3 - xlators/cluster/unify/src/unify.c | 2 - xlators/debug/error-gen/src/error-gen.c | 7 +- xlators/debug/io-stats/src/io-stats.c | 32 +-- xlators/debug/trace/src/trace.c | 2 - xlators/encryption/rot-13/src/rot-13.c | 3 - .../features/access-control/src/access-control.c | 3 - xlators/features/filter/src/filter.c | 3 - xlators/features/locks/src/posix.c | 4 - xlators/features/path-convertor/src/path.c | 5 - xlators/features/quota/src/quota.c | 3 - xlators/features/read-only/src/read-only.c | 3 - xlators/features/trash/src/trash.c | 3 - xlators/meta/src/meta.c | 3 - xlators/mount/fuse/src/fuse-bridge.c | 6 +- xlators/nfs/server/src/nfs.c | 1 - xlators/performance/io-cache/src/io-cache.c | 3 - xlators/performance/io-threads/src/io-threads.c | 3 - xlators/performance/quick-read/src/quick-read.c | 3 - xlators/performance/read-ahead/src/read-ahead.c | 3 - .../performance/stat-prefetch/src/stat-prefetch.c | 3 - .../performance/symlink-cache/src/symlink-cache.c | 2 - .../performance/write-behind/src/write-behind.c | 2 - xlators/protocol/client/src/client-protocol.c | 245 ++++++++------------- xlators/protocol/lib/src/Makefile.am | 4 +- xlators/protocol/lib/src/protocol.c | 108 +++++++++ xlators/protocol/lib/src/protocol.h | 171 +++++++------- xlators/protocol/server/src/server-protocol.c | 185 ++++++++-------- xlators/storage/bdb/src/bdb.c | 3 - xlators/storage/posix/src/posix.c | 3 - 38 files changed, 394 insertions(+), 454 deletions(-) create mode 100644 xlators/protocol/lib/src/protocol.c (limited to 'xlators') diff --git a/xlators/bindings/python/src/python.c b/xlators/bindings/python/src/python.c index 7f32d7f2997..c11323cda4f 100644 --- a/xlators/bindings/python/src/python.c +++ b/xlators/bindings/python/src/python.c @@ -77,9 +77,6 @@ struct xlator_fops fops = { .writev = python_writev }; -struct xlator_mops mops = { -}; - static PyObject * AnonModule_FromFile (const char* fname) { diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 5072869448e..41eff8ed036 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -3086,9 +3086,6 @@ struct xlator_fops fops = { }; -struct xlator_mops mops = { -}; - struct xlator_dumpops dumpops = { .priv = afr_priv_dump, }; diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 0f7d8bbae13..662f94c8356 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -26,7 +26,6 @@ #include "config.h" #endif -#include "scheduler.h" #include "call-stub.h" #include "compat-errno.h" #include "afr-mem-types.h" diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index ca5601510bf..0fc5d45a317 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -413,10 +413,6 @@ struct xlator_fops fops = { #endif }; - -struct xlator_mops mops = { -}; - struct xlator_dumpops dumpops = { .priv = dht_priv_dump, .inodectx = dht_inodectx_dump, diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 0d8241f41a5..8d181fa507a 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -729,10 +729,6 @@ struct xlator_fops fops = { }; -struct xlator_mops mops = { -}; - - struct xlator_cbks cbks = { .forget = dht_forget }; diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index f6fb6b652b3..22289b3a1bf 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -1040,10 +1040,6 @@ struct xlator_fops fops = { }; -struct xlator_mops mops = { -}; - - struct xlator_cbks cbks = { .forget = dht_forget }; diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index 10e64e56252..54b41858eee 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -4016,11 +4016,6 @@ struct xlator_fops fops = { .fsetattr = ha_fsetattr, }; -struct xlator_mops mops = { - .stats = ha_stats, - .getspec = ha_getspec, -}; - struct xlator_cbks cbks = { .release = ha_close, .releasedir = ha_closedir, diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 1383d83c1c9..dd89d0ebee9 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -2562,9 +2562,6 @@ struct xlator_fops fops = { .fsetattr = map_fsetattr, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index f2186ee6a26..fae9f755533 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3610,9 +3610,6 @@ struct xlator_fops fops = { .mknod = stripe_mknod, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .release = stripe_release, }; diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index 3f0910df4fa..d1fe847bc9b 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -4561,8 +4561,6 @@ struct xlator_fops fops = { .fsetattr = unify_fsetattr, }; -struct xlator_mops mops = { -}; struct xlator_cbks cbks = { .forget = unify_forget, diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 434965b5c1a..3ac2e22d3a5 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -1756,7 +1756,7 @@ error_gen_getspec (call_frame_t *frame, xlator_t *this, const char *key, STACK_WIND (frame, error_gen_getspec_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->mops->getspec, + FIRST_CHILD(this)->fops->getspec, key, flags); return 0; } @@ -2041,10 +2041,7 @@ struct xlator_fops fops = { .fentrylk = error_gen_fentrylk, .setattr = error_gen_setattr, .fsetattr = error_gen_fsetattr, -}; - -struct xlator_mops mops = { - .getspec = error_gen_getspec, + .getspec = error_gen_getspec, }; struct xlator_cbks cbks = { diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 09ee86751f2..d7024447202 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -50,7 +50,6 @@ struct ios_global_stats { uint64_t block_count_write[32]; uint64_t block_count_read[32]; uint64_t fop_hits[GF_FOP_MAXVALUE]; - uint64_t cbk_hits[GF_CBK_MAXVALUE]; struct timeval started_at; }; @@ -94,20 +93,6 @@ struct ios_local { } while (0) -#define BUMP_CBK(op) \ - do { \ - struct ios_conf *conf = NULL; \ - \ - conf = this->private; \ - LOCK (&conf->lock); \ - { \ - conf->cumulative.cbk_hits[GF_CBK_##op]++; \ - conf->incremental.cbk_hits[GF_CBK_##op]++; \ - } \ - UNLOCK (&conf->lock); \ - } while (0) - - #define BUMP_READ(fd, len) \ do { \ struct ios_conf *conf = NULL; \ @@ -235,10 +220,7 @@ io_stats_dump_global (xlator_t *this, struct ios_global_stats *stats, ios_log (this, logfp, "%14s : %"PRId64, gf_fop_list[i], stats->fop_hits[i]); - for (i = 0; i < GF_CBK_MAXVALUE; i++) - if (stats->cbk_hits[i]) - ios_log (this, logfp, "%14s : %"PRId64, - gf_fop_list[i], stats->cbk_hits[i]); + return 0; } @@ -1376,7 +1358,7 @@ io_stats_release (xlator_t *this, fd_t *fd) { struct ios_fd *iosfd = NULL; - BUMP_CBK (RELEASE); + BUMP_FOP (RELEASE); ios_fd_ctx_get (fd, this, &iosfd); if (iosfd) { @@ -1394,16 +1376,16 @@ io_stats_release (xlator_t *this, fd_t *fd) int io_stats_releasedir (xlator_t *this, fd_t *fd) { - BUMP_CBK (RELEASEDIR); + BUMP_FOP (RELEASEDIR); return 0; } int -io_stats_forget (xlator_t *this, fd_t *fd) +io_stats_forget (xlator_t *this, inode_t *inode) { - BUMP_CBK (FORGET); + BUMP_FOP (FORGET); return 0; } @@ -1535,12 +1517,10 @@ struct xlator_fops fops = { .fsetattr = io_stats_fsetattr, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .release = io_stats_release, .releasedir = io_stats_releasedir, + .forget = io_stats_forget, }; struct volume_options options[] = { diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 7d619aadbc4..aa9d33f3ea2 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -2096,8 +2096,6 @@ struct xlator_fops fops = { .fsetattr = trace_fsetattr, }; -struct xlator_mops mops = { -}; struct xlator_cbks cbks = { }; diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index dc938781cab..a19ef5deadf 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -189,9 +189,6 @@ struct xlator_fops fops = { .writev = rot13_writev }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/features/access-control/src/access-control.c b/xlators/features/access-control/src/access-control.c index c13648d3c47..3735992435c 100644 --- a/xlators/features/access-control/src/access-control.c +++ b/xlators/features/access-control/src/access-control.c @@ -1837,8 +1837,5 @@ fini (xlator_t *this) return; } -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index a0469bf6ecc..beede16e80c 100644 --- a/xlators/features/filter/src/filter.c +++ b/xlators/features/filter/src/filter.c @@ -1712,9 +1712,6 @@ struct xlator_fops fops = { .fsetattr = filter_fsetattr, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 6e5ea94f87b..54cf89ca42d 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -1560,10 +1560,6 @@ struct xlator_fops fops = { .opendir = pl_opendir, }; - -struct xlator_mops mops = { -}; - struct xlator_dumpops dumpops = { .inodectx = pl_dump_inode_priv, }; diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index eda1633834e..0a86baa8785 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -1218,11 +1218,6 @@ struct xlator_fops fops = { .setattr = path_setattr, }; - -struct xlator_mops mops = { -}; - - struct xlator_cbks cbks = { }; diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 3b4690bf0ae..a4266a32a85 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -1137,9 +1137,6 @@ struct xlator_fops fops = { .statfs = quota_statfs, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .release = quota_release }; diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c index 08412bf047d..b8ba9218415 100644 --- a/xlators/features/read-only/src/read-only.c +++ b/xlators/features/read-only/src/read-only.c @@ -295,9 +295,6 @@ struct xlator_fops fops = { .lk = ro_lk, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index ff060cc5c0d..c51d55a02fe 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -1538,9 +1538,6 @@ struct xlator_fops fops = { .ftruncate = trash_ftruncate, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/meta/src/meta.c b/xlators/meta/src/meta.c index 2babe32f911..face2fe70f1 100644 --- a/xlators/meta/src/meta.c +++ b/xlators/meta/src/meta.c @@ -1305,6 +1305,3 @@ struct xlator_fops fops = { .create = meta_create, .lk = meta_lk, }; - -struct xlator_mops mops = { -}; diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index a6ff46a2659..faf7c481558 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -252,7 +252,7 @@ get_call_frame_for_req (fuse_state_t *state) frame->root->unique = finh->unique; } - frame->root->type = GF_OP_TYPE_FOP_REQUEST; + frame->root->type = GF_OP_TYPE_FOP; return frame; } @@ -3027,7 +3027,7 @@ fuse_first_lookup (xlator_t *this) dict = dict_new (); frame = create_frame (this, this->ctx->pool); - frame->root->type = GF_OP_TYPE_FOP_REQUEST; + frame->root->type = GF_OP_TYPE_FOP; xl = this->children->xlator; STACK_WIND (frame, fuse_first_lookup_cbk, xl, xl->fops->lookup, @@ -3566,8 +3566,6 @@ struct xlator_fops fops = { struct xlator_cbks cbks = { }; -struct xlator_mops mops = { -}; struct xlator_dumpops dumpops = { .priv = fuse_priv_dump, diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index b67567f7810..65ff55c76c1 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -576,7 +576,6 @@ fini (xlator_t *this) } struct xlator_cbks cbks = { }; -struct xlator_mops mops = { }; struct xlator_fops fops = { }; struct volume_options options[] = { diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index f49185ad6e4..2f26b076b12 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -1592,9 +1592,6 @@ struct xlator_fops fops = { .setattr = ioc_setattr }; -struct xlator_mops mops = { -}; - struct xlator_dumpops dumpops = { .priv = ioc_priv_dump, diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index c2cca788855..74a20a4dee3 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -2256,9 +2256,6 @@ struct xlator_fops fops = { .fxattrop = iot_fxattrop, /* O */ }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { }; diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 6be668a7a66..5580b529ba9 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -2315,9 +2315,6 @@ struct xlator_fops fops = { }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .forget = qr_forget, diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 9f97c72e933..4f38229025f 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -952,9 +952,6 @@ struct xlator_fops fops = { .fstat = ra_fstat, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .release = ra_release, }; diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 87cc6ddc3e9..9205fedc299 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -3771,9 +3771,6 @@ struct xlator_fops fops = { .entrylk = sp_entrylk, }; -struct xlator_mops mops = { -}; - struct xlator_cbks cbks = { .forget = sp_forget, .release = sp_release, diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index a8c89b8640d..5aaa0a8a7d6 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -397,8 +397,6 @@ struct xlator_fops fops = { .readlink = sc_readlink, }; -struct xlator_mops mops = { -}; struct xlator_cbks cbks = { .forget = sc_forget, diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index bd046500657..90a889c05b4 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -2638,8 +2638,6 @@ struct xlator_fops fops = { .setattr = wb_setattr, }; -struct xlator_mops mops = { -}; struct xlator_cbks cbks = { .release = wb_release diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index df890cc3ca6..c5554ac98a2 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -61,7 +61,7 @@ protocol_client_xfer (call_frame_t *frame, xlator_t *this, transport_t *trans, int protocol_client_post_handshake (call_frame_t *frame, xlator_t *this); -static gf_op_t gf_fops[GF_FOP_MAXVALUE]; +static gf_op_t gf_fops[GF_PROTO_FOP_MAXVALUE]; static gf_op_t gf_mops[GF_MOP_MAXVALUE]; static gf_op_t gf_cbks[GF_CBK_MAXVALUE]; @@ -731,7 +731,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_CREATE, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_CREATE, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -800,7 +800,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPEN, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_OPEN, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -855,7 +855,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_STAT, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_STAT, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -911,7 +911,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_READLINK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_READLINK, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -980,7 +980,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKNOD, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_MKNOD, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1046,7 +1046,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_MKDIR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1102,7 +1102,7 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_UNLINK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_UNLINK, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1158,7 +1158,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_RMDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_RMDIR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1228,7 +1228,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_SYMLINK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_SYMLINK, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -1308,7 +1308,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_RENAME, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_RENAME, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -1391,7 +1391,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_LINK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_LINK, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -1445,7 +1445,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_TRUNCATE, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_TRUNCATE, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1518,7 +1518,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_READ, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_READ, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1592,7 +1592,7 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_WRITE, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_WRITE, hdr, hdrlen, vector, count, iobref); return ret; unwind: @@ -1648,7 +1648,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_STATFS, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_STATFS, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1716,7 +1716,7 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FLUSH, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FLUSH, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1785,7 +1785,7 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSYNC, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FSYNC, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -1854,7 +1854,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_XATTROP, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_XATTROP, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -1938,7 +1938,7 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FXATTROP, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FXATTROP, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2015,7 +2015,7 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETXATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_SETXATTR, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2106,7 +2106,7 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSETXATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FSETXATTR, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2166,7 +2166,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETXATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_GETXATTR, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2245,7 +2245,7 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FGETXATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FGETXATTR, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2304,7 +2304,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_REMOVEXATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_REMOVEXATTR, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2366,7 +2366,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPENDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_OPENDIR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -2432,7 +2432,7 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_READDIRP, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_READDIRP, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2500,7 +2500,7 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_READDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_READDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2566,7 +2566,7 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSYNCDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FSYNCDIR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -2619,7 +2619,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_ACCESS, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_ACCESS, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -2688,7 +2688,7 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FTRUNCATE, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FTRUNCATE, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -2754,7 +2754,7 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSTAT, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FSTAT, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -2853,7 +2853,7 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_LK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_LK, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -2945,7 +2945,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), GF_OP_TYPE_FOP_REQUEST, - GF_FOP_INODELK, + GF_PROTO_FOP_INODELK, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -3052,7 +3052,7 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), GF_OP_TYPE_FOP_REQUEST, - GF_FOP_FINODELK, + GF_PROTO_FOP_FINODELK, hdr, hdrlen, NULL, 0, NULL); return ret; unwind: @@ -3113,7 +3113,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_ENTRYLK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_ENTRYLK, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -3191,7 +3191,7 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FENTRYLK, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FENTRYLK, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -3289,7 +3289,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_LOOKUP, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_LOOKUP, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -3339,7 +3339,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_SETATTR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -3402,7 +3402,7 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSETATTR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_FSETATTR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -5174,68 +5174,6 @@ client_getspec_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, return 0; } - -int -client_log (call_frame_t *frame, xlator_t *this, const char *msg) -{ - gf_hdr_common_t * hdr = NULL; - gf_mop_log_req_t * req = NULL; - size_t hdrlen = -1; - int msglen = 0; - int ret = -1; - - if (msg) - msglen = STRLEN_0 (msg); - - hdrlen = gf_hdr_len (req, msglen); - hdr = gf_hdr_new (req, msglen); - - GF_VALIDATE_OR_GOTO (this->name, hdr, unwind); - - req = gf_param (hdr); - req->msglen = hton32 (msglen); - - if (msglen) - strcpy (req->msg, msg); - - ret = protocol_client_xfer (frame, this, - CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_MOP_REQUEST, GF_MOP_LOG, - hdr, hdrlen, NULL, 0, NULL); - - return ret; - -unwind: - if (hdr) - GF_FREE (hdr); - - STACK_UNWIND (frame, -1, EINVAL, NULL); - return 0; -} - - -int -client_log_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - gf_mop_log_rsp_t * rsp = NULL; - - int32_t op_ret = 0; - int32_t op_errno = 0; - int32_t gf_errno = 0; - - op_ret = ntoh32 (hdr->rsp.op_ret); - gf_errno = ntoh32 (hdr->rsp.op_errno); - op_errno = gf_error_to_errno (gf_errno); - - rsp = gf_param (hdr); - - STACK_UNWIND (frame, op_ret, op_errno); - - return 0; -} - - int client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) { @@ -5265,7 +5203,7 @@ client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_CHECKSUM, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_CHECKSUM, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -5348,7 +5286,7 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_RCHECKSUM, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_RCHECKSUM, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -5514,7 +5452,7 @@ protocol_client_reopendir (xlator_t *this, client_fd_ctx_t *fdctx) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPENDIR, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_OPENDIR, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -5638,7 +5576,7 @@ protocol_client_reopen (xlator_t *this, client_fd_ctx_t *fdctx) ret = protocol_client_xfer (frame, this, CLIENT_CHANNEL (this, CHANNEL_LOWLAT), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPEN, + GF_OP_TYPE_FOP_REQUEST, GF_PROTO_FOP_OPEN, hdr, hdrlen, NULL, 0, NULL); return ret; @@ -5996,46 +5934,55 @@ client_forget_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, } +int +client_log_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, + struct iobuf *iobuf) +{ + gf_log ("", GF_LOG_CRITICAL, "fop not implemented"); + return 0; +} + + static gf_op_t gf_fops[] = { - [GF_FOP_STAT] = client_stat_cbk, - [GF_FOP_READLINK] = client_readlink_cbk, - [GF_FOP_MKNOD] = client_mknod_cbk, - [GF_FOP_MKDIR] = client_mkdir_cbk, - [GF_FOP_UNLINK] = client_unlink_cbk, - [GF_FOP_RMDIR] = client_rmdir_cbk, - [GF_FOP_SYMLINK] = client_symlink_cbk, - [GF_FOP_RENAME] = client_rename_cbk, - [GF_FOP_LINK] = client_link_cbk, - [GF_FOP_TRUNCATE] = client_truncate_cbk, - [GF_FOP_OPEN] = client_open_cbk, - [GF_FOP_READ] = client_readv_cbk, - [GF_FOP_WRITE] = client_write_cbk, - [GF_FOP_STATFS] = client_statfs_cbk, - [GF_FOP_FLUSH] = client_flush_cbk, - [GF_FOP_FSYNC] = client_fsync_cbk, - [GF_FOP_SETXATTR] = client_setxattr_cbk, - [GF_FOP_GETXATTR] = client_getxattr_cbk, - [GF_FOP_REMOVEXATTR] = client_removexattr_cbk, - [GF_FOP_OPENDIR] = client_opendir_cbk, - [GF_FOP_FSYNCDIR] = client_fsyncdir_cbk, - [GF_FOP_ACCESS] = client_access_cbk, - [GF_FOP_CREATE] = client_create_cbk, - [GF_FOP_FTRUNCATE] = client_ftruncate_cbk, - [GF_FOP_FSTAT] = client_fstat_cbk, - [GF_FOP_LK] = client_lk_common_cbk, - [GF_FOP_LOOKUP] = client_lookup_cbk, - [GF_FOP_READDIR] = client_readdir_cbk, - [GF_FOP_READDIRP] = client_readdirp_cbk, - [GF_FOP_INODELK] = client_inodelk_cbk, - [GF_FOP_FINODELK] = client_finodelk_cbk, - [GF_FOP_ENTRYLK] = client_entrylk_cbk, - [GF_FOP_FENTRYLK] = client_fentrylk_cbk, - [GF_FOP_CHECKSUM] = client_checksum_cbk, - [GF_FOP_RCHECKSUM] = client_rchecksum_cbk, - [GF_FOP_XATTROP] = client_xattrop_cbk, - [GF_FOP_FXATTROP] = client_fxattrop_cbk, - [GF_FOP_SETATTR] = client_setattr_cbk, - [GF_FOP_FSETATTR] = client_fsetattr_cbk + [GF_PROTO_FOP_STAT] = client_stat_cbk, + [GF_PROTO_FOP_READLINK] = client_readlink_cbk, + [GF_PROTO_FOP_MKNOD] = client_mknod_cbk, + [GF_PROTO_FOP_MKDIR] = client_mkdir_cbk, + [GF_PROTO_FOP_UNLINK] = client_unlink_cbk, + [GF_PROTO_FOP_RMDIR] = client_rmdir_cbk, + [GF_PROTO_FOP_SYMLINK] = client_symlink_cbk, + [GF_PROTO_FOP_RENAME] = client_rename_cbk, + [GF_PROTO_FOP_LINK] = client_link_cbk, + [GF_PROTO_FOP_TRUNCATE] = client_truncate_cbk, + [GF_PROTO_FOP_OPEN] = client_open_cbk, + [GF_PROTO_FOP_READ] = client_readv_cbk, + [GF_PROTO_FOP_WRITE] = client_write_cbk, + [GF_PROTO_FOP_STATFS] = client_statfs_cbk, + [GF_PROTO_FOP_FLUSH] = client_flush_cbk, + [GF_PROTO_FOP_FSYNC] = client_fsync_cbk, + [GF_PROTO_FOP_SETXATTR] = client_setxattr_cbk, + [GF_PROTO_FOP_GETXATTR] = client_getxattr_cbk, + [GF_PROTO_FOP_REMOVEXATTR] = client_removexattr_cbk, + [GF_PROTO_FOP_OPENDIR] = client_opendir_cbk, + [GF_PROTO_FOP_FSYNCDIR] = client_fsyncdir_cbk, + [GF_PROTO_FOP_ACCESS] = client_access_cbk, + [GF_PROTO_FOP_CREATE] = client_create_cbk, + [GF_PROTO_FOP_FTRUNCATE] = client_ftruncate_cbk, + [GF_PROTO_FOP_FSTAT] = client_fstat_cbk, + [GF_PROTO_FOP_LK] = client_lk_common_cbk, + [GF_PROTO_FOP_LOOKUP] = client_lookup_cbk, + [GF_PROTO_FOP_READDIR] = client_readdir_cbk, + [GF_PROTO_FOP_READDIRP] = client_readdirp_cbk, + [GF_PROTO_FOP_INODELK] = client_inodelk_cbk, + [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, + [GF_PROTO_FOP_SETATTR] = client_setattr_cbk, + [GF_PROTO_FOP_FSETATTR] = client_fsetattr_cbk }; static gf_op_t gf_mops[] = { @@ -6089,7 +6036,7 @@ protocol_client_interpret (xlator_t *this, transport_t *trans, switch (type) { case GF_OP_TYPE_FOP_REPLY: - if ((op > GF_FOP_MAXVALUE) || + if ((op > GF_PROTO_FOP_MAXVALUE) || (op < 0)) { gf_log (trans->xl->name, GF_LOG_WARNING, "invalid fop '%d'", op); @@ -6206,6 +6153,8 @@ init (xlator_t *this) conf = GF_CALLOC (1, sizeof (client_conf_t), gf_client_mt_client_conf_t); + protocol_common_init (); + pthread_mutex_init (&conf->mutex, NULL); INIT_LIST_HEAD (&conf->saved_fds); @@ -6698,11 +6647,7 @@ struct xlator_fops fops = { .fxattrop = client_fxattrop, .setattr = client_setattr, .fsetattr = client_fsetattr, -}; - -struct xlator_mops mops = { .getspec = client_getspec, - .log = client_log, }; struct xlator_cbks cbks = { diff --git a/xlators/protocol/lib/src/Makefile.am b/xlators/protocol/lib/src/Makefile.am index d3d1aafe172..53131f6d041 100644 --- a/xlators/protocol/lib/src/Makefile.am +++ b/xlators/protocol/lib/src/Makefile.am @@ -7,9 +7,9 @@ libgfproto_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOU libgfproto_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -lib_LTLIBRARIES = libgfproto.la +lib_LTLIBRARIES = libgfproto.la -libgfproto_la_SOURCES = transport.c authenticate.c +libgfproto_la_SOURCES = transport.c authenticate.c protocol.c noinst_HEADERS = transport.h protocol.h authenticate.h diff --git a/xlators/protocol/lib/src/protocol.c b/xlators/protocol/lib/src/protocol.c new file mode 100644 index 00000000000..63950f43dec --- /dev/null +++ b/xlators/protocol/lib/src/protocol.c @@ -0,0 +1,108 @@ + +#include "globals.h" +#include "compat.h" +#include "protocol.h" + +char *gf_mop_list[GF_MOP_MAXVALUE]; +char *gf_cbk_list[GF_CBK_MAXVALUE]; + +static int +gf_dirent_nb_size (gf_dirent_t *entries) +{ + return (sizeof (struct gf_dirent_nb) + strlen (entries->d_name) + 1); +} + +int +gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size) +{ + struct gf_dirent_nb *entry_nb = NULL; + gf_dirent_t *entry = NULL; + int size = 0; + int entry_size = 0; + + + list_for_each_entry (entry, &entries->list, list) { + entry_size = gf_dirent_nb_size (entry); + + if (buf && (size + entry_size <= buf_size)) { + entry_nb = (void *) (buf + size); + + entry_nb->d_ino = hton64 (entry->d_ino); + entry_nb->d_off = hton64 (entry->d_off); + entry_nb->d_len = hton32 (entry->d_len); + entry_nb->d_type = hton32 (entry->d_type); + + gf_stat_from_iatt (&entry_nb->d_stat, &entry->d_stat); + + strcpy (entry_nb->d_name, entry->d_name); + } + size += entry_size; + } + + return size; +} + + +int +gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size) +{ + struct gf_dirent_nb *entry_nb = NULL; + int remaining_size = 0; + int least_dirent_size = 0; + int count = 0; + gf_dirent_t *entry = NULL; + int entry_strlen = 0; + int entry_len = 0; + + + remaining_size = buf_size; + least_dirent_size = (sizeof (struct gf_dirent_nb) + 2); + + while (remaining_size >= least_dirent_size) { + entry_nb = (void *)(buf + (buf_size - remaining_size)); + + entry_strlen = strnlen (entry_nb->d_name, remaining_size); + if (entry_strlen == remaining_size) { + break; + } + + entry_len = sizeof (gf_dirent_t) + entry_strlen + 1; + entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t); + if (!entry) { + break; + } + + entry->d_ino = ntoh64 (entry_nb->d_ino); + entry->d_off = ntoh64 (entry_nb->d_off); + entry->d_len = ntoh32 (entry_nb->d_len); + entry->d_type = ntoh32 (entry_nb->d_type); + + gf_stat_to_iatt (&entry_nb->d_stat, &entry->d_stat); + + strcpy (entry->d_name, entry_nb->d_name); + + list_add_tail (&entry->list, &entries->list); + + remaining_size -= (sizeof (*entry_nb) + entry_strlen + 1); + count++; + } + + return count; +} + +int +protocol_common_init (void) +{ + gf_mop_list[GF_MOP_SETVOLUME] = "SETVOLUME"; + gf_mop_list[GF_MOP_GETVOLUME] = "GETVOLUME"; + gf_mop_list[GF_MOP_SETSPEC] = "SETSPEC"; + gf_mop_list[GF_MOP_GETSPEC] = "GETSPEC"; + gf_mop_list[GF_MOP_LOG] = "LOG"; + gf_mop_list[GF_MOP_PING] = "PING"; + + gf_cbk_list[GF_CBK_FORGET] = "FORGET"; + gf_cbk_list[GF_CBK_RELEASE] = "RELEASE"; + gf_cbk_list[GF_CBK_RELEASEDIR] = "RELEASEDIR"; + + return 0; +} diff --git a/xlators/protocol/lib/src/protocol.h b/xlators/protocol/lib/src/protocol.h index 6fd291bbebe..254e36e661b 100644 --- a/xlators/protocol/lib/src/protocol.h +++ b/xlators/protocol/lib/src/protocol.h @@ -42,6 +42,89 @@ #define GF_PROTOCOL_VERSION "3.0" +extern char *gf_mop_list[]; +extern char *gf_cbk_list[]; + +/* NOTE: add members ONLY at the end (just before _MAXVALUE) */ +typedef enum { + GF_PROTO_FOP_STAT, /* 0 */ + GF_PROTO_FOP_READLINK, /* 1 */ + GF_PROTO_FOP_MKNOD, /* 2 */ + GF_PROTO_FOP_MKDIR, + GF_PROTO_FOP_UNLINK, + GF_PROTO_FOP_RMDIR, /* 5 */ + GF_PROTO_FOP_SYMLINK, + GF_PROTO_FOP_RENAME, + GF_PROTO_FOP_LINK, + GF_PROTO_FOP_TRUNCATE, + GF_PROTO_FOP_OPEN, /* 10 */ + GF_PROTO_FOP_READ, + GF_PROTO_FOP_WRITE, + GF_PROTO_FOP_STATFS, /* 15 */ + GF_PROTO_FOP_FLUSH, + GF_PROTO_FOP_FSYNC, + GF_PROTO_FOP_SETXATTR, + GF_PROTO_FOP_GETXATTR, + GF_PROTO_FOP_REMOVEXATTR,/* 20 */ + GF_PROTO_FOP_OPENDIR, + GF_PROTO_FOP_GETDENTS, + GF_PROTO_FOP_FSYNCDIR, + GF_PROTO_FOP_ACCESS, + GF_PROTO_FOP_CREATE, /* 25 */ + GF_PROTO_FOP_FTRUNCATE, + GF_PROTO_FOP_FSTAT, + GF_PROTO_FOP_LK, + GF_PROTO_FOP_LOOKUP, + GF_PROTO_FOP_SETDENTS, + GF_PROTO_FOP_READDIR, + GF_PROTO_FOP_INODELK, /* 35 */ + GF_PROTO_FOP_FINODELK, + GF_PROTO_FOP_ENTRYLK, + GF_PROTO_FOP_FENTRYLK, + GF_PROTO_FOP_CHECKSUM, + GF_PROTO_FOP_XATTROP, /* 40 */ + GF_PROTO_FOP_FXATTROP, + GF_PROTO_FOP_LOCK_NOTIFY, + GF_PROTO_FOP_LOCK_FNOTIFY, + GF_PROTO_FOP_FGETXATTR, + GF_PROTO_FOP_FSETXATTR, /* 45 */ + GF_PROTO_FOP_RCHECKSUM, + GF_PROTO_FOP_SETATTR, + GF_PROTO_FOP_FSETATTR, + GF_PROTO_FOP_READDIRP, + GF_PROTO_FOP_MAXVALUE, +} glusterfs_proto_fop_t; + +/* NOTE: add members ONLY at the end (just before _MAXVALUE) */ +typedef enum { + GF_MOP_SETVOLUME, /* 0 */ + GF_MOP_GETVOLUME, /* 1 */ + GF_MOP_STATS, + GF_MOP_SETSPEC, + GF_MOP_GETSPEC, + GF_MOP_PING, /* 5 */ + GF_MOP_LOG, + GF_MOP_NOTIFY, + GF_MOP_MAXVALUE, /* 8 */ +} glusterfs_mop_t; + +typedef enum { + GF_CBK_FORGET, /* 0 */ + GF_CBK_RELEASE, /* 1 */ + GF_CBK_RELEASEDIR, /* 2 */ + GF_CBK_MAXVALUE /* 3 */ +} glusterfs_cbk_t; + +typedef enum { + GF_OP_TYPE_FOP_REQUEST = 1, + GF_OP_TYPE_MOP_REQUEST, + GF_OP_TYPE_CBK_REQUEST, + GF_OP_TYPE_FOP_REPLY, + GF_OP_TYPE_MOP_REPLY, + GF_OP_TYPE_CBK_REPLY +} glusterfs_op_type_t; + + struct gf_stat { uint64_t ino; uint64_t size; @@ -1026,89 +1109,11 @@ struct gf_dirent_nb { char d_name[0]; } __attribute__((packed)); +int +gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size); +int +gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size); -static inline int -gf_dirent_nb_size (gf_dirent_t *entries) -{ - return (sizeof (struct gf_dirent_nb) + strlen (entries->d_name) + 1); -} - -static inline int -gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size) -{ - struct gf_dirent_nb *entry_nb = NULL; - gf_dirent_t *entry = NULL; - int size = 0; - int entry_size = 0; - - - list_for_each_entry (entry, &entries->list, list) { - entry_size = gf_dirent_nb_size (entry); - - if (buf && (size + entry_size <= buf_size)) { - entry_nb = (void *) (buf + size); - - entry_nb->d_ino = hton64 (entry->d_ino); - entry_nb->d_off = hton64 (entry->d_off); - entry_nb->d_len = hton32 (entry->d_len); - entry_nb->d_type = hton32 (entry->d_type); - - gf_stat_from_iatt (&entry_nb->d_stat, &entry->d_stat); - - strcpy (entry_nb->d_name, entry->d_name); - } - size += entry_size; - } - - return size; -} - - -static inline int -gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size) -{ - struct gf_dirent_nb *entry_nb = NULL; - int remaining_size = 0; - int least_dirent_size = 0; - int count = 0; - gf_dirent_t *entry = NULL; - int entry_strlen = 0; - int entry_len = 0; - - - remaining_size = buf_size; - least_dirent_size = (sizeof (struct gf_dirent_nb) + 2); - - while (remaining_size >= least_dirent_size) { - entry_nb = (void *)(buf + (buf_size - remaining_size)); - - entry_strlen = strnlen (entry_nb->d_name, remaining_size); - if (entry_strlen == remaining_size) { - break; - } - - entry_len = sizeof (gf_dirent_t) + entry_strlen + 1; - entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t); - if (!entry) { - break; - } - - entry->d_ino = ntoh64 (entry_nb->d_ino); - entry->d_off = ntoh64 (entry_nb->d_off); - entry->d_len = ntoh32 (entry_nb->d_len); - entry->d_type = ntoh32 (entry_nb->d_type); - - gf_stat_to_iatt (&entry_nb->d_stat, &entry->d_stat); - - strcpy (entry->d_name, entry_nb->d_name); - - list_add_tail (&entry->list, &entries->list); - - remaining_size -= (sizeof (*entry_nb) + entry_strlen + 1); - count++; - } - - return count; -} +int protocol_common_init (void); #endif diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 079b3f2e4c3..b5f90c3a5dc 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -388,7 +388,7 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_LK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -433,7 +433,7 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_INODELK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_INODELK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -480,7 +480,7 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FINODELK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FINODELK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -536,7 +536,7 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_ENTRYLK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_ENTRYLK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -580,7 +580,7 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FENTRYLK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FENTRYLK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -617,7 +617,7 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_ACCESS, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_ACCESS, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -676,7 +676,7 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&rsp->postparent, postparent); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RMDIR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_RMDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -732,7 +732,7 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_MKDIR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_MKDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -788,7 +788,7 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_MKNOD, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_MKNOD, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -832,7 +832,7 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSYNCDIR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FSYNCDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -885,7 +885,7 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_READDIR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_READDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -975,7 +975,7 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); rsp->fd = hton64 (fd_no); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_OPENDIR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_OPENDIR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1016,7 +1016,7 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_statfs_from_statfs (&rsp->statfs, buf); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_STATFS, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_STATFS, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1052,7 +1052,7 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_REMOVEXATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_REMOVEXATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1116,7 +1116,7 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_GETXATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_GETXATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1170,7 +1170,7 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FGETXATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FGETXATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1207,7 +1207,7 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETXATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_SETXATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1234,7 +1234,7 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSETXATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FSETXATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1297,7 +1297,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&rsp->postnewparent, postnewparent); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RENAME, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_RENAME, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1363,7 +1363,7 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&rsp->postparent, postparent); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UNLINK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_UNLINK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1419,7 +1419,7 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SYMLINK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_SYMLINK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1487,7 +1487,7 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LINK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_LINK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1537,7 +1537,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_TRUNCATE, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_TRUNCATE, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1584,7 +1584,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSTAT, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FSTAT, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1633,7 +1633,7 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FTRUNCATE, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FTRUNCATE, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1677,7 +1677,7 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FLUSH, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FLUSH, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1727,7 +1727,7 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&(rsp->poststat), postbuf); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSYNC, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FSYNC, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1809,7 +1809,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_WRITE, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_WRITE, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -1860,7 +1860,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_READ, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_READ, hdr, hdrlen, vector, count, iobref); return 0; @@ -1916,7 +1916,7 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); rsp->fd = hton64 (fd_no); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_OPEN, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_OPEN, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2017,7 +2017,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_iatt (&rsp->postparent, postparent); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CREATE, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_CREATE, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2071,7 +2071,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strcpy (rsp->path, buf); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_READLINK, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_READLINK, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2118,7 +2118,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_STAT, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_STAT, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2168,7 +2168,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_SETATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2218,7 +2218,7 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSETATTR, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FSETATTR, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2341,7 +2341,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LOOKUP, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_LOOKUP, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2404,7 +2404,7 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_XATTROP, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_XATTROP, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -2469,7 +2469,7 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FXATTROP, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_FXATTROP, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -3879,7 +3879,7 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strerror (op_errno)); } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_READDIRP, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_READDIRP, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -5116,7 +5116,7 @@ server_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp->dchecksum[NAME_MAX + NAME_MAX] = '\0'; } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CHECKSUM, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_CHECKSUM, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -5200,7 +5200,7 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp->strong_checksum[MD5_DIGEST_LEN] = '\0'; } - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RCHECKSUM, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_RCHECKSUM, hdr, hdrlen, NULL, 0, NULL); return 0; @@ -5650,7 +5650,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, hdr->rsp.op_errno = hton32 (gf_errno); hdr->rsp.op_ret = -1; - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETDENTS, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_SETDENTS, rsp_hdr, rsp_hdrlen, NULL, 0, NULL); return 0; @@ -5674,7 +5674,7 @@ server_getdents (call_frame_t *frame, xlator_t *bound_xl, hdr->rsp.op_errno = hton32 (gf_errno); hdr->rsp.op_ret = -1; - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_GETDENTS, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_GETDENTS, rsp_hdr, rsp_hdrlen, NULL, 0, NULL); return 0; @@ -5698,7 +5698,7 @@ server_lock_notify (call_frame_t *frame, xlator_t *bound_xl, hdr->rsp.op_errno = hton32 (gf_errno); hdr->rsp.op_ret = -1; - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LOCK_NOTIFY, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_LOCK_NOTIFY, rsp_hdr, rsp_hdrlen, NULL, 0, NULL); return 0; @@ -5722,7 +5722,7 @@ server_lock_fnotify (call_frame_t *frame, xlator_t *bound_xl, hdr->rsp.op_errno = hton32 (gf_errno); hdr->rsp.op_ret = -1; - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_LOCK_FNOTIFY, + protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_PROTO_FOP_LOCK_FNOTIFY, rsp_hdr, rsp_hdrlen, NULL, 0, NULL); return 0; @@ -5901,51 +5901,51 @@ typedef int32_t (*gf_op_t) (call_frame_t *frame, xlator_t *bould_xl, 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, + [GF_PROTO_FOP_STAT] = server_stat, + [GF_PROTO_FOP_READLINK] = server_readlink, + [GF_PROTO_FOP_MKNOD] = server_mknod, + [GF_PROTO_FOP_MKDIR] = server_mkdir, + [GF_PROTO_FOP_UNLINK] = server_unlink, + [GF_PROTO_FOP_RMDIR] = server_rmdir, + [GF_PROTO_FOP_SYMLINK] = server_symlink, + [GF_PROTO_FOP_RENAME] = server_rename, + [GF_PROTO_FOP_LINK] = server_link, + [GF_PROTO_FOP_TRUNCATE] = server_truncate, + [GF_PROTO_FOP_OPEN] = server_open, + [GF_PROTO_FOP_READ] = server_readv, + [GF_PROTO_FOP_WRITE] = server_writev, + [GF_PROTO_FOP_STATFS] = server_statfs, + [GF_PROTO_FOP_FLUSH] = server_flush, + [GF_PROTO_FOP_FSYNC] = server_fsync, + [GF_PROTO_FOP_SETXATTR] = server_setxattr, + [GF_PROTO_FOP_GETXATTR] = server_getxattr, + [GF_PROTO_FOP_FGETXATTR] = server_fgetxattr, + [GF_PROTO_FOP_FSETXATTR] = server_fsetxattr, + [GF_PROTO_FOP_REMOVEXATTR] = server_removexattr, + [GF_PROTO_FOP_OPENDIR] = server_opendir, + [GF_PROTO_FOP_FSYNCDIR] = server_fsyncdir, + [GF_PROTO_FOP_ACCESS] = server_access, + [GF_PROTO_FOP_CREATE] = server_create, + [GF_PROTO_FOP_FTRUNCATE] = server_ftruncate, + [GF_PROTO_FOP_FSTAT] = server_fstat, + [GF_PROTO_FOP_LK] = server_lk, + [GF_PROTO_FOP_LOOKUP] = server_lookup, + [GF_PROTO_FOP_READDIR] = server_readdir, + [GF_PROTO_FOP_READDIRP] = server_readdirp, + [GF_PROTO_FOP_INODELK] = server_inodelk, + [GF_PROTO_FOP_FINODELK] = server_finodelk, + [GF_PROTO_FOP_ENTRYLK] = server_entrylk, + [GF_PROTO_FOP_FENTRYLK] = server_fentrylk, + [GF_PROTO_FOP_CHECKSUM] = server_checksum, + [GF_PROTO_FOP_RCHECKSUM] = server_rchecksum, + [GF_PROTO_FOP_XATTROP] = server_xattrop, + [GF_PROTO_FOP_FXATTROP] = server_fxattrop, + [GF_PROTO_FOP_SETATTR] = server_setattr, + [GF_PROTO_FOP_FSETATTR] = server_fsetattr, + [GF_PROTO_FOP_SETDENTS] = server_setdents, + [GF_PROTO_FOP_GETDENTS] = server_getdents, + [GF_PROTO_FOP_LOCK_NOTIFY] = server_lock_notify, + [GF_PROTO_FOP_LOCK_FNOTIFY] = server_lock_fnotify, }; @@ -5989,7 +5989,7 @@ protocol_server_interpret (xlator_t *this, transport_t *trans, peerinfo = &trans->peerinfo; switch (type) { case GF_OP_TYPE_FOP_REQUEST: - if ((op < 0) || (op >= GF_FOP_MAXVALUE)) { + if ((op < 0) || (op >= GF_PROTO_FOP_MAXVALUE)) { gf_log (this->name, GF_LOG_ERROR, "invalid fop %"PRId32" from client %s", op, peerinfo->identifier); @@ -6529,9 +6529,6 @@ notify (xlator_t *this, int32_t event, void *data, ...) } -struct xlator_mops mops = { -}; - struct xlator_fops fops = { }; diff --git a/xlators/storage/bdb/src/bdb.c b/xlators/storage/bdb/src/bdb.c index fba34ee0450..6104728e3db 100644 --- a/xlators/storage/bdb/src/bdb.c +++ b/xlators/storage/bdb/src/bdb.c @@ -3471,9 +3471,6 @@ fini (xlator_t *this) return; } -struct xlator_mops mops = { - .stats = bdb_stats, -}; struct xlator_fops fops = { .lookup = bdb_lookup, diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c22517f9ecd..4f47ed02758 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4582,9 +4582,6 @@ struct xlator_dumpops dumpops = { .inode = posix_inode, }; -struct xlator_mops mops = { -}; - struct xlator_fops fops = { .lookup = posix_lookup, .stat = posix_stat, -- cgit