Removed test code.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7426 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-05-06 01:44:14 +00:00
parent f7e706a409
commit df0dd8a5dd

View File

@ -1697,125 +1697,6 @@ vfs_setrlimit(int resource, const struct rlimit * rlp)
}
#ifdef DEBUG
int
vfs_test(void)
{
int fd;
int err;
dprintf("vfs_test() entry\n");
fd = sys_open_dir("/");
dprintf("fd = %d\n", fd);
sys_close(fd);
fd = sys_open_dir("/");
dprintf("fd = %d\n", fd);
sys_create_dir("/foo", 0755);
sys_create_dir("/foo/bar", 0755);
sys_create_dir("/foo/bar/gar", 0755);
sys_create_dir("/foo/bar/tar", 0755);
#if 1
fd = sys_open_dir("/foo/bar");
if (fd < 0)
panic("unable to open /foo/bar\n");
{
char buf[64];
ssize_t len;
sys_seek(fd, 0, SEEK_SET);
for (;;) {
len = sys_read(fd, buf, -1, sizeof(buf));
if (len > 0)
dprintf("readdir returned name = '%s'\n", buf);
else {
dprintf("readdir returned %s\n", strerror(len));
break;
}
}
}
// do some unlink tests
err = sys_unlink("/foo/bar");
if (err == B_NO_ERROR)
panic("unlink of full directory should not have passed\n");
sys_unlink("/foo/bar/gar");
sys_unlink("/foo/bar/tar");
err = sys_unlink("/foo/bar");
if (err != B_NO_ERROR)
panic("unlink of empty directory should have worked\n");
sys_create_dir("/test", 0755);
sys_create_dir("/test", 0755);
err = sys_mount("/test", NULL, "rootfs", NULL);
if (err < 0)
panic("failed mount test\n");
#endif
#if 1
fd = sys_open_dir("/boot");
sys_close(fd);
fd = sys_open_dir("/boot");
if (fd < 0)
panic("unable to open dir /boot\n");
{
char buf[256];
struct dirent *dirent = (struct dirent *)buf;
ssize_t len;
sys_rewind_dir(fd);
for (;;) {
len = sys_read_dir(fd, dirent, sizeof(buf), 1);
// if(len < 0)
// panic("readdir returned %Ld\n", (long long)len);
if (len > 0)
dprintf("sys_read returned name = '%s'\n", dirent->d_name);
else {
dprintf("sys_read returned %s\n", strerror(len));
break;
}
}
}
sys_close(fd);
fd = sys_open("/boot/kernel", O_RDONLY);
if (fd < 0)
panic("unable to open kernel file '/boot/kernel'\n");
{
char buf[64];
ssize_t len;
len = sys_read(fd, buf, 0, sizeof(buf));
if (len < 0)
panic("failed on read\n");
dprintf("read returned %Ld\n", (long long)len);
}
sys_close(fd);
{
struct stat stat;
err = sys_read_stat("/boot/kernel", &stat);
if (err < 0)
panic("err stating '/boot/kernel'\n");
dprintf("stat results:\n");
dprintf("\tvnid 0x%Lx\n\ttype %d\n\tsize 0x%Lx\n", stat.st_ino, stat.st_mode, stat.st_size);
}
#endif
dprintf("vfs_test() done\n");
return 0;
}
#endif
status_t
vfs_bootstrap_file_systems(void)
{