summaryrefslogtreecommitdiff
path: root/fs.h
blob: a842e64294f354a73500bc5b2545dc0a5defdab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// on-disk file system format

// second sector
struct superblock{
  int nblocks;
  int ninodes;
};

#define NDIRECT 14

// inodes start at the third sector
// and blocks start at (ninodes * sizeof(dinode) + 511) / 512
struct dinode {
  short type;
  short nlink;
  uint size;
  uint addrs[NDIRECT];
};
#define T_DIR 1
#define T_FILE 2

#define IPB (512 / sizeof(struct dinode))

#define DIRSIZ 14

struct dirent {
  ushort inum;
  char name[DIRSIZ];
};