|
|
1.1 ! root 1: /* lfseek.c - lfseek */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <disk.h> ! 6: #include <lfile.h> ! 7: #include <dir.h> ! 8: ! 9: /*------------------------------------------------------------------------ ! 10: * lfseek -- seek to a specified position of a file ! 11: *------------------------------------------------------------------------ ! 12: */ ! 13: lfseek(devptr, offset) ! 14: struct devsw *devptr; ! 15: long offset; ! 16: { ! 17: struct flblk *flptr; ! 18: int retcode; ! 19: char ps; ! 20: ! 21: disable(ps); ! 22: flptr = (struct flblk *)devptr->dvioblk; ! 23: if (flptr->fl_mode & FLWRITE) { ! 24: if (flptr->fl_dch) ! 25: lfsflush(flptr); ! 26: } else if (offset > (flptr->fl_dent)->fdlen) { ! 27: restore(ps); ! 28: return(SYSERR); ! 29: } ! 30: flptr->fl_pos = offset; ! 31: retcode = lfsetup(flptr->fl_dev, flptr); ! 32: restore(ps); ! 33: return(retcode); ! 34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.