Consistently spell "file name" and "file system" as two words.
[pintos-anon] / src / filesys / fsutil.c
index 14e615f8c989b5ad0863fd94d58a316068d2614d..14a45079c7a65d74166b8cd2b720fb6c9b10dfbe 100644 (file)
@@ -32,15 +32,15 @@ fsutil_ls (char **argv UNUSED)
 void
 fsutil_cat (char **argv)
 {
-  const char *filename = argv[1];
+  const char *file_name = argv[1];
   
   struct file *file;
   char *buffer;
 
-  printf ("Printing '%s' to the console...\n", filename);
-  file = filesys_open (filename);
+  printf ("Printing '%s' to the console...\n", file_name);
+  file = filesys_open (file_name);
   if (file == NULL)
-    PANIC ("%s: open failed", filename);
+    PANIC ("%s: open failed", file_name);
   buffer = palloc_get_page (PAL_ASSERT);
   for (;;) 
     {
@@ -59,15 +59,15 @@ fsutil_cat (char **argv)
 void
 fsutil_rm (char **argv) 
 {
-  const char *filename = argv[1];
+  const char *file_name = argv[1];
   
-  printf ("Deleting '%s'...\n", filename);
-  if (!filesys_remove (filename))
-    PANIC ("%s: delete failed\n", filename);
+  printf ("Deleting '%s'...\n", file_name);
+  if (!filesys_remove (file_name))
+    PANIC ("%s: delete failed\n", file_name);
 }
 
 /* Copies from the "scratch" disk, hdc or hd1:0 to file ARGV[1]
-   in the filesystem.
+   in the file system.
 
    The current sector on the scratch disk must begin with the
    string "PUT\0" followed by a 32-bit little-endian integer
@@ -83,13 +83,13 @@ fsutil_put (char **argv)
 {
   static disk_sector_t sector = 0;
 
-  const char *filename = argv[1];
+  const char *file_name = argv[1];
   struct disk *src;
   struct file *dst;
   off_t size;
   void *buffer;
 
-  printf ("Putting '%s' into the file system...\n", filename);
+  printf ("Putting '%s' into the file system...\n", file_name);
 
   /* Allocate buffer. */
   buffer = malloc (DISK_SECTOR_SIZE);
@@ -104,17 +104,17 @@ fsutil_put (char **argv)
   /* Read file size. */
   disk_read (src, sector++, buffer);
   if (memcmp (buffer, "PUT", 4))
-    PANIC ("%s: missing PUT signature on scratch disk", filename);
+    PANIC ("%s: missing PUT signature on scratch disk", file_name);
   size = ((int32_t *) buffer)[1];
   if (size < 0)
-    PANIC ("%s: invalid file size %d", filename, size);
+    PANIC ("%s: invalid file size %d", file_name, size);
   
   /* Create destination file. */
-  if (!filesys_create (filename, size))
-    PANIC ("%s: create failed", filename);
-  dst = filesys_open (filename);
+  if (!filesys_create (file_name, size))
+    PANIC ("%s: create failed", file_name);
+  dst = filesys_open (file_name);
   if (dst == NULL)
-    PANIC ("%s: open failed", filename);
+    PANIC ("%s: open failed", file_name);
 
   /* Do copy. */
   while (size > 0)
@@ -123,7 +123,7 @@ fsutil_put (char **argv)
       disk_read (src, sector++, buffer);
       if (file_write (dst, buffer, chunk_size) != chunk_size)
         PANIC ("%s: write failed with %"PROTd" bytes unwritten",
-               filename, size);
+               file_name, size);
       size -= chunk_size;
     }
 
@@ -132,7 +132,7 @@ fsutil_put (char **argv)
   free (buffer);
 }
 
-/* Copies file FILENAME from the file system to the scratch disk.
+/* Copies file FILE_NAME from the file system to the scratch disk.
 
    The current sector on the scratch disk will receive "GET\0"
    followed by the file's size in bytes as a 32-bit,
@@ -148,13 +148,13 @@ fsutil_get (char **argv)
 {
   static disk_sector_t sector = 0;
 
-  const char *filename = argv[1];
+  const char *file_name = argv[1];
   void *buffer;
   struct file *src;
   struct disk *dst;
   off_t size;
 
-  printf ("Getting '%s' from the file system...\n", filename);
+  printf ("Getting '%s' from the file system...\n", file_name);
 
   /* Allocate buffer. */
   buffer = malloc (DISK_SECTOR_SIZE);
@@ -162,9 +162,9 @@ fsutil_get (char **argv)
     PANIC ("couldn't allocate buffer");
 
   /* Open source file. */
-  src = filesys_open (filename);
+  src = filesys_open (file_name);
   if (src == NULL)
-    PANIC ("%s: open failed", filename);
+    PANIC ("%s: open failed", file_name);
   size = file_length (src);
 
   /* Open target disk. */
@@ -183,9 +183,9 @@ fsutil_get (char **argv)
     {
       int chunk_size = size > DISK_SECTOR_SIZE ? DISK_SECTOR_SIZE : size;
       if (sector >= disk_size (dst))
-        PANIC ("%s: out of space on scratch disk", filename);
+        PANIC ("%s: out of space on scratch disk", file_name);
       if (file_read (src, buffer, chunk_size) != chunk_size)
-        PANIC ("%s: read failed with %"PROTd" bytes unread", filename, size);
+        PANIC ("%s: read failed with %"PROTd" bytes unread", file_name, size);
       memset (buffer + chunk_size, 0, DISK_SECTOR_SIZE - chunk_size);
       disk_write (dst, sector++, buffer);
       size -= chunk_size;