Change bitmap interface, update references.
[pintos-anon] / src / filesys / filesys.c
index 8bd39e80ff52ef82eaf1056117448373daf8b7fa..28a2f7f046eb748c5946d1b8579699ee9c52b7e6 100644 (file)
@@ -131,6 +131,15 @@ filesys_init (bool format)
     PANIC ("can't open root dir file");
 }
 
+/* Shuts down the filesystem module, writing any unwritten data
+   to disk.
+   Currently there's nothing to do.  You'll need to add code here
+   when you implement write-behind caching. */
+void
+filesys_done (void) 
+{
+}
+
 /* Creates a file named NAME with the given INITIAL_SIZE.
    Returns true if successful, false otherwise.
    Fails if a file named NAME already exists,
@@ -157,7 +166,8 @@ 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, disk_size (filesys_disk),
+                                       false);
   if (inode_sector == BITMAP_ERROR)
     goto done;