Skip to content
Snippets Groups Projects
Commit 02a15997 authored by Eric Mei's avatar Eric Mei
Browse files

liblustre:

 - fix broken readdir test
parent 71988931
No related branches found
No related tags found
No related merge requests found
...@@ -146,7 +146,6 @@ static void pages_io(int xfer, loff_t pos) ...@@ -146,7 +146,6 @@ static void pages_io(int xfer, loff_t pos)
} }
} }
printf("succefully write %d pages(%d per xfer)\n", _npages, xfer); printf("succefully write %d pages(%d per xfer)\n", _npages, xfer);
memset(_buffer, 0, sizeof(_buffer)); memset(_buffer, 0, sizeof(_buffer));
/* read */ /* read */
...@@ -324,7 +323,7 @@ void t12() ...@@ -324,7 +323,7 @@ void t12()
ENTRY("empty directory readdir"); ENTRY("empty directory readdir");
t_mkdir(dir); t_mkdir(dir);
fd = t_open(dir); fd = t_opendir(dir);
t_ls(fd, buf, sizeof(buf)); t_ls(fd, buf, sizeof(buf));
t_close(fd); t_close(fd);
t_rmdir(dir); t_rmdir(dir);
...@@ -347,7 +346,7 @@ void t13() ...@@ -347,7 +346,7 @@ void t13()
sprintf(name, "%s%s%05d", dir, prefix, i); sprintf(name, "%s%s%05d", dir, prefix, i);
t_touch(name); t_touch(name);
} }
fd = t_open(dir); fd = t_opendir(dir);
t_ls(fd, buf, sizeof(buf)); t_ls(fd, buf, sizeof(buf));
t_close(fd); t_close(fd);
printf("Cleanup...\n"); printf("Cleanup...\n");
...@@ -375,7 +374,7 @@ void t14() ...@@ -375,7 +374,7 @@ void t14()
sprintf(name, "%s%s%05d", dir, prefix, i); sprintf(name, "%s%s%05d", dir, prefix, i);
t_touch(name); t_touch(name);
} }
fd = t_open(dir); fd = t_opendir(dir);
t_ls(fd, buf, sizeof(buf)); t_ls(fd, buf, sizeof(buf));
t_close(fd); t_close(fd);
printf("Cleanup...\n"); printf("Cleanup...\n");
......
...@@ -181,6 +181,18 @@ int t_open(const char *path) ...@@ -181,6 +181,18 @@ int t_open(const char *path)
return fd; return fd;
} }
int t_opendir(const char *path)
{
int fd;
fd = open(path, O_RDONLY);
if (fd < 0) {
printf("opendir(%s) error: %s\n", path, strerror(errno));
EXIT_RET(fd);
}
return fd;
}
void t_close(int fd) void t_close(int fd)
{ {
int rc; int rc;
......
...@@ -21,6 +21,7 @@ void t_chmod(const char *path, const char *format, ...); ...@@ -21,6 +21,7 @@ void t_chmod(const char *path, const char *format, ...);
void t_rename(const char *oldpath, const char *newpath); void t_rename(const char *oldpath, const char *newpath);
int t_open_readonly(const char *path); int t_open_readonly(const char *path);
int t_open(const char *path); int t_open(const char *path);
int t_opendir(const char *path);
void t_close(int fd); void t_close(int fd);
int t_check_stat(const char *name, struct stat *buf); int t_check_stat(const char *name, struct stat *buf);
int t_check_stat_fail(const char *name); int t_check_stat_fail(const char *name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment