#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <dirent.h>
#include "test_common.h"
}
}
-void _t_grep(const char *path, char *str, int should_contain)
+static void _t_grep(const char *path, char *str, int should_contain)
{
char buf[1024];
int fd;
{
_t_grep(path, str, 0);
}
+
+void t_ls(int fd, char *buf, int size)
+{
+ struct dirent64 *ent;
+ int rc, pos;
+ loff_t base = 0;
+
+ printf("dir entries listing...\n");
+ while ((rc = getdirentries64(fd, buf, size, &base)) > 0) {
+ pos = 0;
+ while (pos < rc) {
+ ent = (struct dirent64 *) ((char*) buf + pos);
+ printf("%s\n", ent->d_name);
+ pos += ent->d_reclen;
+ }
+ }
+
+ if (rc < 0) {
+ printf("getdents error %d\n", rc);
+ EXIT(-1);
+ }
+}