X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffilesys%2Ffilesys.c;h=7b164380809f5675f7080584801654a416843c2f;hb=382dafd4d52569f887827b468c985879d6f5ea80;hp=28a2f7f046eb748c5946d1b8579699ee9c52b7e6;hpb=2e6303a4b957eb770b0cab4172bd43a7c01c927d;p=pintos-anon diff --git a/src/filesys/filesys.c b/src/filesys/filesys.c index 28a2f7f..7b16438 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 @@ -166,8 +167,7 @@ filesys_create (const char *name, off_t initial_size) if (free_map == NULL) goto done; bitmap_read (free_map, free_map_file); - inode_sector = bitmap_scan_and_flip (free_map, 0, disk_size (filesys_disk), - false); + inode_sector = bitmap_scan_and_flip (free_map, 0, 1, false); if (inode_sector == BITMAP_ERROR) goto done; @@ -198,7 +198,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 * @@ -242,7 +243,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;