-}
-
-/* Executes the filesystem operations described by the variables
- declared in fsutil.h. */
-void
-fsutil_run (void)
-{
- if (fsutil_copyin_file != NULL)
- copy_in (fsutil_copyin_file, fsutil_copyin_size);
-
- if (fsutil_copyout_file != NULL)
- copy_out (fsutil_copyout_file);
-
- if (fsutil_print_file != NULL)
- fsutil_print (fsutil_print_file);
-
- if (fsutil_remove_file != NULL)
- {
- if (filesys_remove (fsutil_remove_file))
- printf ("%s: removed\n", fsutil_remove_file);
- else
- PANIC ("%s: remove failed\n", fsutil_remove_file);
- }
-
- if (fsutil_list_files)
- filesys_list ();
-
- if (fsutil_dump_filesys)
- filesys_dump ();
-}
-
-/* Prints the contents of file FILENAME to the system console as
- hex and ASCII. */
-void
-fsutil_print (const char *filename)
-{
- struct file *file;
- char *buffer;
-
- file = filesys_open (filename);
- if (file == NULL)
- PANIC ("%s: open failed", filename);
- buffer = palloc_get (PAL_ASSERT);
- for (;;)
- {
- off_t n = file_read (file, buffer, PGSIZE);
- if (n == 0)
- break;
-
- hex_dump (0, buffer, n, true);
- }
- palloc_free (buffer);
- file_close (file);