diff --git a/c/isgenq.c b/c/isgenq.c index 2d2e39012..af1a42f55 100644 --- a/c/isgenq.c +++ b/c/isgenq.c @@ -14,15 +14,12 @@ #include #include #include -#include #else #include #include -#include #endif #include "zowetypes.h" -#include "alloc.h" #include "isgenq.h" @@ -32,21 +29,7 @@ int isgenqTryExclusiveLock(const QName *qname, ENQToken *token, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -78,23 +61,20 @@ int isgenqTryExclusiveLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(*token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) - : "r1", "r2", "r14" + : "r1", "r2", "r14" ); if (reasonCode != NULL) { *reasonCode = rsn; } - *token = mem31->token; - - FREE_STRUCT31(mem31); return rc; } @@ -105,21 +85,7 @@ int isgenqGetExclusiveLock(const QName *qname, ENQToken *token, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -151,13 +117,13 @@ int isgenqGetExclusiveLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(*token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -165,9 +131,6 @@ int isgenqGetExclusiveLock(const QName *qname, if (reasonCode != NULL) { *reasonCode = rsn; } - *token = mem31->token; - - FREE_STRUCT31(mem31); return rc; } @@ -178,21 +141,7 @@ int isgenqTrySharedLock(const QName *qname, ENQToken *token, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -224,13 +173,13 @@ int isgenqTrySharedLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(*token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -238,9 +187,6 @@ int isgenqTrySharedLock(const QName *qname, if (reasonCode != NULL) { *reasonCode = rsn; } - *token = mem31->token; - - FREE_STRUCT31(mem31); return rc; } @@ -251,21 +197,7 @@ int isgenqGetSharedLock(const QName *qname, ENQToken *token, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -297,13 +229,13 @@ int isgenqGetSharedLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(*token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -311,9 +243,6 @@ int isgenqGetSharedLock(const QName *qname, if (reasonCode != NULL) { *reasonCode = rsn; } - *token = mem31->token; - - FREE_STRUCT31(mem31); return rc; } @@ -323,21 +252,8 @@ int isgenqTestLock(const QName *qname, uint8_t scope, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + ENQToken token; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -367,13 +283,13 @@ int isgenqTestLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -382,8 +298,6 @@ int isgenqTestLock(const QName *qname, *reasonCode = rsn; } - FREE_STRUCT31(mem31); - return rc; } @@ -401,21 +315,8 @@ int isgenqTestSharedLock(const QName *qname, uint8_t scope, int *reasonCode) { - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - QName qname; - RName rname; - ENQToken token; - uint8_t scope; - char padding[7]; - char parmList[200]; - ) - ); - - mem31->qname = *qname; - mem31->rname = *rname; - mem31->scope = scope; + ENQToken token; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -445,13 +346,13 @@ int isgenqTestSharedLock(const QName *qname, " DROP \n" " POP USING \n" - : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) + : [token]"=m"(token), [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [qname]"m"(mem31->qname.value), - [rname]"m"(mem31->rname.value), - [rname_len]"m"(mem31->rname.length), - [scope]"m"(mem31->scope), [token]"m"(mem31->token), - [parmlist]"m"(mem31->parmList) + : [qname]"m"(qname->value), + [rname]"m"(rname->value), + [rname_len]"m"(rname->length), + [scope]"m"(scope), + [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -460,22 +361,12 @@ int isgenqTestSharedLock(const QName *qname, *reasonCode = rsn; } - FREE_STRUCT31(mem31); - return rc; } -int isgenqReleaseLock(ENQToken *token, int *reasonCode) { - - ALLOC_STRUCT31( - STRUCT31_NAME(mem31), - STRUCT31_FIELDS( - ENQToken token; - char parmList[200]; - ) - ); +int isgenqReleaseLock(const ENQToken *token, int *reasonCode) { - mem31->token = *token; + char parmList[200]; int rc = 0, rsn = 0; __asm( @@ -499,7 +390,7 @@ int isgenqReleaseLock(ENQToken *token, int *reasonCode) { : [rc]"=NR:r15"(rc), [rsn]"=NR:r0"(rsn) - : [token]"m"(mem31->token), [parmlist]"m"(mem31->parmList) + : [token]"m"(*token), [parmlist]"m"(parmList) : "r1", "r2", "r14" ); @@ -507,7 +398,6 @@ int isgenqReleaseLock(ENQToken *token, int *reasonCode) { if (reasonCode != NULL) { *reasonCode = rsn; } - *token = mem31->token; return rc; } diff --git a/h/isgenq.h b/h/isgenq.h index 753f7ecbb..0d6584445 100644 --- a/h/isgenq.h +++ b/h/isgenq.h @@ -184,7 +184,7 @@ int isgenqTestLock(const QName *qname, * @param reasonCode Reason code from ISGENQ * @return Return code from ISGENQ */ -int isgenqReleaseLock(ENQToken *token, int *reasonCode); +int isgenqReleaseLock(const ENQToken *token, int *reasonCode); #define IS_ISGENQ_LOCK_OBTAINED($isgenqRC, $isgenqRSN) \ ($isgenqRC <= 4 && ((unsigned)$isgenqRSN & 0xFFFF) != 0x0404)