From af7e957b4954bd84b8f7df6bfbd59c939092ead2 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 6 Dec 2018 16:24:52 +0530 Subject: xlator: make 'xlator_api' mandatory * Remove the options to load old symbol. * keep only 'xlator_api' symbol from being exported using xlator.sym * add xlator_api to all the xlators where its missing NOTE: This covers all the xlators which has at least a test case to validate its loading. If there is a translator, which doesn't have any test, then we should probably remove that from codebase. fixes: #164 Change-Id: Ibcdc8c9844cda6b4463d907a15813745d14c1ebb Signed-off-by: Amar Tumballi --- xlators/cluster/dht/src/Makefile.am | 14 +++----------- xlators/cluster/dht/src/dht.sym | 9 --------- xlators/cluster/dht/src/nufa.c | 21 ++++++++++++++++----- xlators/cluster/dht/src/nufa.sym | 8 -------- xlators/cluster/dht/src/switch.c | 21 ++++++++++++++++----- xlators/cluster/dht/src/switch.sym | 8 -------- xlators/cluster/ec/src/ec.c | 20 +++++++++++++++++++- xlators/debug/delay-gen/src/delay-gen.c | 17 ++++++++++++++++- xlators/debug/error-gen/src/error-gen.c | 17 ++++++++++++++++- xlators/debug/sink/src/sink.c | 12 ++++++++++++ xlators/debug/trace/src/trace.c | 14 ++++++++++++++ xlators/features/compress/src/cdc.c | 12 ++++++++++++ xlators/features/gfid-access/src/gfid-access.c | 12 ++++++++++++ xlators/features/namespace/src/namespace.c | 13 +++++++++++++ xlators/features/quiesce/src/quiesce.c | 15 +++++++++++++++ xlators/features/quota/src/Makefile.am | 5 +---- xlators/features/quota/src/quotad.c | 22 ++++++++++++++++------ xlators/features/quota/src/quotad.sym | 7 ------- xlators/features/sdfs/src/sdfs.c | 17 ++++++++++++++--- .../features/snapview-client/src/snapview-client.c | 14 ++++++++++++++ .../features/snapview-server/src/snapview-server.c | 13 +++++++++++++ xlators/mgmt/glusterd/src/glusterd.c | 12 ++++++++++++ xlators/nfs/server/src/nfs.c | 19 +++++++++++++++++-- xlators/nfs/server/src/nfsserver.sym | 10 +--------- xlators/xlator.sym | 10 ---------- 25 files changed, 252 insertions(+), 90 deletions(-) delete mode 100644 xlators/cluster/dht/src/dht.sym delete mode 100644 xlators/cluster/dht/src/nufa.sym delete mode 100644 xlators/cluster/dht/src/switch.sym delete mode 100644 xlators/features/quota/src/quotad.sym (limited to 'xlators') diff --git a/xlators/cluster/dht/src/Makefile.am b/xlators/cluster/dht/src/Makefile.am index caeb17b0f07..56f1f2ad7c8 100644 --- a/xlators/cluster/dht/src/Makefile.am +++ b/xlators/cluster/dht/src/Makefile.am @@ -14,19 +14,13 @@ dht_la_SOURCES = $(dht_common_source) dht.c nufa_la_SOURCES = $(dht_common_source) nufa.c switch_la_SOURCES = $(dht_common_source) switch.c -dht_la_LDFLAGS = -module \ - -export-symbols $(top_srcdir)/xlators/cluster/dht/src/dht.sym \ - $(GF_XLATOR_LDFLAGS) +dht_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) dht_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -nufa_la_LDFLAGS = -module \ - -export-symbols $(top_srcdir)/xlators/cluster/dht/src/nufa.sym \ - $(GF_XLATOR_LDFLAGS) +nufa_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) nufa_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -switch_la_LDFLAGS = -module \ - -export-symbols $(top_srcdir)/xlators/cluster/dht/src/switch.sym \ - $(GF_XLATOR_LDFLAGS) +switch_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) switch_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la noinst_HEADERS = dht-common.h dht-mem-types.h dht-messages.h \ @@ -41,8 +35,6 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \ CLEANFILES = -EXTRA_DIST = dht.sym nufa.sym switch.sym - uninstall-local: rm -f $(DESTDIR)$(xlatordir)/distribute.so diff --git a/xlators/cluster/dht/src/dht.sym b/xlators/cluster/dht/src/dht.sym deleted file mode 100644 index 24241a91baf..00000000000 --- a/xlators/cluster/dht/src/dht.sym +++ /dev/null @@ -1,9 +0,0 @@ -xlator_api -fops -cbks -class_methods -dht_methods -options -mem_acct_init -reconfigure -dumpops diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 558611384fe..59313639c45 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -599,11 +599,6 @@ dht_methods_t dht_methods = { .layout_search = dht_layout_search, }; -class_methods_t class_methods = {.init = nufa_init, - .fini = dht_fini, - .reconfigure = dht_reconfigure, - .notify = dht_notify}; - struct xlator_fops fops = { .lookup = nufa_lookup, .create = nufa_create, @@ -645,3 +640,19 @@ struct xlator_fops fops = { }; struct xlator_cbks cbks = {.forget = dht_forget}; +extern int32_t +mem_acct_init(xlator_t *this); + +xlator_api_t xlator_api = { + .init = nufa_init, + .fini = dht_fini, + .notify = dht_notify, + .reconfigure = dht_reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, /* Present from the initial version */ + .fops = &fops, + .cbks = &cbks, + .options = dht_options, + .identifier = "nufa", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/cluster/dht/src/nufa.sym b/xlators/cluster/dht/src/nufa.sym deleted file mode 100644 index 780b5fc0387..00000000000 --- a/xlators/cluster/dht/src/nufa.sym +++ /dev/null @@ -1,8 +0,0 @@ -fops -cbks -class_methods -dht_methods -options -mem_acct_init -reconfigure -dumpops diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index a3c384b0f5c..a782fcdfbd2 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -823,11 +823,6 @@ err: return -1; } -class_methods_t class_methods = {.init = switch_init, - .fini = switch_fini, - .reconfigure = dht_reconfigure, - .notify = dht_notify}; - struct xlator_fops fops = { .lookup = switch_lookup, .create = switch_create, @@ -869,3 +864,19 @@ struct xlator_fops fops = { }; struct xlator_cbks cbks = {.forget = dht_forget}; +extern int32_t +mem_acct_init(xlator_t *this); + +xlator_api_t xlator_api = { + .init = switch_init, + .fini = switch_fini, + .notify = dht_notify, + .reconfigure = dht_reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, /* Present from the initial version */ + .fops = &fops, + .cbks = &cbks, + .options = dht_options, + .identifier = "switch", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/cluster/dht/src/switch.sym b/xlators/cluster/dht/src/switch.sym deleted file mode 100644 index 780b5fc0387..00000000000 --- a/xlators/cluster/dht/src/switch.sym +++ /dev/null @@ -1,8 +0,0 @@ -fops -cbks -class_methods -dht_methods -options -mem_acct_init -reconfigure -dumpops diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index d6336953343..13ffeb96012 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -1666,4 +1666,22 @@ struct volume_options options[] = { "specially for sequential writes. However, this will also" "lead to extra memory consumption, maximum " "(cache size * stripe size) Bytes per open file."}, - {.key = {NULL}}}; + { + .key = {NULL}, + }, +}; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "disperse", + .category = GF_MAINTAINED, +}; diff --git a/xlators/debug/delay-gen/src/delay-gen.c b/xlators/debug/delay-gen/src/delay-gen.c index a2d02527f23..76efacb3044 100644 --- a/xlators/debug/delay-gen/src/delay-gen.c +++ b/xlators/debug/delay-gen/src/delay-gen.c @@ -679,4 +679,19 @@ struct volume_options options[] = { .default_value = "", }, - {.key = {NULL}}}; + {.key = {NULL}}, +}; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {GD_OP_VERSION_3_12_0}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "delay-gen", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 3d271b2ef21..3416d63fa20 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -1644,4 +1644,19 @@ struct volume_options options[] = { .flags = OPT_FLAG_SETTABLE, }, - {.key = {NULL}}}; + {.key = {NULL}}, +}; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "error-gen", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/debug/sink/src/sink.c b/xlators/debug/sink/src/sink.c index 965efd811ae..9822bbb732e 100644 --- a/xlators/debug/sink/src/sink.c +++ b/xlators/debug/sink/src/sink.c @@ -80,3 +80,15 @@ struct xlator_cbks cbks = {}; struct volume_options options[] = { {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .op_version = {GD_OP_VERSION_3_12_0}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "sink", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 0aca3a9a5bb..3db2e263524 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -3520,3 +3520,17 @@ struct volume_options options[] = { }; struct xlator_dumpops dumpops = {.history = trace_dump_history}; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "trace", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/features/compress/src/cdc.c b/xlators/features/compress/src/cdc.c index 19e56b0daa5..b0b51e914ed 100644 --- a/xlators/features/compress/src/cdc.c +++ b/xlators/features/compress/src/cdc.c @@ -334,3 +334,15 @@ struct volume_options options[] = { "to disk as a gzip file."}, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .mem_acct_init = mem_acct_init, + .op_version = {GD_OP_VERSION_3_9_0}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "cdc", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 450f108d16e..4a422ee658c 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -1408,3 +1408,15 @@ struct volume_options options[] = { /* This translator doesn't take any options, or provide any options */ {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "gfid-access", + .category = GF_MAINTAINED, +}; diff --git a/xlators/features/namespace/src/namespace.c b/xlators/features/namespace/src/namespace.c index e56cf248076..59045e8647b 100644 --- a/xlators/features/namespace/src/namespace.c +++ b/xlators/features/namespace/src/namespace.c @@ -1330,3 +1330,16 @@ struct volume_options options[] = { }, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .reconfigure = reconfigure, + .op_version = {GD_OP_VERSION_3_12_0}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "namespace", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c index f1cc648ac4b..abdb901f356 100644 --- a/xlators/features/quiesce/src/quiesce.c +++ b/xlators/features/quiesce/src/quiesce.c @@ -2664,3 +2664,18 @@ struct volume_options options[] = { "the thin clients can failover to."}, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {GD_OP_VERSION_3_12_0}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "quiesce", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/features/quota/src/Makefile.am b/xlators/features/quota/src/Makefile.am index 0ae47fc189f..1c2dcef0ca3 100644 --- a/xlators/features/quota/src/Makefile.am +++ b/xlators/features/quota/src/Makefile.am @@ -4,7 +4,7 @@ endif xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features quota_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) -quotad_la_LDFLAGS = -module -export-symbols $(top_srcdir)/xlators/features/quota/src/quotad.sym $(GF_XLATOR_LDFLAGS) +quotad_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS) quota_la_SOURCES = quota.c quota-enforcer-client.c quota_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ @@ -27,6 +27,3 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \ AM_CFLAGS = -Wall $(GF_CFLAGS) CLEANFILES = - -EXTRA_DIST = quotad.sym - diff --git a/xlators/features/quota/src/quotad.c b/xlators/features/quota/src/quotad.c index cfc74ff6985..ee1a600e60f 100644 --- a/xlators/features/quota/src/quotad.c +++ b/xlators/features/quota/src/quotad.c @@ -220,11 +220,6 @@ err: return ret; } -class_methods_t class_methods = {.init = qd_init, - .fini = qd_fini, - .reconfigure = qd_reconfigure, - .notify = qd_notify}; - struct xlator_fops fops = {}; struct xlator_cbks cbks = {}; @@ -240,4 +235,19 @@ struct volume_options options[] = { .key = {"transport.*"}, .type = GF_OPTION_TYPE_ANY, }, - {.key = {NULL}}}; + {.key = {NULL}}, +}; + +xlator_api_t xlator_api = { + .init = qd_init, + .fini = qd_fini, + .reconfigure = qd_reconfigure, + .notify = qd_notify, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "quotad", + .category = GF_MAINTAINED, +}; diff --git a/xlators/features/quota/src/quotad.sym b/xlators/features/quota/src/quotad.sym deleted file mode 100644 index 0829ffe1584..00000000000 --- a/xlators/features/quota/src/quotad.sym +++ /dev/null @@ -1,7 +0,0 @@ -fops -cbks -class_methods -options -mem_acct_init -reconfigure -dumpops diff --git a/xlators/features/sdfs/src/sdfs.c b/xlators/features/sdfs/src/sdfs.c index 5dbe0653cbc..132f97ca4ea 100644 --- a/xlators/features/sdfs/src/sdfs.c +++ b/xlators/features/sdfs/src/sdfs.c @@ -1425,12 +1425,11 @@ out: return ret; } -int +void fini(xlator_t *this) { mem_pool_destroy(this->local_pool); - - return 0; + return; } struct xlator_fops fops = { @@ -1458,3 +1457,15 @@ struct volume_options options[] = { .description = "Enable/Disable dentry serialize functionality"}, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .reconfigure = reconfigure, + .op_version = {GD_OP_VERSION_4_0_0}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "sdfs", + .category = GF_TECH_PREVIEW, +}; diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c index a0c739f58af..0322ac82f86 100644 --- a/xlators/features/snapview-client/src/snapview-client.c +++ b/xlators/features/snapview-client/src/snapview-client.c @@ -2559,3 +2559,17 @@ struct volume_options options[] = { }, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "snapview-client", + .category = GF_MAINTAINED, +}; diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c index 3c48b067025..9fd2cfb41e6 100644 --- a/xlators/features/snapview-server/src/snapview-server.c +++ b/xlators/features/snapview-server/src/snapview-server.c @@ -2691,3 +2691,16 @@ struct volume_options options[] = { }, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "snapview-server", + .category = GF_MAINTAINED, +}; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index a451e18d343..45f387a0be1 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -2225,3 +2225,15 @@ struct volume_options options[] = { " power. Range 1-32 threads."}, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .mem_acct_init = mem_acct_init, + .op_version = {1}, /* Present from the initial version */ + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "glusterd", + .category = GF_MAINTAINED, +}; diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index ceb4943bc93..3dbe3c7cea1 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -1529,7 +1529,7 @@ notify(xlator_t *this, int32_t event, void *data, ...) return 0; } -int +void fini(xlator_t *this) { struct nfs_state *nfs = NULL; @@ -1539,7 +1539,7 @@ fini(xlator_t *this) gf_msg_debug(GF_NFS, 0, "NFS service going down"); nfs_deinit_versions(&nfs->versions, this); GF_FREE(this->instance_name); - return 0; + return; } int32_t @@ -2040,3 +2040,18 @@ struct volume_options options[] = { }, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "gnfs", + .category = GF_MAINTAINED, +}; diff --git a/xlators/nfs/server/src/nfsserver.sym b/xlators/nfs/server/src/nfsserver.sym index 2126634962a..dce7d964e9e 100644 --- a/xlators/nfs/server/src/nfsserver.sym +++ b/xlators/nfs/server/src/nfsserver.sym @@ -1,12 +1,3 @@ -init -fini -fops -cbks -options -notify -mem_acct_init -reconfigure -dumpops exp_file_parse exp_file_print exp_file_get_dir @@ -18,3 +9,4 @@ ng_file_parse ng_file_get_netgroup ng_file_print ng_file_deinit +xlator_api diff --git a/xlators/xlator.sym b/xlators/xlator.sym index 67f7cdde1c2..76abe95d5b2 100644 --- a/xlators/xlator.sym +++ b/xlators/xlator.sym @@ -1,11 +1 @@ -class_methods xlator_api -init -fini -fops -cbks -options -notify -mem_acct_init -reconfigure -dumpops -- cgit