From 3c4ff7ffae2e6f05a2c78ec77814dbc5a98c4f98 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 12 Apr 2005 05:24:37 +0000 Subject: [PATCH] Get rid of file system "dump" operations because they weren't useful and occasionally provoked student questions. --- src/filesys/directory.c | 16 ---------------- src/filesys/directory.h | 1 - src/filesys/filesys.c | 29 ----------------------------- src/filesys/filesys.h | 1 - src/filesys/fsutil.c | 6 ------ src/filesys/fsutil.h | 1 - src/threads/init.c | 3 --- 7 files changed, 57 deletions(-) diff --git a/src/filesys/directory.c b/src/filesys/directory.c index b08e7ee..fd15902 100644 --- a/src/filesys/directory.c +++ b/src/filesys/directory.c @@ -188,19 +188,3 @@ dir_list (const struct dir *d) if (e->in_use) printf ("%s\n", e->name); } - -/* Dumps the contents of D, including its files' names and their - contents, to the system console. */ -void -dir_dump (const struct dir *d) -{ - struct dir_entry *e; - - for (e = d->entries; e < d->entries + d->entry_cnt; e++) - if (e->in_use) - { - printf ("Contents of %s:\n", e->name); - fsutil_print (e->name); - printf ("\n"); - } -} diff --git a/src/filesys/directory.h b/src/filesys/directory.h index db16867..c773887 100644 --- a/src/filesys/directory.h +++ b/src/filesys/directory.h @@ -21,6 +21,5 @@ bool dir_lookup (const struct dir *, const char *name, disk_sector_t *); bool dir_add (struct dir *, const char *name, disk_sector_t); bool dir_remove (struct dir *, const char *name); void dir_list (const struct dir *); -void dir_dump (const struct dir *); #endif /* filesys/directory.h */ diff --git a/src/filesys/filesys.c b/src/filesys/filesys.c index 7989890..b77d271 100644 --- a/src/filesys/filesys.c +++ b/src/filesys/filesys.c @@ -276,35 +276,6 @@ filesys_list (void) return true; } -/* Dumps the filesystem state to the system console, - including the free map, the list of files, and file contents. - Returns true if successful, false on failure, - which occurs only if an internal memory allocation fails. */ -bool -filesys_dump (void) -{ - struct bitmap *free_map; - struct dir *dir; - - printf ("Free map:\n"); - free_map = bitmap_create (disk_size (filesys_disk)); - if (free_map == NULL) - return false; - bitmap_read (free_map, free_map_file); - bitmap_dump (free_map); - bitmap_destroy (free_map); - printf ("\n"); - - dir = dir_create (NUM_DIR_ENTRIES); - if (dir == NULL) - return false; - dir_read (dir, root_dir_file); - dir_dump (dir); - dir_destroy (dir); - - return true; -} - static void must_succeed_function (int, bool) NO_INLINE; #define MUST_SUCCEED(EXPR) must_succeed_function (__LINE__, EXPR) diff --git a/src/filesys/filesys.h b/src/filesys/filesys.h index 9563fbb..064c577 100644 --- a/src/filesys/filesys.h +++ b/src/filesys/filesys.h @@ -17,7 +17,6 @@ bool filesys_create (const char *name, off_t initial_size); struct file *filesys_open (const char *name); bool filesys_remove (const char *name); bool filesys_list (void); -bool filesys_dump (void); void filesys_self_test (void); diff --git a/src/filesys/fsutil.c b/src/filesys/fsutil.c index 7756946..81466c2 100644 --- a/src/filesys/fsutil.c +++ b/src/filesys/fsutil.c @@ -25,9 +25,6 @@ char *fsutil_remove_file; /* List all files in the filesystem to the system console? */ bool fsutil_list_files; -/* Dump full contents of filesystem to the system console? */ -bool fsutil_dump_filesys; - /* Copies from the "scratch" disk, hdc or hd1:0, to a file named FILENAME in the filesystem. The file will be SIZE bytes in length. */ @@ -144,9 +141,6 @@ fsutil_run (void) if (fsutil_list_files) filesys_list (); - - if (fsutil_dump_filesys) - filesys_dump (); } /* Prints the contents of file FILENAME to the system console as diff --git a/src/filesys/fsutil.h b/src/filesys/fsutil.h index 2d711e9..307e37d 100644 --- a/src/filesys/fsutil.h +++ b/src/filesys/fsutil.h @@ -9,7 +9,6 @@ extern char *fsutil_copyout_file; extern char *fsutil_print_file; extern char *fsutil_remove_file; extern bool fsutil_list_files; -extern bool fsutil_dump_filesys; void fsutil_run (void); void fsutil_print (const char *filename); diff --git a/src/threads/init.c b/src/threads/init.c index 5896616..4b78358 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -246,8 +246,6 @@ argv_init (void) fsutil_remove_file = argv[++i]; else if (!strcmp (argv[i], "-ls")) fsutil_list_files = true; - else if (!strcmp (argv[i], "-D")) - fsutil_dump_filesys = true; #endif else if (!strcmp (argv[i], "-u")) { @@ -267,7 +265,6 @@ argv_init (void) " -p FILENAME Print the contents of FILENAME\n" " -r FILENAME Delete FILENAME\n" " -ls List the files in the filesystem\n" - " -D Dump complete filesystem contents\n" #endif " -q Power off after doing requested actions.\n" " -u Print this help message and power off.\n" -- 2.30.2