afs: Cleanup AFS_S390X_ENV statement 93/14993/6
authorCheyenne Wills <cwills@sinenomine.net>
Fri, 3 Jun 2022 19:22:19 +0000 (13:22 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 18 Aug 2022 15:32:27 +0000 (11:32 -0400)
The commit 'Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV' (6329a523f6)
mechanically replaced the multiple versions of the AFS*_LINUXnn_ENV
definitions with non-versioned definitions.  A follow-on commit 'Cleanup
AFS_*LINUX_ENV usage' (cbc18e4b3) refactored code to handle cleaning up
redundant statements or removing dead code.

The clean up in cbc18e4b3 missed a block of preprocessor statements in
osi_probe.c which defined the macros _SS(x) and _SX(x).

Prior to the commit 6329a523f6, these macros performed bit shifting or
masking for the S390X LINUX20 environment.  For S390X LINUX24 or other
platforms the macros just emitted their parameter.

With commit 6329a523f6 the statement:
   #if defined(AFS_S390X_LINUX20_ENV) && !defined(AFS_S390X_LINUX24_ENV)
was replaced with (which dropped support for S390X LINUX20):
   #if defined(AFS_S390X_LINUX_ENV) && !defined(AFS_S390X_LINUX_ENV)

After cleaning up the conditional, the result leaves the definitions for
_SS and _SX as:
   #define _SS(x) (x)
   #define _SX(x) (x)

Which allows further cleanup by removing these macros and just using
their arguments directly.

Change-Id: I7b56c01ffd59e5f0220bf2a29e92a5cd41977b04
Reviewed-on: https://gerrit.openafs.org/14993
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/LINUX/osi_probe.c

index 1b0f830..b7c37bd 100644 (file)
 #define PROBETYPE long
 #endif
 
-#if defined(AFS_S390X_LINUX_ENV) && !defined(AFS_S390X_LINUX_ENV) 
-#define _SS(x) ((x) << 1)
-#define _SX(x) ((x) &~ 1)
-#else
-#define _SS(x) (x)
-#define _SX(x) (x)
-#endif
-
 /* Older Linux doesn't have __user. The sys_read prototype needs it. */
 #ifndef __user
 #define __user
@@ -894,17 +886,17 @@ static int check_table(probectl *P, PROBETYPE *ptr)
     if (i >= 0) return i;
 #endif
 
-    for (x = ptr, i = 0; i < _SS(NR_syscalls); i++, x++) {
+    for (x = ptr, i = 0; i < NR_syscalls; i++, x++) {
 #ifdef OSI_PROBE_DEBUG
        if (probe_debug & 0x0040) {
            for (j = 0; j < 4; j++) {
-               if (_SS(P->debug_ignore_NR[j]) == _SX(i + P->offset)) break;
+               if (P->debug_ignore_NR[j] == i + P->offset) break;
            }
            if (j < 4) continue;
        }
 #endif
        for (j = 0; j < 8; j++) {
-           if (_SS(probe_ignore_syscalls[j]) == _SX(i) + P->offset) break;
+           if (probe_ignore_syscalls[j] == i + P->offset) break;
        }
        if (j < 8) continue;
        if (*x <= ktxt_lower_bound) {
@@ -987,9 +979,9 @@ static void *try(probectl *P, tryctl *T, PROBETYPE *aptr,
        if ((probe_debug & 0x0002) && DEBUG_IN_RANGE(P,ptr))
            printk("<7>try 0x%lx\n", (unsigned long)ptr);
 #endif
-       if (ptr[_SS(T->NR1 - P->offset)] != ip1)        continue;
-       if (ptr[_SS(T->NR2 - P->offset)] != ip2)        continue;
-       if (ip3 && ptr[_SS(T->NR3 - P->offset)] != ip3) continue;
+       if (ptr[T->NR1 - P->offset] != ip1)        continue;
+       if (ptr[T->NR2 - P->offset] != ip2)        continue;
+       if (ip3 && ptr[T->NR3 - P->offset] != ip3) continue;
 
 #ifdef OSI_PROBE_DEBUG
        if (probe_debug & 0x0002)
@@ -1023,7 +1015,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
 
     /* Check zapped syscalls */
     for (i = 1; i < P->n_zapped_syscalls; i++) {
-       if (p[_SS(P->zapped_syscalls[i])] != p[_SS(P->zapped_syscalls[0])]) {
+       if (p[P->zapped_syscalls[i]] != p[P->zapped_syscalls[0]]) {
 #ifdef OSI_PROBE_DEBUG
            if ((probe_debug & 0x0020) && DEBUG_IN_RANGE(P,p))
                printk("<7>check_harder 0x%lx zapped failed i=%d\n", (unsigned long)p, i);
@@ -1035,7 +1027,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
     /* Check unique syscalls */
     for (i = 0; i < P->n_unique_syscalls; i++) {
        for (s = 0; s < NR_syscalls; s++) {
-           if (p[_SS(s)] == p[_SS(P->unique_syscalls[i])]
+           if (p[s] == p[P->unique_syscalls[i]]
                && s != P->unique_syscalls[i]) {
 #ifdef OSI_PROBE_DEBUG
                if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
@@ -1052,7 +1044,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
     ip1 = (unsigned long)(P->verify_fn);
 #endif
 
-    if (ip1 && p[_SS(P->verifyNR - P->offset)] != ip1) {
+    if (ip1 && p[P->verifyNR - P->offset] != ip1) {
 #ifdef OSI_PROBE_DEBUG
        if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
            printk("<7>check_harder 0x%lx verify failed\n", (unsigned long)p);
@@ -1345,7 +1337,7 @@ static int check_table_readable(probectl *P, PROBETYPE *ptr)
     PROBETYPE *next_page;
     int i = 0, delta;
 
-    while (i < _SS(NR_syscalls)) {
+    while (i < NR_syscalls) {
        next_page = (PROBETYPE *)PAGE_ALIGN((unsigned long)(ptr+1));
        delta = next_page - ptr;
        if (!check_access((unsigned long)ptr, 0)) {