|
|
1.1 ! root 1: #include "/usr/include/stdio.h" ! 2: #include <sys/param.h> ! 3: #include <sys/ino.h> ! 4: #include <sys/inode.h> ! 5: #include <sys/filsys.h> ! 6: #include <sys/fblk.h> ! 7: #include <sys/dir.h> ! 8: ! 9: int fsi; ! 10: char buf[BSIZE(0)]; ! 11: ! 12: main() ! 13: { ! 14: short *s = (short *)buf; ! 15: int i; ! 16: ! 17: fsi = open("/dev/rsd1a", 2); ! 18: for(i = 0; i < sizeof(buf)/2; i++) ! 19: *s++ = i; ! 20: wrfs(1, buf); ! 21: } ! 22: ! 23: rdfs(bno, bf) ! 24: daddr_t bno; ! 25: char *bf; ! 26: { ! 27: int n; ! 28: ! 29: lseek(fsi, bno*BSIZE(0), 0); ! 30: n = read(fsi, bf, BSIZE(0)); ! 31: if(n != BSIZE(0)) { ! 32: printf("read error: %ld\n", bno); ! 33: exit(1); ! 34: } ! 35: } ! 36: ! 37: wrfs(bno, bf) ! 38: daddr_t bno; ! 39: char *bf; ! 40: { ! 41: int n; ! 42: ! 43: lseek(fsi, bno*BSIZE(0), 0); ! 44: n = write(fsi, bf, BSIZE(0)); ! 45: if(n != BSIZE(0)) { ! 46: printf("write error: %ld\n", bno); ! 47: exit(1); ! 48: } ! 49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.