summaryrefslogtreecommitdiff
path: root/userfs.c
diff options
context:
space:
mode:
authorkaashoek <kaashoek>2006-08-13 05:28:04 +0000
committerkaashoek <kaashoek>2006-08-13 05:28:04 +0000
commitc372e8dc348e4bb30aae7642db92ecbeedbc83ab (patch)
tree2260179bbbacee1ab83f8a4336c325294ac2867d /userfs.c
parent9e5970d596d7b1634200d50e96130886f593cede (diff)
downloadxv6-labs-c372e8dc348e4bb30aae7642db92ecbeedbc83ab.tar.gz
xv6-labs-c372e8dc348e4bb30aae7642db92ecbeedbc83ab.tar.bz2
xv6-labs-c372e8dc348e4bb30aae7642db92ecbeedbc83ab.zip
zero freed blocks
multi-block directories track size of directory (size = number entries in use) should namei (and other code that scans through directories) scan through all blocks of a directory and not use size?
Diffstat (limited to 'userfs.c')
-rw-r--r--userfs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/userfs.c b/userfs.c
index 90aa1fa..2726de7 100644
--- a/userfs.c
+++ b/userfs.c
@@ -7,6 +7,7 @@
// file system tests
char buf[2000];
+char name[3];
char *echo_args[] = { "echo", "hello", "goodbye", 0 };
char *cat_args[] = { "cat", "README", 0 };
@@ -65,6 +66,20 @@ main(void)
}
close(fd);
unlink("doesnotexist");
+ name[0] = 'a';
+ name[2] = '\0';
+ for (i = 0; i < 52; i++) {
+ name[1] = '0' + i;
+ fd = open(name, O_CREATE|O_RDWR);
+ close(fd);
+ }
+ name[0] = 'a';
+ name[2] = '\0';
+ for (i = 0; i < 52; i++) {
+ name[1] = '0' + i;
+ unlink(name);
+ }
+
//exec("echo", echo_args);
printf(stdout, "about to do exec\n");
exec("cat", cat_args);