#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <sys/queue.h>
#include <signal.h>
#include <errno.h>
#include <dirent.h>
#include <sys/uio.h>
#include <sys/time.h>
#include <time.h>
-#include <sys/ioctl.h>
+#include <liblustre.h>
#include "test_common.h"
-#include <ioctl.h>
#include <lustre/liblustreapi.h>
-#ifndef PAGE_SIZE
-#define PAGE_SIZE getpagesize()
-#endif
#define _npages (2048)
void *buf_alloc;
extern char *lustre_path;
-#define ENTRY(str) \
+#define ENTER(str) \
do { \
char buf[100]; \
int len; \
{
char path[MAX_PATH_LENGTH] = "";
- ENTRY("mkdir/rmdir");
+ ENTER("mkdir/rmdir");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t2", lustre_path);
t_mkdir(path);
{
char path[MAX_PATH_LENGTH] = "";
- ENTRY("regular stat");
+ ENTER("regular stat");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t3", lustre_path);
t_touch(path);
{
char path[MAX_PATH_LENGTH] = "";
- ENTRY("dir stat");
+ ENTER("dir stat");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t4", lustre_path);
t_mkdir(path);
char path[MAX_PATH_LENGTH] = "";
char path2[MAX_PATH_LENGTH] = "";
- ENTRY("symlink");
+ ENTER("symlink");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t6", lustre_path);
snprintf(path2, MAX_PATH_LENGTH, "%s/test_t6_link", lustre_path);
char *tmp;
int fd;
- ENTRY("symlink + chdir and open");
+ ENTER("symlink + chdir and open");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t6b", lustre_path);
snprintf(path2, MAX_PATH_LENGTH, "%s/test_t6b_link", lustre_path);
char path[MAX_PATH_LENGTH] = "";
int rc;
- ENTRY("mknod");
+ ENTER("mknod");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t7", lustre_path);
if (geteuid() != 0) {
{
char path[MAX_PATH_LENGTH] = "";
- ENTRY("chmod");
+ ENTER("chmod");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t8", lustre_path);
/* Check file. */
char path[MAX_PATH_LENGTH] = "";
char path2[MAX_PATH_LENGTH] = "";
- ENTRY("hard link");
+ ENTER("hard link");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t9", lustre_path);
snprintf(path2, MAX_PATH_LENGTH, "%s/test_t9_link", lustre_path);
char rename2[MAX_PATH_LENGTH] = "";
char rename3[MAX_PATH_LENGTH] = "";
- ENTRY("rename");
+ ENTER("rename");
snprintf(dir1, MAX_PATH_LENGTH, "%s/test_t10_dir1", lustre_path);
snprintf(dir2, MAX_PATH_LENGTH, "%s/test_t10_dir2", lustre_path);
snprintf(path1, MAX_PATH_LENGTH, "%s/test_t10_reg1", lustre_path);
char *base=lustre_path;
char path[MAX_PATH_LENGTH], path2[MAX_PATH_LENGTH];
int i, j, level = 5, nreg = 5;
- ENTRY("deep tree");
+ ENTER("deep tree");
safe_strncpy(path, base, MAX_PATH_LENGTH);
char dir[MAX_PATH_LENGTH] = "";
char buf[1024*128];
int fd;
- ENTRY("empty directory readdir");
+ ENTER("empty directory readdir");
snprintf(dir, MAX_PATH_LENGTH, "%s/test_t12_dir", lustre_path);
t_mkdir(dir);
const int nfiles = 20;
char *prefix = "test13_filename_prefix_";
int fd, i;
- ENTRY("multiple entries directory readdir");
+ ENTER("multiple entries directory readdir");
snprintf(dir, MAX_PATH_LENGTH, "%s/test_t13_dir/", lustre_path);
t_mkdir(dir);
struct dirent64 *ent;
int fd, i, rc, pos, index;
loff_t base = 0;
- ENTRY(">1 block(4k) directory readdir");
+ ENTER(">1 block(4k) directory readdir");
snprintf(dir, MAX_PATH_LENGTH, "%s/test_t14_dir/", lustre_path);
rc = mkdir(dir, 0755);
{
char file[MAX_PATH_LENGTH] = "";
int fd;
- ENTRY("open-stat-close");
+ ENTER("open-stat-close");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t15_file", lustre_path);
t_touch(file);
int t16(char *name)
{
char file[MAX_PATH_LENGTH] = "";
- ENTRY("small-write-read");
+ ENTER("small-write-read");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t16_file", lustre_path);
t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaa");
{
char file[MAX_PATH_LENGTH] = "";
int fd;
- ENTRY("open-unlink without close");
+ ENTER("open-unlink without close");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t17_file", lustre_path);
fd = open(file, O_WRONLY | O_CREAT, 0666);
char buf[128];
int fd, i;
struct stat statbuf[3];
- ENTRY("write should change mtime/ctime");
+ ENTER("write should change mtime/ctime");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t18_file", lustre_path);
for (i = 0; i < 3; i++) {
char file[MAX_PATH_LENGTH] = "";
int i;
struct stat statbuf[3];
- ENTRY("utime should change mtime/atime/ctime");
+ ENTER("utime should change mtime/atime/ctime");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t18b_file", lustre_path);
t_touch(file);
LEAVE();
}
-static int check_file_size(char *file, off_t size)
+static int check_file_size(char *file, long long size)
{
struct stat statbuf;
char file[MAX_PATH_LENGTH] = "";
int fd;
int result;
- ENTRY("open(O_TRUNC) should truncate file to 0-length");
+ ENTER("open(O_TRUNC) should truncate file to 0-length");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t19_file", lustre_path);
t_echo_create(file, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
struct iovec iov[2];
char buf[100];
ssize_t ret;
- ENTRY("trap app's general bad pointer for file i/o");
+ ENTER("trap app's general bad pointer for file i/o");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t20_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
.l_whence = SEEK_SET,
};
- ENTRY("basic fcntl support");
+ ENTER("basic fcntl support");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t21_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
char *str = "1234567890";
char buf[100];
ssize_t ret;
- ENTRY("make sure O_APPEND take effect");
+ ENTER("make sure O_APPEND take effect");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t22_file", lustre_path);
fd = open(file, O_RDWR|O_CREAT|O_APPEND, (mode_t)0666);
char path[MAX_PATH_LENGTH];
int fd;
long long ret;
- loff_t off;
+ long long off;
- ENTRY("handle seek > 2GB");
+ ENTER("handle seek > 2GB");
snprintf(path, MAX_PATH_LENGTH, "%s/f%s", lustre_path, name);
fd = open(path, O_WRONLY | O_CREAT | O_LARGEFILE, 0666);
int np = 1;
loff_t offset = 0;
- ENTRY("4k aligned i/o sanity");
+ ENTER("4k aligned i/o sanity");
while (np <= _npages) {
printf("%3d per xfer(total %d)...\t", np, _npages);
fflush(stdout);
loff_t off_array[] = {1, 17, 255, 258, 4095, 4097, 8191,
1024*1024*1024*1024ULL};
int i;
- loff_t offset;
+ long long offset;
- ENTRY("4k un-aligned i/o sanity");
+ ENTER("4k un-aligned i/o sanity");
for (i = 0; i < sizeof(off_array)/sizeof(loff_t); i++) {
offset = off_array[i];
printf("16 per xfer(total %d), offset %10lld...\t",
{
char file[MAX_PATH_LENGTH] = "";
int fd;
- off_t size;
+ long long size;
int result;
- ENTRY("truncate() should truncate file to proper length");
+ ENTER("truncate() should truncate file to proper length");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t51_file", lustre_path);
for (size = 0; size < T51_NR * T51_STEP; size += T51_STEP) {
time_t diff;
int fd, i;
- ENTRY("atime should be updated during read");
+ ENTER("atime should be updated during read");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t52_file", lustre_path);
t_echo_create(file, "check atime update during read");
struct stat stat_buf; /* struct buffer to hold file info. */
time_t mtime, atime;
- ENTRY("mtime/atime should be updated by utime() call");
+ ENTER("mtime/atime should be updated by utime() call");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t53_file", lustre_path);
t_echo_create(file, "check mtime/atime update by utime() call");
struct flock lock;
int fd, err;
- ENTRY("fcntl should return 0 when succeed in getting flock");
+ ENTER("fcntl should return 0 when succeed in getting flock");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t54_file", lustre_path);
t_echo_create(file, "fcntl should return 0 when succeed");
}
/* for O_DIRECTORY */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#define STRIPE_SIZE (2048 * 2048)
#define STRIPE_OFFSET 0
struct lov_user_ost_data *lo = NULL;
int index, fd, buflen, rc;
- ENTRY("setstripe/getstripe");
+ ENTER("setstripe/getstripe");
snprintf(path, MAX_PATH_LENGTH, "%s/test_t55", lustre_path);
snprintf(file, MAX_PATH_LENGTH, "%s/test_t55/file_t55", lustre_path);
ssize_t rc = 0;
struct dirent dir;
- ENTRY("getdirentries should fail if nbytes is too small");
+ ENTER("getdirentries should fail if nbytes is too small");
/* Set count to be very small. The result should be EINVAL */
nbytes = 8;
rc = getdirentries(fd, (char *)&dir, nbytes, &basep);
if (rc != -1) {
- printf("Test failed: getdirentries returned %d\n", rc);
+ printf("Test failed: getdirentries returned %ld\n", rc);
t_close(fd);
return -1;
}
if (errno != EINVAL) {
- printf("Test failed: getdirentries returned %d but errno is set"
+ printf("Test failed: getdirentries returned %ld but errno is set"
" to %d (should be EINVAL)\n", rc, errno);
t_close(fd);
return -1;
LEAVE();
}
-
extern void __liblustre_setup_(void);
extern void __liblustre_cleanup_(void);