DEVEL15-kill-ubik-pthread-env-20080718
[openafs.git] / src / ubik / phys.c
index 69153a7..b6d1def 100644 (file)
@@ -23,7 +23,14 @@ RCSID
 #include <netinet/in.h>
 #endif
 #include <sys/stat.h>
+
+/* #ifdef AFS_PTHREAD_ENV */
+#if 0   /* temporary hack - klm */
+/* nothing */
+#else
 #include <lwp.h>
+#endif
+
 #include <lock.h>
 #include <errno.h>
 #include <string.h>
@@ -130,7 +137,7 @@ uphys_close(register int afd)
        return EBADF;
     tfd = fdcache;
     for (i = 0; i < MAXFDCACHE; i++, tfd++) {
-       if (tfd->fd == afd) {
+       if (tfd->fd == afd && tfd->fileID != -10000) {
            tfd->refCount--;
            return 0;
        }
@@ -282,3 +289,20 @@ uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile)
     uphys_close(fd);
     return code;
 }
+
+void
+uphys_invalidate(register struct ubik_dbase *adbase, afs_int32 afid)
+{
+    register int i;
+    register struct fdcache *tfd;
+
+    /* scan file descr cache */
+    for (tfd = fdcache, i = 0; i < MAXFDCACHE; i++, tfd++) {
+       if (afid == tfd->fileID) {
+           tfd->fileID = -10000;
+           if (tfd->fd >= 0 && tfd->refCount == 0)
+               close(tfd->fd);
+           return;
+       }
+    }
+}