LEAVE();
}
-void t100()
+void t11()
{
char *base="/mnt/lustre";
char path[4096], path2[4096];
LEAVE();
}
+void t12()
+{
+ char *dir="/mnt/lustre/test_t11_dir";
+ char *file1="/mnt/lustre/test_t11_dir/file1";
+ char *file2="/mnt/lustre/test_t11_dir/file2";
+ char *file3="/mnt/lustre/test_t11_dir/file3";
+ char buf[1024*128];
+ int fd;
+ ENTRY("simple readdir");
+
+ t_mkdir(dir);
+ t_touch(file1);
+ t_touch(file2);
+ t_touch(file3);
+ fd = t_open(dir);
+ t_ls(fd, buf, sizeof(buf));
+ t_close(fd);
+ t_unlink(file1);
+ t_unlink(file2);
+ t_unlink(file3);
+ t_rmdir(dir);
+ LEAVE();
+}
+
+void t13()
+{
+ char *dir="/mnt/lustre/test_t12_dir/";
+ char name[1024];
+ char buf[1024*4];
+ const int nfiles = 300;
+ char *prefix = "test12_file_name_prefix_PPPPPPPPPP___";
+ int fd, i;
+ ENTRY("large directory readdir");
+
+ t_mkdir(dir);
+ printf("Creating %d files...\n", nfiles);
+ for (i = 0; i < nfiles; i++) {
+ sprintf(name, "%s%s%05d", dir, prefix, i);
+ t_touch(name);
+ }
+ fd = t_open(dir);
+ t_ls(fd, buf, sizeof(buf));
+ t_close(fd);
+ printf("Cleanup...\n");
+ for (i = 0; i < nfiles; i++) {
+ sprintf(name, "%s%s%05d", dir, prefix, i);
+ t_unlink(name);
+ }
+ t_rmdir(dir);
+ LEAVE();
+}
+
extern void __liblustre_setup_(void);
extern void __liblustre_cleanup_(void);
t8();
t9();
t10();
-
- t100();
+ t11();
+ t12();
+/*
+ t13();
+*/
#endif
printf("liblustre is about shutdown\n");
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <dirent.h>
#include "test_common.h"
{
_t_grep(path, str, 0);
}
+
+void t_ls(int fd, char *buf, int size)
+{
+ struct dirent *ent;
+ int rc, pos;
+ off_t base = 0;
+
+ printf("dir entries listing...\n");
+ while ((rc = getdirentries(fd, buf, size, &base)) > 0) {
+ pos = 0;
+ while (pos < rc) {
+ ent = (struct dirent *) ((char*) buf + pos);
+ printf("%s\n", ent->d_name);
+ pos += ent->d_reclen;
+ }
+ }
+
+ if (rc < 0) {
+ printf("getdents error %d\n", rc);
+ EXIT(-1);
+ }
+}
int t_check_stat(const char *name, struct stat *buf);
int t_check_stat_fail(const char *name);
void t_echo_create(const char *path, const char *str);
-//int t_pread_once(const char *path, char *buf, size_t size, off_t offset);
void t_grep(const char *path, char *str);
void t_grep_v(const char *path, char *str);
+void t_ls(int fd, char *buf, int size);
#endif