2006-07-21 13:18:04 +00:00
|
|
|
// 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))
|
|
|
|
|
2006-07-21 22:10:40 +00:00
|
|
|
#define DIRSIZ 14
|
|
|
|
|
2006-07-21 13:18:04 +00:00
|
|
|
struct dirent {
|
|
|
|
ushort inum;
|
2006-07-21 22:10:40 +00:00
|
|
|
char name[DIRSIZ];
|
2006-07-21 13:18:04 +00:00
|
|
|
};
|
|
|
|
|