|
|
1.1 root 1: #include <errno.h>
2:
3: #define SMAGIC 0x21746967
4: #define DMAGIC 0x3A746967
5:
6: typedef struct Superblock
7: {
8: long magic; /* magic number for Superblock */
9: unsigned short blocksize; /* physical size of blocks */
10: short version; /* type of superblock */
11: long nblocks; /* number of blocks on device */
12: long zero; /* first logical data block */
13: long nfree; /* number of free blocks */
14: long ninodes; /* number of inodes */
15: long ninochars; /* number of bytes of inode names */
16: long binodes; /* start of inodes */
17: long nextffree; /* next free file block */
18: long nextsb; /* next superblock */
19: short fd; /* fildes for device (in core) */
20: char vol_id[128]; /* name the disk can be mounted as */
21: char comment[128]; /* comments */
22: long myblock; /* where this superblock is */
23: long nF; /* bytes for .F (VBTREE) */
24: long nT; /* bytes for .T (VBTREE) */
25: long ctime; /* create time for this superblock */
26: } Superblock;
27:
28: typedef struct Inode
29: {
30: long magic; /* magic number for Dirent */
31: long block; /* starting block of file */
32: long nbytes; /* bytes in file */
33: long ctime; /* creation time */
34: union {
35: char *n; /* core - name */
36: long o; /* disk - offset into chars block */
37: } name; /* filename */
38: long pad1; /* to 32 bytes */
39: short mode; /* a la stat */
40: short uid; /* owner */
41: short gid; /* owner */
42: short pad2; /* to 32 bytes */
43: } Inode;
44: #define IPERB (s->blocksize/sizeof(Inode))
45:
46: extern char *openinode(), *lkwri(), *lkwsb();
47: extern char *mapdev();
48: extern Inode *(*inodefn)();
49: extern void (*traversefn)();
50: extern long numinodes;
51: extern long numnamechars;
52: extern char *timenow();
53:
54: #define inodeof(s) (*inodefn)(s)
55: #define inodetraverse(fn) (*traversefn)(fn)
56:
57: #define VLINK 1 /* linked list version */
58: #define VBTREE 2 /* cbt */
59:
60: #define NBLKS(s, x) (long)(((s)->blocksize-1+(x))/(s)->blocksize)
61:
62: /*
63: flags for openinode
64: */
65: #define DO_INODE 1
66: #define SPIN_DOWN 2
67:
68: #define BIGBLOCK (60*1024L) /* max read/write */
69:
70: /*
71: in.c declarations
72: */
73:
74: extern int bad;
75: extern long nbytes;
76: extern long blkdone;
77: extern long nfiles;
78: extern char *argout;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.