|
|
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: main(argc,argv)
11: int argc;
12: char *argv[];
13: {
14: char buf[BSIZE(0)];
15: struct filsys *f;
16: int i;
17:
18: if (argc != 2) {
19: printf("usage: printfs dev\n");
20: exit(1);
21: }
22: fsi = open(argv[1], 0);
23: rdfs(1, buf);
24: f = (struct filsys *)buf;
25:
26: printf("Inode blocks = %d\n", f->s_isize);
27: printf("Total blocks = %d\n", f->s_fsize);
28: printf("Inodes in s_ninode = %d\n", f->s_ninode);
29: for(i = 0; i < NICINOD; i++)
30: if(f->s_inode[i] != 0)
31: printf("%d is %d\n", i, f->s_inode[i]);
32:
33: printf("Flock = %d\n", f->s_flock);
34: printf("ilock = %d\n", f->s_ilock);
35: printf("fmod = %d\n", f->s_fmod);
36: printf("ronly = %d\n", f->s_ronly);
37: printf("Update time = %d\n", f->s_time);
38: printf("Free blocks = %d\n", f->s_tfree);
39: printf("Free inodes = %d\n", f->s_tinode);
40: printf("M = %d\n", f->s_m);
41: printf("N = %d\n", f->s_n);
42: printf("Block size = %d\n", BSIZE(0));
43: }
44:
45: rdfs(bno, bf)
46: daddr_t bno;
47: char *bf;
48: {
49: int n;
50:
51: lseek(fsi, bno*BSIZE(0), 0);
52: n = read(fsi, bf, BSIZE(0));
53: if(n != BSIZE(0)) {
54: printf("read error: %ld\n", bno);
55: exit(1);
56: }
57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.