initial-darwin-support-20010327
[openafs.git] / src / afs / VNOPS / afs_vnop_write.c
index e73c1f4..49a3d91 100644 (file)
@@ -529,7 +529,15 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
        code = osi_file_uio_rdwr(tfile, &tuio, UIO_WRITE);
        AFS_GLOCK();
 #else
+#if defined(AFS_DARWIN_ENV) 
+        AFS_GUNLOCK();
+        VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
+        code = VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred);
+        VOP_UNLOCK(tfile->vnode, 0, current_proc());
+        AFS_GLOCK();
+#else
        code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, &afs_osi_cred);
+#endif /* AFS_DARWIN_ENV */
 #endif /* AFS_LINUX20_ENV */
 #endif /* AFS_HPUX100_ENV */
 #endif /* AFS_OSF_ENV */
@@ -601,6 +609,9 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
      * If write is implemented via VM, afs_fsync() is called from the high-level
      * write op.
      */
+#ifdef  AFS_DARWIN_ENV
+     if (noLock && (aio & IO_SYNC)) {
+#else 
 #ifdef AFS_HPUX_ENV
     /* On hpux on synchronous writes syncio will be set to IO_SYNC. If
      * we're doing them because the file was opened with O_SYNCIO specified,
@@ -610,6 +621,7 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
 #else
     if (noLock && (aio & FSYNC)) {
 #endif
+#endif
        if (!AFS_NFSXLATORREQ(acred))
            afs_fsync(avc, acred);
     }
@@ -638,7 +650,7 @@ struct vrequest *areq; {
 
 
 
-#if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
 #ifdef AFS_DUX50_ENV
 #define vno_close(X) vn_close((X), 0, NOCRED)
 #elif defined(AFS_DUX40_ENV)