xv6-65oo2/fs.h

39 lines
688 B
C
Raw Normal View History

// on-disk file system format
2006-08-09 01:09:36 +00:00
#define BSIZE 512 // block size
// sector 1 (2nd sector)
struct superblock{
2006-08-09 01:09:36 +00:00
uint size;
uint nblocks;
uint ninodes;
};
2006-08-08 18:07:37 +00:00
#define NDIRECT 13
struct dinode {
short type;
2006-08-08 18:07:37 +00:00
short major;
short minor;
short nlink;
uint size;
uint addrs[NDIRECT];
};
2006-08-08 18:07:37 +00:00
#define T_DIR 1
#define T_FILE 2
2006-08-08 18:07:37 +00:00
#define T_DEV 3
2006-08-09 01:09:36 +00:00
// sector 0 is unused, sector 1 is superblock, inodes start at sector 2
#define IPB (BSIZE / sizeof(struct dinode))
#define IBLOCK(inum) (inum / IPB + 2) // start of inode
#define BPB (BSIZE*8)
#define BBLOCK(b,ninodes) (b/BPB + (ninodes/IPB) + 3) // start of bitmap
2006-07-21 22:10:40 +00:00
#define DIRSIZ 14
struct dirent {
ushort inum;
2006-07-21 22:10:40 +00:00
char name[DIRSIZ];
};