Xv6 with picoc & Linkage editor
v1.0
The project delineate mutual cohesion between c library, linkage editor ( linker), interpreter and operating system by porting the same on xv6 kernel
|
00001 // On-disk file system format. 00002 // Both the kernel and user programs use this header file. 00003 00004 // Block 0 is unused. 00005 // Block 1 is super block. 00006 // Blocks 2 through sb.ninodes/IPB hold inodes. 00007 // Then free bitmap blocks holding sb.size bits. 00008 // Then sb.nblocks data blocks. 00009 // Then sb.nlog log blocks. 00010 00011 #define ROOTINO 1 // root i-number 00012 #define BSIZE 512 // block size 00013 00014 // File system super block 00015 struct superblock { 00016 uint size; // Size of file system image (blocks) 00017 uint nblocks; // Number of data blocks 00018 uint ninodes; // Number of inodes. 00019 uint nlog; // Number of log blocks 00020 }; 00021 00022 #define NDIRECT 12 00023 #define NINDIRECT (BSIZE / sizeof(uint)) 00024 #define NDINDIRECT (NINDIRECT * NINDIRECT) //+changed 00025 #define MAXFILE (NDIRECT + NINDIRECT + NDINDIRECT) //*changed 00026 00027 // On-disk inode structure 00028 struct dinode { 00029 short type; // File type 00030 short major; // Major device number (T_DEV only) 00031 short minor; // Minor device number (T_DEV only) 00032 short nlink; // Number of links to inode in file system 00033 uint size; // Size of file (bytes) 00034 uint addrs[NDIRECT+1]; // Data block addresses *changes made 00035 }; 00036 00037 // Inodes per block. 00038 #define IPB (BSIZE / sizeof(struct dinode)) 00039 00040 // Block containing inode i 00041 #define IBLOCK(i) ((i) / IPB + 2) 00042 00043 // Bitmap bits per block 00044 #define BPB (BSIZE*8) 00045 00046 // Block containing bit for block b 00047 #define BBLOCK(b, ninodes) (b/BPB + (ninodes)/IPB + 3) 00048 00049 // Directory is a file containing a sequence of dirent structures. 00050 #define DIRSIZ 14 00051 00052 struct dirent { 00053 ushort inum; 00054 char name[DIRSIZ]; 00055 }; 00056