summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-internal.h
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2014-11-18 11:08:16 -0500
committerShyamsundar Ranganathan <srangana@redhat.com>2015-01-12 09:16:08 -0800
commitc49a77001bd80affa70d22ba974d8de9e3f0f0cd (patch)
tree15cf68f9bbe72f3d4d00f5ae750e4d8ac980af36 /api/src/glfs-internal.h
parentf839e25a1ee67279c0c59da9d7262728133e8b37 (diff)
api: versioned symbols in libgfapi.so for compatibility
Use versioned symbols to keep libgfapi at libgfapi.so.0.0.0 Revisited to address broken build on Mac OS X See http://review.gluster.org/9036 Rebased to include http://review.gluster.org/#/c/9376/ (glfs_resolve()) but note that gerrit's "Rebase Change" couldn't do it. N.B. noticed that glfs_get_volumeid() decl in glfs.h was missing the __THROW, added it. On systems using ELF and the GNU toolchain, symbol versions are created with a .symver asm operand in the .c source file. Clang is claimed to be compatible with gcc, so we'll pretend for now that this also works with clang. On Mac OS X, aliases are created with __asm "magic" in the .h header file. In the normal case, when both the decl and defn match, that's all that's needed. In our case though the decl and defn don't match --- we have, e.g. a defn such as 'int glfs_foo(...)' and the corresponding decl is 'int pub_glfs_foo(...)'. To make this work we create the necessary aliases in the library at link time with the -alias_list link option. Note that this results in there being pairs of symbols in the .dylib, e.g. _pub_glfs_foo and _glfs_foo$GFAPI_3.4.0. We could use another link option, -unexported_symbols_list to elide the _pub_glfs_* symbols. (And we probably should.) Linux symbol versioning was essentially copied from Solaris; in general I would expect this to "just work" on Solaris, but until someone tries we don't really know. Change-Id: Icb96a3c2d80be7b6d7a6849bb9168f03a947f47c BUG: 1160709 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/9143 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'api/src/glfs-internal.h')
-rw-r--r--api/src/glfs-internal.h68
1 files changed, 51 insertions, 17 deletions
diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h
index 25571f7f11c..684636c360b 100644
--- a/api/src/glfs-internal.h
+++ b/api/src/glfs-internal.h
@@ -18,6 +18,38 @@
#define DEFAULT_REVAL_COUNT 1
+#ifndef GF_DARWIN_HOST_OS
+#ifndef GFAPI_PUBLIC
+#define GFAPI_PUBLIC(sym, ver) /**/
+#endif
+#ifndef GFAPI_PRIVATE
+#define GFAPI_PRIVATE(sym, ver) /**/
+#endif
+#define GFAPI_SYMVER_PUBLIC_DEFAULT(fn, ver) \
+ asm(".symver pub_"STR(fn)", "STR(fn)"@@GFAPI_"STR(ver))
+
+#define GFAPI_SYMVER_PRIVATE_DEFAULT(fn, ver) \
+ asm(".symver priv_"STR(fn)", "STR(fn)"@@GFAPI_PRIVATE_"STR(ver))
+
+#define GFAPI_SYMVER_PUBLIC(fn1, fn2, ver) \
+ asm(".symver pub_"STR(fn1)", "STR(fn2)"@@GFAPI_"STR(ver))
+
+#define GFAPI_SYMVER_PRIVATE(fn1, fn2, ver) \
+ asm(".symver priv_"STR(fn1)", "STR(fn2)"@@GFAPI_PRIVATE_"STR(ver))
+#define STR(str) #str
+#else
+#ifndef GFAPI_PUBLIC
+#define GFAPI_PUBLIC(sym, ver) __asm("_" __STRING(sym) "$GFAPI_" __STRING(ver))
+#endif
+#ifndef GFAPI_PRIVATE
+#define GFAPI_PRIVATE(sym, ver) __asm("_" __STRING(sym) "$GFAPI_PRIVATE_" __STRING(ver))
+#endif
+#define GFAPI_SYMVER_PUBLIC_DEFAULT(fn, dotver) /**/
+#define GFAPI_SYMVER_PRIVATE_DEFAULT(fn, dotver) /**/
+#define GFAPI_SYMVER_PUBLIC(fn1, fn2, dotver) /**/
+#define GFAPI_SYMVER_PRIVATE(fn1, fn2, dotver) /**/
+#endif
+
/*
* syncop_xxx() calls are executed in two ways, one is inside a synctask where
* the executing function will do 'swapcontext' and the other is without
@@ -51,7 +83,7 @@
#define GLFS_LOC_FILL_INODE(oinode, loc, label) do { \
loc.inode = inode_ref (oinode); \
uuid_copy (loc.gfid, oinode->gfid); \
- ret = priv_glfs_loc_touchup (&loc); \
+ ret = glfs_loc_touchup (&loc); \
if (ret != 0) { \
errno = EINVAL; \
goto label; \
@@ -67,7 +99,7 @@
} \
loc.parent = inode_ref (pinode); \
loc.name = path; \
- ret = priv_glfs_loc_touchup (&loc); \
+ ret = glfs_loc_touchup (&loc); \
if (ret != 0) { \
errno = EINVAL; \
goto label; \
@@ -136,10 +168,12 @@ struct glfs_object {
#define GF_MEMPOOL_COUNT_OF_LRU_BUF_T 256
int glfs_mgmt_init (struct glfs *fs);
-void priv_glfs_init_done (struct glfs *fs, int ret);
+void glfs_init_done (struct glfs *fs, int ret)
+ GFAPI_PRIVATE(glfs_init_done, 3.4.0);
int glfs_process_volfp (struct glfs *fs, FILE *fp);
int priv_glfs_resolve (struct glfs *fs, xlator_t *subvol, const char *path,
- loc_t *loc, struct iatt *iatt, int reval);
+ loc_t *loc, struct iatt *iatt, int reval)
+ GFAPI_PRIVATE(glfs_resolve, 3.7.0);
int glfs_lresolve (struct glfs *fs, xlator_t *subvol, const char *path, loc_t *loc,
struct iatt *iatt, int reval);
fd_t *glfs_resolve_fd (struct glfs *fs, xlator_t *subvol, struct glfs_fd *glfd);
@@ -198,9 +232,11 @@ void glfs_fd_destroy (struct glfs_fd *glfd);
struct glfs_fd *glfs_fd_new (struct glfs *fs);
void glfs_fd_bind (struct glfs_fd *glfd);
-xlator_t *priv_glfs_active_subvol (struct glfs *fs);
+xlator_t *glfs_active_subvol (struct glfs *fs)
+ GFAPI_PRIVATE(glfs_active_subvol, 3.4.0);
xlator_t *__glfs_active_subvol (struct glfs *fs);
-void priv_glfs_subvol_done (struct glfs *fs, xlator_t *subvol);
+void glfs_subvol_done (struct glfs *fs, xlator_t *subvol)
+ GFAPI_PRIVATE(glfs_subvol_done, 3.4.0);
inode_t *glfs_refresh_inode (xlator_t *subvol, inode_t *inode);
@@ -213,10 +249,12 @@ int __glfs_cwd_set (struct glfs *fs, inode_t *inode);
int glfs_resolve_base (struct glfs *fs, xlator_t *subvol, inode_t *inode,
struct iatt *iatt);
-int priv_glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
+int glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
const char *origpath, loc_t *loc, struct iatt *iatt,
- int follow, int reval);
-int priv_glfs_loc_touchup (loc_t *loc);
+ int follow, int reval)
+ GFAPI_PRIVATE(glfs_resolve_at, 3.4.0);
+int glfs_loc_touchup (loc_t *loc)
+ GFAPI_PRIVATE(glfs_loc_touchup, 3.4.0);
void glfs_iatt_to_stat (struct glfs *fs, struct iatt *iatt, struct stat *stat);
int glfs_loc_link (loc_t *loc, struct iatt *iatt);
int glfs_loc_unlink (loc_t *loc);
@@ -251,7 +289,8 @@ int glfs_get_volume_info (struct glfs *fs);
NULL : Otherwise.
*/
-struct glfs *priv_glfs_new_from_ctx (glusterfs_ctx_t *ctx);
+struct glfs *glfs_new_from_ctx (glusterfs_ctx_t *ctx)
+ GFAPI_PRIVATE(glfs_new_from_ctx, 3.7.0);
/*
SYNOPSIS
@@ -276,13 +315,8 @@ struct glfs *priv_glfs_new_from_ctx (glusterfs_ctx_t *ctx);
void
*/
-void priv_glfs_free_from_ctx (struct glfs *fs);
+void glfs_free_from_ctx (struct glfs *fs)
+ GFAPI_PRIVATE(glfs_free_from_ctx, 3.7.0);
-#define GFAPI_SYMVER_PUBLIC_DEFAULT(fn, dotver) \
- asm(".symver pub_"STR(fn)", "STR(fn)"@@GFAPI_"STR(dotver))
-
-#define GFAPI_SYMVER_PRIVATE_DEFAULT(fn, dotver) \
- asm(".symver priv_"STR(fn)", "STR(fn)"@@GFAPI_PRIVATE_"STR(dotver))
-#define STR(str) #str
#endif /* !_GLFS_INTERNAL_H */