X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffilesys%2Ffilesys.c;h=e16c4879e24c7f471f650b5346914387487f6e30;hb=c71e9e2608ce34fdc9abc58fd066de232901392c;hp=59212ca774f3cf64e3878d82a593216bf294101d;hpb=c00124df280431bb3f1fd26ef0f5c863365c6474;p=pintos-anon diff --git a/src/filesys/filesys.c b/src/filesys/filesys.c index 59212ca..e16c487 100644 --- a/src/filesys/filesys.c +++ b/src/filesys/filesys.c @@ -166,7 +166,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_find_and_set (free_map); + inode_sector = bitmap_scan_and_flip (free_map, 0, 1, false); if (inode_sector == BITMAP_ERROR) goto done; @@ -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 *