|
|
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 flags; /* to 32 bytes */
43: } Inode;
44: #define IPERB (s->blocksize/sizeof(Inode))
45: #define F_NAME 0x0001 /* name is expanded */
46:
47: extern char *openinode(), *lkwri(), *lkwsb();
48: extern char *mapdev();
49: extern Inode *(*inodefn)();
50: extern void (*traversefn)();
51:
52: #define inodeof(s) (*inodefn)(s)
53: #define inodetraverse(fn) (*traversefn)(fn)
54:
55: #define VLINK 1 /* linked list version */
56: #define VBTREE 2 /* cbt */
57:
58: #define NBLKS(s, x) (long)(((s)->blocksize-1+(x))/(s)->blocksize)
59:
60: /*
61: flags for openinode
62: */
63: #define DO_INODE 1
64: #define SPIN_DOWN 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.