OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/afs/AIX/osi_machdep.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 /*
00011  * AIX OSI header file. Extends afs_osi.h.
00012  *
00013  * afs_osi.h includes this file, which is the only way this file should
00014  * be included in a source file. This file can redefine macros declared in
00015  * afs_osi.h.
00016  */
00017 
00018 #ifndef _OSI_MACHDEP_H_
00019 #define _OSI_MACHDEP_H_
00020 
00021 
00022 #undef osi_ThreadUnique
00023 #define osi_ThreadUnique()      thread_self()
00024 
00025 #define afs_hz      HZ
00026 extern long time;
00027 #define osi_Time() (time)
00028 
00029 typedef struct ucred afs_ucred_t;
00030 typedef struct proc afs_proc_t;
00031 
00032 #define afs_bufferpages v.v_bufhw
00033 
00034 #define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while (0)
00035 
00036 #undef gop_lookupname
00037 #define gop_lookupname(fnamep,segflg,followlink,compvpp) \
00038         lookupvp((fnamep), (followlink), (compvpp), &afs_osi_cred)
00039 
00040 #undef gop_lookupname_user
00041 #define gop_lookupname_user(fnamep,segflg,followlink,compvpp) \
00042         lookupvp((fnamep), (followlink), (compvpp), &afs_osi_cred)
00043 
00044 #undef afs_suser
00045 
00046 #undef setuerror
00047 #undef getuerror
00048 /* #undef getpid                getpid() provided by native kernel */
00049 #include <ulimit.h>
00050 #define get_ulimit()            (ulimit(GET_FSIZE, 0) << UBSHIFT)
00051 
00052 #include <sys/lockl.h>
00053 #include <sys/lock_def.h>
00054 #include <sys/lock_alloc.h>
00055 #include <sys/sleep.h>
00056 
00057 extern simple_lock_data afs_global_lock;
00058 #define AFS_GLOCK()     do {                                            \
00059                             if (lock_mine((void *)&afs_global_lock))    \
00060                                 osi_Panic("AFS_GLOCK %s %d",            \
00061                                           __FILE__, __LINE__);          \
00062                             simple_lock((void *)&afs_global_lock);      \
00063                         } while(0)
00064 #define AFS_GUNLOCK()   do {                                            \
00065                             if (!lock_mine((void *)&afs_global_lock))   \
00066                                 osi_Panic("AFS_GUNLOCK %s %d",          \
00067                                           __FILE__, __LINE__);          \
00068                             simple_unlock((void *)&afs_global_lock);    \
00069                         } while(0)
00070 #define ISAFS_GLOCK()   lock_mine((void *)&afs_global_lock)
00071 
00072 #if defined(AFS_AIX41_ENV)
00073 #define osi_InitGlock() \
00074         do {                                                            \
00075             lock_alloc((void *)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1); \
00076             simple_lock_init((void *)&afs_global_lock);                 \
00077         } while(0)
00078 #else
00079 #define osi_InitGlock() \
00080         mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL)
00081 #endif
00082 
00083 /* Reading the current proc name from kernelspace is difficult. It is
00084  * probably possible via indexing into v.vb_proc, but for now don't bother.
00085  * To actually obtain the proc name, look at afs_procsize_init and
00086  * src/afs/AIX/osi_gcpags.c for how to look at the process list */
00087 #define osi_procname(procname, size) strncpy(procname, "", size)
00088 
00089 #endif /* _OSI_MACHDEP_H_ */
 All Data Structures Files Functions Variables