21 msg (
"creating many levels of files and directories...");
37 snprintf (contents,
sizeof contents,
"contents %d\n", i);
47 snprintf (dir_name,
sizeof dir_name,
"dir%d", i);
48 if (!
mkdir (dir_name))
55 CHECK ((fd =
open (
".")) > 1,
"open \".\"");
61 "names should be \"%s\" and \"%s\", "
62 "actually \"%s\" and \"%s\"",
67 CHECK (
chdir (dir_name),
"chdir \"%s\"", dir_name);
69 CHECK (i > 200,
"created files and directories only to level %d", i);
72 msg (
"removing all but top 10 levels of files and directories...");
79 snprintf (dir_name,
sizeof dir_name,
"dir%d", i);
81 CHECK (
remove (dir_name),
"remove \"%s\"", dir_name);
void test_main(void)
Create a very deep "vine" of directories: /dir0/dir1/dir2/... and an ordinary file in each of them,...
int snprintf(char *buffer, size_t buf_size, const char *format,...)
Like printf(), except that output is stored into BUFFER, which must have space for BUF_SIZE character...
bool readdir(int fd, char name[READDIR_MAX_LEN+1])
bool chdir(const char *dir)
Project 4 only.
bool create(const char *file, unsigned initial_size)
int open(const char *file)
bool remove(const char *file)
int write(int fd, const void *buffer, unsigned size)
bool mkdir(const char *dir)
#define READDIR_MAX_LEN
Maximum characters in a filename written by readdir().
void msg(const char *format,...)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
size_t strlen(const char *string)
Returns the length of STRING.
int strcmp(const char *a_, const char *b_)
Finds the first differing characters in strings A and B.
static const char file_name[]
tests/filesys/base/syn-read.h