|
|
1.1 ! root 1: /* lfclose.c - lfclose */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <proc.h> ! 6: #include <disk.h> ! 7: #include <lfile.h> ! 8: ! 9: /*------------------------------------------------------------------------ ! 10: * lfclose -- close a file by flushing output and freeing device slot ! 11: *------------------------------------------------------------------------ ! 12: */ ! 13: lfclose(devptr) ! 14: struct devsw *devptr; ! 15: { ! 16: struct dsblk *dsptr; ! 17: struct dir *dirptr; ! 18: struct flblk *flptr; ! 19: int diskdev; ! 20: char ps; ! 21: ! 22: disable(ps); ! 23: flptr = (struct flblk *) devptr->dvioblk; ! 24: if (flptr->fl_pid != currpid) { ! 25: restore(ps); ! 26: return(SYSERR); ! 27: } ! 28: diskdev = flptr->fl_dev; ! 29: dsptr = (struct dsblk *)devtab[diskdev].dvioblk; ! 30: dirptr = (struct dir *) dsptr->ddir; ! 31: if ( (flptr->fl_mode & FLWRITE) && flptr->fl_dch) ! 32: lfsflush(flptr); ! 33: flptr->fl_pid = 0; ! 34: dsptr->dnfiles--; ! 35: write(diskdev, dskbcpy(dirptr), DIRBLK); ! 36: restore(ps); ! 37: return(OK); ! 38: } ! 39:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.