Unix CM: Simplify #ifdef ladder in lock.h
[openafs.git] / src / afs / lock.h
index 3e22707..853aba0 100644 (file)
  * LICENSED MATERIALS - PROPERTY OF IBM
  */
 
-#if    (defined(AFS_SUN5_ENV)) || defined(AFS_OSF_ENV)
+#if    (defined(AFS_SUN5_ENV))
 #define        AFS_NOBOZO_LOCK
 #endif
 
-#if !defined(AFS_OSF20_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_OSF32_ENV)
-    /* We do not instrument locks on osf20 because the vcache structure
-     ** exceeds the maximim possible limit for a vnode.
-     */
 #define INSTRUMENT_LOCKS
 /* This is the max lock number in use. Please update it if you add any new
  * lock numbers.
  */
 #define MAX_LOCK_NUMBER 780
-#endif
 
 struct afs_bozoLock {
     short count;               /* count of excl locks */
     char flags;                        /* bit 1: is anyone waiting? */
     char spare;                        /* for later */
-    char *proc;                        /* process holding the lock, really a struct proc * */
+    char *proc;                        /* process holding the lock, really an afs_proc_t * */
 };
 #ifndef        AFS_NOBOZO_LOCK
 typedef struct afs_bozoLock afs_bozoLock_t;
@@ -57,17 +52,6 @@ typedef struct afs_bozoLock afs_bozoLock_t;
 
 #define        AFS_BOZONWAITING    1   /* someone is waiting for this lock */
 
-#undef MObtainWriteLock                /* Defined also in ../rx/rx_machdep.h" */
-#undef MReleaseWriteLock
-#define MObtainReadLock(lock)  ObtainReadLock(lock)
-#define MObtainWriteLock(lock,src)     ObtainWriteLock(lock,src)
-#define MObtainSharedLock(lock,src)    ObtainSharedLock(lock,src)
-#define MUpgradeSToWLock(lock,src)     UpgradeSToWLock(lock,src)
-#define MConvertWToSLock(lock) ConvertWToSLock(lock)
-#define MReleaseReadLock(lock) ReleaseReadLock(lock)
-#define MReleaseWriteLock(lock)        ReleaseWriteLock(lock)
-#define MReleaseSharedLock(lock) ReleaseSharedLock(lock)
-
 #define        AFS_RWLOCK_INIT(lock, nm)       Lock_Init(lock)
 #undef LOCK_INIT
 #define        LOCK_INIT(lock, nm)     Lock_Init(lock)
@@ -88,71 +72,59 @@ typedef struct afs_bozoLock afs_bozoLock_t;
 
 #if defined(AFS_SUN57_ENV)
 typedef kthread_t * afs_lock_tracker_t;
-#define MyPidxx (curthread)
-#define MyPidxx2Pid(x) (x ? ttoproc(x)->p_pid : 0)
+# define MyPidxx (curthread)
+# define MyPidxx2Pid(x) (x ? ttoproc(x)->p_pid : 0)
 #elif defined(AFS_SUN5_ENV) || defined(AFS_OBSD_ENV)
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx (curproc->p_pid)
-#define MyPidxx2Pid(x) (x)
-#else
-#if defined(AFS_AIX41_ENV)
+# define MyPidxx (curproc->p_pid)
+# define MyPidxx2Pid(x) (x)
+#elif defined(AFS_AIX41_ENV)
 typedef tid_t afs_lock_tracker_t;
 extern tid_t thread_self();
-#define MyPidxx (thread_self())
-#define MyPidxx2Pid(x) ((afs_int32)(x))
-#else /* AFS_AIX41_ENV */
-#if defined(AFS_HPUX101_ENV)
-#if defined(AFS_HPUX1111_ENV)
+# define MyPidxx (thread_self())
+# define MyPidxx2Pid(x) ((afs_int32)(x))
+#elif defined(AFS_HPUX101_ENV)
+# if defined(AFS_HPUX1111_ENV)
 typedef struct kthread * afs_lock_tracker_t;
-#define MyPidxx (u.u_kthreadp)
-#define MyPidxx2Pid(x) (x ? kt_tid(x) : 0)
-#else
-typedef struct proc * afs_lock_tracker_t;
-#define MyPidxx (u.u_procp)
-#define MyPidxx2Pid(x) (x ? (afs_int32)p_pid(x) : 0)
-#endif
-#else
-#if defined(AFS_SGI64_ENV)
-#if defined(AFS_SGI65_ENV)
+#  define MyPidxx (u.u_kthreadp)
+#  define MyPidxx2Pid(x) (x ? kt_tid(x) : 0)
+# else
+typedef afs_proc_t * afs_lock_tracker_t;
+#  define MyPidxx (u.u_procp)
+#  define MyPidxx2Pid(x) (x ? (afs_int32)p_pid(x) : 0)
+# endif
+#elif defined(AFS_SGI64_ENV)
+# if defined(AFS_SGI65_ENV)
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx proc_pid(curproc())
-#define MyPidxx2Pid(x) (x)
-#else
+#  define MyPidxx proc_pid(curproc())
+#  define MyPidxx2Pid(x) (x)
+# else
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx current_pid()
-#define MyPidxx2Pid(x) (x)
-#endif
-#else /* AFS_SGI64_ENV */
-#ifdef AFS_LINUX20_ENV
+#  define MyPidxx current_pid()
+#  define MyPidxx2Pid(x) (x)
+# endif
+#elif defined(AFS_LINUX20_ENV)
 typedef struct task_struct * afs_lock_tracker_t;
-#define MyPidxx (current)
-#define MyPidxx2Pid(x) (x? (x)->pid : 0)
-#else
-#if defined(AFS_DARWIN_ENV)
-#if defined(AFS_DARWIN80_ENV)
+# define MyPidxx (current)
+# define MyPidxx2Pid(x) (x? (x)->pid : 0)
+#elif defined(AFS_DARWIN_ENV)
+# if defined(AFS_DARWIN80_ENV)
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx (proc_selfpid())
-#define MyPidxx2Pid(x) (x)
-#else
+#  define MyPidxx (proc_selfpid())
+#  define MyPidxx2Pid(x) (x)
+# else
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx (current_proc()->p_pid )
-#define MyPidxx2Pid(x) (x)
-#endif
-#else
-#if defined(AFS_FBSD_ENV)
+#  define MyPidxx (current_proc()->p_pid )
+#  define MyPidxx2Pid(x) (x)
+# endif
+#elif defined(AFS_FBSD_ENV)
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx (curproc->p_pid )
-#define MyPidxx2Pid(x) (x)
+# define MyPidxx (curproc->p_pid )
+# define MyPidxx2Pid(x) (x)
 #else
 typedef unsigned int afs_lock_tracker_t;
-#define MyPidxx (u.u_procp->p_pid )
-#define MyPidxx2Pid(x) (x)
-#endif /* AFS_FBSD_ENV */
-#endif /* AFS_DARWIN_ENV */
-#endif /* AFS_LINUX20_ENV */
-#endif /* AFS_SGI64_ENV */
-#endif /* AFS_HPUX101_ENV */
-#endif /* AFS_AIX41_ENV */
+# define MyPidxx (u.u_procp->p_pid )
+# define MyPidxx2Pid(x) (x)
 #endif
 
 /* all locks wait on excl_locked except for READ_LOCK, which waits on readers_reading */