summaryrefslogtreecommitdiff
path: root/tirpc
diff options
context:
space:
mode:
authorBrendan Heading <brendanheading@gmail.com>2015-10-28 10:36:17 -0400
committerSteve Dickson <steved@redhat.com>2015-10-30 10:53:12 -0400
commita61bc60cdd5fcbdee1bfe6effbdb33c5217960d8 (patch)
tree6439009272d6b07dc230c40e278a8fa090fd5b8b /tirpc
parente9b9af7a07e8008f82b0c89ec2125414c2194dc8 (diff)
downloadti-rpc-a61bc60cdd5fcbdee1bfe6effbdb33c5217960d8.tar.gz
Handle gss auth reference counting internally
The previous implementation of auth_get and auth_put used atomic builtins to allow thread-safe updating of a reference count for the AUTH object. This causes libtirpc not to build on a number of non-mainstream architectures which don't support the atomic builtins. In addition it exposed the feature as macros through a header file, rather than through the ABI, preventing the underlying implementation from being updated. This patch removes the API calls and handles the reference counting/ deallocation of the AUTH object internally. Signed-off-by: Brendan Heading <brendanheading@gmail.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'tirpc')
-rw-r--r--tirpc/rpc/auth.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/tirpc/rpc/auth.h b/tirpc/rpc/auth.h
index e67779c..5f8ea72 100644
--- a/tirpc/rpc/auth.h
+++ b/tirpc/rpc/auth.h
@@ -191,23 +191,8 @@ typedef struct __auth {
} *ah_ops;
void *ah_private;
- int ah_refcnt;
} AUTH;
-static __inline int
-auth_get(AUTH *auth)
-{
- return __sync_add_and_fetch(&auth->ah_refcnt, 1);
-}
-
-static __inline int
-auth_put(AUTH *auth)
-{
- return __sync_sub_and_fetch(&auth->ah_refcnt, 1);
-}
-
-
-
/*
* Authentication ops.
* The ops and the auth handle provide the interface to the authenticators.
@@ -236,19 +221,10 @@ auth_put(AUTH *auth)
#define auth_refresh(auth, msg) \
((*((auth)->ah_ops->ah_refresh))(auth, msg))
-#define AUTH_DESTROY(auth) \
- do { \
- int refs; \
- if ((refs = auth_put((auth))) == 0) \
- ((*((auth)->ah_ops->ah_destroy))(auth));\
- } while (0)
-
-#define auth_destroy(auth) \
- do { \
- int refs; \
- if ((refs = auth_put((auth))) == 0) \
- ((*((auth)->ah_ops->ah_destroy))(auth));\
- } while (0)
+#define AUTH_DESTROY(auth) \
+ ((*((auth)->ah_ops->ah_destroy))(auth));
+#define auth_destroy(auth) \
+ ((*((auth)->ah_ops->ah_destroy))(auth));
#define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \
((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \