⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs.h

📁 美国mit操作系统课程所用的一个教学操作系统xv6
💻 H
字号:
// On-disk file system format. // Both the kernel and user programs use this header file.// Block 0 is unused.// Block 1 is super block.// Inodes start at block 2.#define BSIZE 512  // block size// File system super blockstruct superblock {  uint size;         // Size of file system image (blocks)  uint nblocks;      // Number of data blocks  uint ninodes;      // Number of inodes.};#define NADDRS (NDIRECT+1)#define NDIRECT 12#define INDIRECT 12#define NINDIRECT (BSIZE / sizeof(uint))#define MAXFILE (NDIRECT  + NINDIRECT)// On-disk inode structurestruct dinode {  short type;           // File type  short major;          // Major device number (T_DEV only)  short minor;          // Minor device number (T_DEV only)  short nlink;          // Number of links to inode in file system  uint size;            // Size of file (bytes)  uint addrs[NADDRS];   // Data block addresses};#define T_DIR  1   // Directory#define T_FILE 2   // File#define T_DEV  3   // Special device// Inodes per block.#define IPB           (BSIZE / sizeof(struct dinode))// Block containing inode i#define IBLOCK(i)     ((i) / IPB + 2)// Bitmap bits per block#define BPB           (BSIZE*8)// Block containing bit for block b#define BBLOCK(b, ninodes) (b/BPB + (ninodes)/IPB + 3)// Directory is a file containing a sequence of dirent structures.#define DIRSIZ 14struct dirent {  ushort inum;  char name[DIRSIZ];};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -