X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Ffilesys%2Ffilesys.c;h=6a763fecdb60e8e8b323e0d706c20b7ea6549e43;hb=1d50ca8650fb96c13add16ef5659cc7aa6d4ab4b;hp=05df4cef911ce96547c4b9377b8338095b810de7;hpb=170cd194261030e62b40ccc913cdca9cdf7bc2af;p=pintos-anon diff --git a/src/filesys/filesys.c b/src/filesys/filesys.c index 05df4ce..6a763fe 100644 --- a/src/filesys/filesys.c +++ b/src/filesys/filesys.c @@ -38,10 +38,11 @@ /* Filesystem. - For the purposes of the "user processes" assignment (project - 2), please treat all the code in the filesys directory as a - black box. No changes should be needed. For that project, a - single lock external to the filesystem code suffices. + For the purposes of the "user processes" and "virtual memory" + assignments (projects 2 and 3), please treat all the code in + the filesys directory as a black box. No changes should be + needed. For those projects, a single lock external to the + filesystem code suffices. The filesystem consists of a set of files. Each file has a header called an `index node' or `inode', represented by @@ -73,10 +74,9 @@ directory is represented as a file, the number of files that may be created is also limited. - - No indirect blocks. This limits maximum file size to the - number of sector pointers that fit in a single inode - times the size of a sector, or 126 * 512 == 63 kB given - 32-bit sizes and 512-byte sectors. + - File data is allocated as a single extent, so that + external fragmentation can become a serious problem as a + file system is used over time. - No subdirectories. @@ -197,7 +197,8 @@ filesys_create (const char *name, off_t initial_size) /* Opens a file named NAME and initializes FILE for usage with the file_*() functions declared in file.h. - Returns true if successful, false on failure. + Returns the new file if successful or a null pointer + otherwise. Fails if no file named NAME exists, or if an internal memory allocation fails. */ struct file * @@ -241,7 +242,7 @@ filesys_remove (const char *name) if (!dir_lookup (dir, name, &inode_sector)) goto done; - /* Open the inode and delete it it. */ + /* Open the inode and delete it. */ inode = inode_open (inode_sector); if (inode == NULL) goto done;