Comment.
[pintos-anon] / src / filesys / inode.c
index dbec4b900ef882128ef1aefd1133b70ab8396fd1..5ca91f157449b80c2afd29a1f00991da730d7fcd 100644 (file)
@@ -72,7 +72,7 @@ inode_create (struct bitmap *b, disk_sector_t sector, off_t length)
   idx->data.length = length;
   while (idx->data.sector_cnt < sector_cnt)
     {
-      size_t sector = bitmap_find_and_set (b);
+      size_t sector = bitmap_scan_and_flip (b, 0, 1, false);
       if (sector == BITMAP_ERROR)
         goto error;
 
@@ -110,7 +110,10 @@ inode_open (disk_sector_t sector)
   list_elem *e;
   struct inode *idx;
 
-  /* Check whether this inode is already open. */
+  /* Check whether this inode is already open.
+     (A hash table would be better, but the Pintos base code
+     avoids using the hash table so that users are free to modify
+     it at will.) */
   for (e = list_begin (&open_inodes); e != list_end (&open_inodes);
        e = list_next (e)) 
     {
@@ -217,7 +220,7 @@ inode_print (const struct inode *idx)
 {
   size_t i;
   
-  printf ("Inode %"PRDSNu": %"PRDSNu" bytes, %zd sectors (",
+  printf ("Inode %"PRDSNu": %"PRDSNu" bytes, %zu sectors (",
           idx->sector, idx->data.length, idx->data.sector_cnt);
 
   /* This loop could be unsafe for large idx->data.sector_cnt, can