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

📄 readme.txt

📁 MINIX操作系统的内核修改补丁
💻 TXT
字号:
MEMBER:Jia Tianqing 5051619053 juppwo@gmail.comXia Jiabin 5060379061 rexpie@gmail.comZhang Hongsheng 5060379098 zhenswx@gmail.comCODE STATUS:Mission accomplishedDESCRIPTION:TASK1:	We implemented the opening, creating, converting(from immediate to regular) and deleting of the immediate files.	We added a flag indicating the file to be immediate.IN fcntl.h:  /* Oflag values for open().  POSIX Table 6-4. */+ #define O_IMMED	       00040	/* open immediate file -rexie */  #define O_CREAT        00100	/* creat file if it doesn't exist */	IN const.h: #define I_TYPE          0170000	/* this field gives inode type */+ #define I_IMMED	  0140000	/* immediate file -rexie */  #define I_SYMBOLIC_LINK 0120000	/* file is a symbolic link */	When a new file is created, we set the file type flag to be immediate. When ever there is reading or writing to one file, we check its file type and perform different strategy to enable both immediate and regular file reading/writing.	The conversion from immediate files to regular files happen when we want to write more than 32 bytes of data into immediate files. First we copy the data out, wipe clean the inode, get a block from free space and map it to the inode, then finally write the data back to the appropriate position on the disk/device.	Also, we managed to make the "cat" command read the immediate files. But vi could not because it does not recognize the I_IMMED flag.TASK2:	We added the system call in FS and made the libraries necessary for the user programs.		In the system call, we obtained the file inode from the path given, using the eat_path and fetch_name call. If there is no match, we return an error code. 		Part one: pids of the processes currently opening the file.	We first consult the filp table to see which entries point to the inode that we have obtained. Once we have that, we can then check the per-process file descriptor tables (struct fproc) to see which processes have pointers to the filp entries that we found in the previous step. For each process that has a file descriptor entry that points to a filp entry that in turn points to our inode, we know that this process currently has the file open.	Part two: block # in a file.	We check the file type and print out a message if it is immediate file or an empty file.	We found a convenient call by the name of read_map. It can locate the block number with respect of the position of an inode. Since we know that a block will not be allocated when there is still free space in the last one, we made sure that a new block is available for every block size(4096 bytes for default value) in a file. So we used a loop to print out all block numbers of a file with the given path.	Thank you very much for the patience.

⌨️ 快捷键说明

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