macos104-not-yet-20050511
[openafs.git] / src / afs / afs_osi.h
index 58e4eb9..b2ba0cc 100644 (file)
@@ -48,12 +48,16 @@ struct osi_stat {
 
 struct osi_file {
     afs_int32 size;            /* file size in bytes XXX Must be first field XXX */
+#ifdef AFS_LINUX24_ENV
+    struct file *filp;         /* May need this if we really open the file. */
+#else
 #ifdef AFS_LINUX22_ENV
     struct dentry dentry;      /* merely to hold the pointer to the inode. */
     struct file file;          /* May need this if we really open the file. */
 #else
     struct vnode *vnode;
 #endif
+#endif
 #if    defined(AFS_HPUX102_ENV)
     k_off_t offset;
 #else
@@ -119,25 +123,25 @@ struct afs_osi_WaitHandle {
 /*
  * Vnode related macros
  */
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_DARWIN80_ENV)
+#define vType(vc)               vnode_vtype(AFSTOV(vc))
+#else
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 #define vSetVfsp(vc, vfsp)      AFSTOV(vc)->v_mount = (vfsp)
 #define vSetType(vc, type)      AFSTOV(vc)->v_type = (type)
 #define vType(vc)               AFSTOV(vc)->v_type
-#else
-#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)
-#endif
-
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 extern int (**afs_vnodeop_p) ();
 #define IsAfsVnode(v)      ((v)->v_op == afs_vnodeop_p)
 #define SetAfsVnode(v)     /* nothing; done in getnewvnode() */
 #else
+#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)
 extern struct vnodeops *afs_ops;
 #define        IsAfsVnode(v)       ((v)->v_op == afs_ops)
 #define        SetAfsVnode(v)      (v)->v_op = afs_ops
 #endif
+#endif
 
 #ifdef AFS_SGI65_ENV
 #define        gop_lookupname(fnamep,segflg,followlink,compvpp) \
@@ -186,6 +190,8 @@ typedef struct {
 typedef struct timeval osi_timeval_t;
 #endif /* AFS_SGI61_ENV */
 
+#define osi_getpid()           getpid()
+
 /*
  * osi_ThreadUnique() should yield a value that can be found in ps
  * output in order to draw correspondences between ICL traces and what
@@ -298,6 +304,18 @@ typedef struct timeval osi_timeval_t;
                AFS_GLOCK();                                    \
        } while(0)
 
+#if defined(AFS_DARWIN80_ENV)
+#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
+       do {                                                    \
+           int haveGlock = ISAFS_GLOCK();                      \
+           if (haveGlock)                                      \
+               AFS_GUNLOCK();                                  \
+           uio_setrw((UIO),(RW));                              \
+           CODE = uiomove((SRC),(LEN),(UIO));                  \
+           if (haveGlock)                                      \
+               AFS_GLOCK();                                    \
+       } while(0)
+#else
 #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
@@ -320,6 +338,7 @@ typedef struct timeval osi_timeval_t;
                AFS_GLOCK();                                    \
        } while(0)
 #endif
+#endif /* AFS_DARWIN80_ENV */
 
 #else /* AFS_GLOBAL_SUNLOCK */
 
@@ -338,6 +357,13 @@ typedef struct timeval osi_timeval_t;
            CODE = copyout((SRC),(DST),(LEN));                  \
        } while(0)
 
+#if defined(AFS_DARWIN80_ENV)
+#define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
+       do {                                                    \
+           uio_setrw((UIO),(RW));                              \
+           CODE = uiomove((SRC),(LEN),(UIO));                  \
+       } while(0)
+#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
 #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
@@ -350,9 +376,19 @@ typedef struct timeval osi_timeval_t;
            CODE = uiomove((SRC),(LEN),(RW),(UIO));             \
        } while(0)
 #endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
+#endif /* AFS_DARWIN80_ENV */
 
 #endif /* AFS_GLOBAL_SUNLOCK */
 
+#ifdef AFS_DARWIN80_ENV
+#define AFS_UIO_OFFSET(uio) uio_offset(uio)
+#define AFS_UIO_RESID(uio) uio_resid(uio)
+#else
+#define AFS_UIO_OFFSET(uio) (uio)->uio_offset
+#define AFS_UIO_RESID(uio) (uio)->uio_resid
+#endif
+
+
 /*
  * encapsulation of kernel data structure accesses
  */