/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <sys/user.h>
#include <sys/vnode.h>
#endif
+#include <sys/kauth.h>
#include <kern/thread.h>
#ifdef AFS_DARWIN80_ENV
#ifndef AFS_DARWIN80_ENV
#define vnode_clearfsnode(x) ((x)->v_data = 0)
#define vnode_fsnode(x) (x)->v_data
-#define vnode_lock(x) vn_lock(x, LK_EXCLUSIVE | LK_RETRY, current_proc());
+#define vnode_lock(x) vn_lock(x, LK_EXCLUSIVE | LK_RETRY, current_proc())
#define vnode_isvroot(x) (((x)->v_flag & VROOT)?1:0)
#define vnode_vtype(x) (x)->v_type
#define vnode_isdir(x) ((x)->v_type == VDIR)
#define va_atime va_access_time
#define va_mtime va_modify_time
#define va_ctime va_change_time
-#define va_bytes va_total_alloc
+#define va_bytes va_total_alloc
#define va_blocksize va_iosize
#define va_nodeid va_fileid
extern vfs_context_t afs_osi_ctxtp;
extern int afs_osi_ctxtp_initialized;
#endif
+extern u_int32_t afs_darwin_realmodes;
+extern u_int32_t afs_darwin_fsevents;
-/*
+/*
* Time related macros
*/
-#ifndef AFS_DARWIN60_ENV
-extern struct timeval time;
-#endif
#ifdef AFS_DARWIN80_ENV
static inline time_t osi_Time(void) {
struct timeval _now;
#define osi_vnhold(avc,r) VN_HOLD(AFSTOV(avc))
#define VN_HOLD(vp) darwin_vn_hold(vp)
-#define VN_RELE(vp) vrele(vp);
+#define VN_RELE(vp) vrele(vp)
void darwin_vn_hold(struct vnode *vp);
-#ifdef AFS_DARWIN80_ENV
-void darwin_vn_rele(struct vnode *vp);
-#endif
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid),current_proc())
#undef afs_suser
-#ifdef KERNEL
extern thread_t afs_global_owner;
/* simple locks cannot be used since sleep can happen at any time */
#ifdef AFS_DARWIN80_ENV
afs_global_owner = 0; \
lck_mtx_unlock(afs_global_lock); \
} while(0)
+#define osi_InitGlock() \
+ do { \
+ afs_global_owner = 0; \
+ } while (0)
#else
/* Should probably use mach locks rather than bsd locks, since we use the
mach thread control api's elsewhere (mach locks not used for consistency
afs_global_owner = 0; \
lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \
} while(0)
+#define osi_InitGlock() \
+ do { \
+ lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0); \
+ afs_global_owner = 0; \
+ } while (0)
#endif
#define ISAFS_GLOCK() (afs_global_owner == current_thread())
#define USERPRI
#if 0
#undef SPLVAR
-#define SPLVAR int x;
+#define SPLVAR int x
#undef NETPRI
-#define NETPRI x=splnet();
+#define NETPRI x=splnet()
#undef USERPRI
-#define USERPRI splx(x);
+#define USERPRI splx(x)
#endif
#define AFS_APPL_UFS_CACHE 1
#define osi_curproc() current_proc()
/* FIXME */
-#define osi_curcred() &afs_osi_cred
+#define osi_curcred() &afs_osi_cred
#ifdef AFS_DARWIN80_ENV
-uio_t afsio_darwin_partialcopy(uio_t auio, int size);
-
-#define uprintf printf
-#endif
-
-#ifndef AFS_DARWIN80_ENV
-#define ifaddr_address_family(x) (x)->ifa_addr->sa_family
-#define ifaddr_address(x, y, z) memcpy(y, (x)->ifa_addr, z)
-#define ifaddr_netmask(x, y, z) memcpy(y, (x)->ifa_netmask, z)
-#define ifaddr_dstaddress(x, y, z) memcpy(y, (x)->ifa_dstaddr, z)
-#define ifaddr_ifnet(x) (x?(x)->ifa_ifp:0)
-#define ifnet_flags(x) (x?(x)->if_flags:0)
-#define ifnet_metric(x) (x?(x)->if_data.ifi_metric:0)
-/*#define ifnet_mtu(x) (x)->if_mtu*/
-#define ifaddr_withnet(x) ifa_ifwithnet(x)
+# define afsio_free(X) uio_free(X)
+# define afsio_setoffset(X, Y) uio_setoffset(X, Y)
+# define uprintf printf
#endif
/* Vnode related macros */
# define SetAfsVnode(v) /* nothing; done in getnewvnode() */
#endif
-#endif /* KERNEL */
+#ifdef AFS_DARWIN80_ENV
+#define osi_procname(procname, size) proc_selfname(procname, size)
+#else
+#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size)
+#endif
#endif /* _OSI_MACHDEP_H_ */