37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
// TODO: CHECK/REPLACE/UPDATE OLD CODE (this file is based on xv6)
|
|
// On-disk file system format.
|
|
// Both the kernel and user programs use this header file.
|
|
|
|
|
|
#define ROOTINO 1 // root i-number
|
|
#define BSIZE 4096 // 1024 // block size
|
|
|
|
// Disk layout:
|
|
// [ boot block | super block | log | inode blocks |
|
|
// free bit map | data blocks]
|
|
//
|
|
// mkfs computes the super block and builds an initial file system. The
|
|
// super block describes the disk layout
|
|
|
|
#define FSMAGIC 0x10203040
|
|
|
|
#define NDIRECT 12
|
|
#define NINDIRECT (BSIZE / sizeof(uint))
|
|
#define MAXFILE (NDIRECT + NINDIRECT)
|
|
|
|
// Inodes per block. TODO: This stuff will gradually be replaced with calculations on configurable values. -Zak
|
|
#define IPB (BSIZE / sizeof(fsformat_inode_t))
|
|
|
|
// Block containing inode i
|
|
//#define IBLOCK(i, sb) ((i) / IPB + (sb)->inodestart)
|
|
|
|
// Bitmap bits per block
|
|
#define BPB (BSIZE*8)
|
|
|
|
// Block of free map containing bit for block b
|
|
//#define BBLOCK(b, sb) ((b)/BPB + (sb)->bmapstart)
|
|
|
|
// Directory is a file containing a sequence of dirent structures.
|
|
#define DIRSIZ 14
|
|
|