#define _AFS_OSI_
#include "h/types.h"
+#if !defined(AFS_LINUX26_ENV)
#include "h/param.h"
+#endif
#ifdef AFS_FBSD_ENV
#include <sys/condvar.h>
#endif
-#ifdef AFS_SGI_ENV
-#include "sys/sema.h" /* for kcondvar_t */
-#endif
-
#ifdef AFS_NBSD_ENV
#include <sys/lock.h>
#endif
#define osi_NPACKETS 20 /* number of cluster pkts to alloc */
-/*
- * Various definitions for osi_sleep and its event hash table
- * DFBSD and SUNOS have no osi_sleep, and HPUX has its own hack for this stuff
- */
-#define AFS_EVHASHSIZE 128 /* size of afs_evhasht, must be power of 2 */
-typedef struct afs_event {
- struct afs_event *next; /* next in hash chain */
- char *event; /* lwp event: an address */
- int refcount; /* Is it in use? */
- int seq; /* Sequence number: this is incremented
- * by wakeup calls; wait will not return until
- * it changes */
-#if defined(AFS_AIX_ENV)
- tid_t cond;
-#elif defined(AFS_DARWIN_ENV)
-#ifdef AFS_DARWIN80_ENV
- lck_mtx_t *lck;
- thread_t owner;
-#endif
- /* no cond member */
-#elif defined(AFS_FBSD_ENV) || defined(AFS_OBSD_ENV)
- int cond; /* "all this gluck should probably be replaced by CVs" */
-#elif defined(AFS_LINUX_ENV) || defined(AFS_LINUX24_ENV)
- wait_queue_head_t cond;
-#elif defined(AFS_NBSD_ENV) || defined(AFS_SOLARIS_ENV) || defined(AFS_SGI_ENV)
- kcondvar_t cond; /* Currently associated condition variable */
-#endif
-} afs_event_t;
-extern afs_event_t *afs_evhasht[AFS_EVHASHSIZE]; /* Hash table for events */
-extern void shutdown_osisleep(void);
/*
* Darwin, all of the BSDs, and Linux have their own
*/
#if !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_LINUX20_ENV)
-# define vType(vc) (vc)->v.v_type
-# define vSetType(vc,type) (vc)->v.v_type = (type)
-# define vSetVfsp(vc,vfsp) (vc)->v.v_vfsp = (vfsp)
+# define vType(vc) AFSTOV(vc)->v_type
+# define vSetType(vc,type) AFSTOV(vc)->v_type = (type)
+# define vSetVfsp(vc,vfsp) AFSTOV(vc)->v_vfsp = (vfsp)
extern struct vnodeops *afs_ops;
# define IsAfsVnode(v) ((v)->v_op == afs_ops)
# define SetAfsVnode(v) (v)->v_op = afs_ops
extern void osi_PostPopulateVCache(struct vcache *);
extern void osi_AttachVnode(struct vcache *, int seq);
+/**
+ * Increment the refcount on the given vcache.
+ *
+ * @retval 0 Success
+ * @retval nonzero Error obtaining reference; the vcache is no longer valid and
+ * the caller should act as if it doesn't exist.
+ */
+extern int osi_vnhold(struct vcache *);
+
/*
* In IRIX 6.5 and NetBSD we cannot have DEBUG turned on since certain
* system-defined structures are a different size with DEBUG on, the
* In 64 bit HP-UX the timeval structure has a 64 bit member.
*/
-#if defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64))
+#if defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_LINUX26_ENV) && !defined(HAVE_LINUX_TIME_T)) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64))
typedef struct {
afs_int32 tv_sec;
afs_int32 tv_usec;
#ifdef AFS_FBSD_ENV
/* should use curthread, but 'ps' can't display it */
#define osi_ThreadUnique() (curproc->p_pid)
-#elif defined(AFS_LINUX_ENV)
-#define osi_ThreadUnique() (current->pid)
#elif defined(UKERNEL)
#define osi_ThreadUnique() osi_getpid()
#else
/* On an MP that uses multithreading, splnet is not sufficient to provide
* mutual exclusion because the other processors will not see it. On some
- * early multiprocessors (SunOS413 & SGI5.2) splnet actually obtains a global
+ * early multiprocessors (SGI5.2) splnet actually obtains a global
* mutex, which this works in the UP expected way, it means that the whole MP
* can only take one interrupt at a time; a serious performance penalty. */
* (Also, of course, the vnode is assumed to be one of ours. Can't use this
* macro for V-file vnodes.)
*/
-/* osi_vnhold is defined in PLATFORM/osi_machdep.h */
-#define AFS_FAST_HOLD(vp) osi_vnhold((vp), 0)
-
#ifdef AFS_AIX_ENV
#define AFS_FAST_RELE(vp) VREFCOUNT_DEC(vp)
#else
#define osi_curcred() (u.u_cred)
#endif
+#ifdef AFS_PAG_ONEGROUP_ENV
+#define AFS_NUMPAGGROUPS 1
+#else
+#define AFS_NUMPAGGROUPS 2
+#endif
+
#endif /* _AFS_OSI_ */