OpenAFS
OpenAFS distributed network file system
|
00001 00002 /* 00003 * Copyright 2000, International Business Machines Corporation and others. 00004 * All Rights Reserved. 00005 * 00006 * This software has been released under the terms of the IBM Public 00007 * License. For details, see the LICENSE file in the top-level source 00008 * directory or online at http://www.openafs.org/dl/license10.html 00009 */ 00010 00011 /* 00012 * HPUX OSI header file. Extends afs_osi.h. 00013 * 00014 * afs_osi.h includes this file, which is the only way this file should 00015 * be included in a source file. This file can redefine macros declared in 00016 * afs_osi.h. 00017 */ 00018 00019 #ifndef _OSI_MACHDEP_H_ 00020 #define _OSI_MACHDEP_H_ 00021 00022 #include "h/kern_sem.h" 00023 #include "h/proc_iface.h" 00024 00025 #define afs_hz hz 00026 extern struct timeval time; 00027 #define osi_Time() (time.tv_sec) 00028 00029 typedef struct ucred afs_ucred_t; 00030 typedef proc_t afs_proc_t; 00031 00032 #define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0) 00033 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,aresid) \ 00034 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(aresid),0) 00035 #define gop_lookupname(fnamep,segflg,followlink,compvpp) \ 00036 lookupname((fnamep),(segflg),(followlink),NULL,(compvpp)) 00037 #define gop_lookupname_user(fnamep,segflg,followlink,compvpp) \ 00038 lookupname((fnamep),(segflg),(followlink),NULL,(compvpp)) 00039 00040 #undef afs_suser 00041 00042 #define osi_curcred() (p_cred(u.u_procp)) 00043 00044 #define getpid() (afs_uint32)p_pid(u.u_procp) 00045 00046 #define getppid() (afs_uint32)p_ppid(u.u_procp) 00047 00048 /* 00049 * Global lock support. 00050 * 00051 * HP uses global mutex to protect afs land 00052 */ 00053 00054 #if !defined(AFS_HPUX110_ENV) 00055 extern sema_t afs_global_sema; 00056 #else 00057 extern b_sema_t afs_global_sema; 00058 #endif 00059 00060 extern void osi_InitGlock(void); 00061 00062 #if !defined(AFS_HPUX110_ENV) 00063 extern void afsHash(int nbuckets); 00064 extern sv_sema_t *afsHashInsertFind(tid_t key); 00065 extern sv_sema_t *afsHashFind(tid_t key); 00066 extern void afsHashRelease(tid_t key); 00067 00068 #define AFS_GLOCK_PID kt_tid(u.u_kthreadp) 00069 #define AFS_SAVE_SEMA afsHashInsertFind(AFS_GLOCK_PID) 00070 #define AFS_FIND_SEMA afsHashFind(AFS_GLOCK_PID) 00071 00072 #define AFS_GLOCK() MP_PXSEMA(&afs_global_sema, AFS_SAVE_SEMA) 00073 #define AFS_GUNLOCK() (AFS_ASSERT_GLOCK(), MP_VXSEMA(&afs_global_sema,AFS_FIND_SEMA), (!uniprocessor ? (afsHashRelease(AFS_GLOCK_PID),0) : 0)) 00074 #define ISAFS_GLOCK() (!uniprocessor ? owns_sema(&afs_global_sema):1) 00075 00076 #else 00077 #define AFS_GLOCK() b_psema(&afs_global_sema) 00078 #define AFS_GUNLOCK() b_vsema(&afs_global_sema) 00079 #define ISAFS_GLOCK() b_owns_sema(&afs_global_sema) 00080 00081 #endif 00082 00083 /* Uses splnet only in the SP case */ 00084 #define SPLVAR ulong_t splvar 00085 #define NETPRI NET_SPLNET(splvar) 00086 #define USERPRI NET_SPLX(splvar) 00087 00088 #if !defined(AFS_HPUX110_ENV) 00089 /* 00090 * On HP, the global lock is an alpha semaphore, hence it is automatically 00091 * released and reacquired aroubd a sleep() and wakeup(). 00092 */ 00093 00094 #define afs_osi_Sleep(x) sleep((caddr_t) x,PZERO-2) 00095 #else 00096 /* 00097 * On 11.22 global lock is a beta semaphore, hence we need to 00098 * release and reacquire around sllep and wakeup. We also need to 00099 * use the get_sleep_lock. 00100 * afs_osi_Sleep and afs_osi_Wakeup are defined 00101 */ 00102 void afs_osi_Sleep(void *event); 00103 int afs_osi_Wakeup(void *event); 00104 #endif 00105 00106 #define osi_NullHandle(x) ((x)->proc == (caddr_t) 0) 00107 00108 #if !defined(AFS_HPUX110_ENV) 00109 extern caddr_t kmem_alloc(); 00110 #endif 00111 #if defined(AFS_HPUX1111_ENV) 00112 #include <sys/kthread_iface.h> /* for kt_cred() */ 00113 #endif 00114 00115 /* Expected to be available as a patch from HP */ 00116 /* See section D of the top level README for details */ 00117 #if defined(AFS_HPUX110_ENV) 00118 #include <sys/vfs_vm.h> 00119 #else 00120 #include <vfs_vm.h> 00121 #endif 00122 00123 #define osi_procname(procname, size) strncpy(procname, "", size) 00124 00125 #endif /* _OSI_MACHDEP_H_ */