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;
}
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;
+ }
+ }
+}
#endif
if (!code)
code = rename(pbuffer, tbuffer);
+ if (!code)
+ code = (*ubik_dbase->open) (ubik_dbase, 0);
if (!code)
#endif
/* after data is good, sync disk with correct label */
#endif
if (!code)
code = rename(pbuffer, tbuffer);
+ if (!code)
+ code = (*ubik_dbase->open) (ubik_dbase, 0);
if (!code)
#endif
code = (*ubik_dbase->setlabel) (dbase, file, avers);
tdb->read = uphys_read;
tdb->write = uphys_write;
tdb->truncate = uphys_truncate;
- tdb->open = 0; /* this function isn't used any more */
+ tdb->open = uphys_invalidate; /* this function isn't used any more */
tdb->sync = uphys_sync;
tdb->stat = uphys_stat;
tdb->getlabel = uphys_getlabel;
extern int uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile,
struct ubik_version *aversion);
extern int uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile);
-
+extern void uphys_invalidate(register struct ubik_dbase *adbase,
+ afs_int32 afid);
/* recovery.c */
extern int urecovery_ResetState(void);