macos: make the OpenAFS client aware of APFS
[openafs.git] / src / afs / DARWIN / osi_machdep.h
index 6cd6a40..a4f01b3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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
@@ -34,6 +34,7 @@ typedef unsigned short etap_event_t;
 #include <sys/user.h>
 #include <sys/vnode.h>
 #endif
+#include <sys/kauth.h>
 #include <kern/thread.h>
 
 #ifdef AFS_DARWIN80_ENV
@@ -68,7 +69,7 @@ enum vcexcl { EXCL, NONEXCL };
 #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)
@@ -97,7 +98,7 @@ enum vcexcl { EXCL, NONEXCL };
 #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
 
@@ -117,8 +118,10 @@ enum vcexcl { EXCL, NONEXCL };
 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
  */
 #ifdef AFS_DARWIN80_ENV
@@ -140,12 +143,9 @@ typedef struct proc afs_proc_t;
 
 #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())
@@ -205,15 +205,16 @@ extern struct lock__bsd__ afs_global_lock;
 #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 AFS_APPL_HFS_CACHE 2
+#define AFS_APPL_APFS_CACHE 3
 
 extern ino_t VnodeToIno(vnode_t avp);
 extern dev_t VnodeToDev(vnode_t vp);
@@ -223,12 +224,12 @@ extern int igetinode(mount_t vfsp, dev_t dev , ino_t inode, vnode_t *vpp,
 #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
+# define afsio_free(X) uio_free(X)
+# define afsio_setoffset(X, Y) uio_setoffset(X, Y)
+# define uprintf printf
 #endif
 
 /* Vnode related macros */
@@ -249,4 +250,10 @@ extern int (**afs_vnodeop_p) ();
 # define SetAfsVnode(v)     /* nothing; done in getnewvnode() */
 #endif
 
+#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_ */