* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
printf("found bad name %s\n", item);
return(-1);
}
- printf("[%03d]: %s\n",
+ printf("[%03d]: %s\t",
index++, item + strlen(prefix));
iter:
pos += ent->d_reclen;
}
}
+ printf("\n");
if (rc < 0) {
printf("getdents error %d\n", rc);
return(-1);
}
if (statbuf.st_size != size) {
printf("size of %s: %lld != %lld\n", file,
- (long long)statbuf.st_size, size);
+ (long long)statbuf.st_size, (long long )size);
return(-1);
}
return 0;
int fd;
struct iovec iov[2];
char buf[100];
- ssize_t ret;
+ long ret;
ENTER("trap app's general bad pointer for file i/o");
snprintf(file, MAX_PATH_LENGTH, "%s/test_t20_file", lustre_path);
int fd;
char *str = "1234567890";
char buf[100];
- ssize_t ret;
+ long ret;
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);
+ fd = open(file, O_TRUNC|O_RDWR|O_CREAT|O_APPEND, (mode_t)0666);
if (fd < 0) {
printf("error open file: %s\n", strerror(errno));
return(-1);
{
char path[MAX_PATH_LENGTH];
int fd;
- off_t ret;
- off_t off;
+ long long ret;
+ loff_t off;
ENTER("handle seek > 2GB");
snprintf(path, MAX_PATH_LENGTH, "%s/f%s", lustre_path, name);
ret = lseek(fd, -buf_size + 2, SEEK_CUR);
if (ret != off) {
printf("relative seek error for %d %llu != %llu\n",
- -buf_size + 2, ret, off);
+ -buf_size + 2, ret, (unsigned long long) off);
if (ret == -1)
perror("relative seek");
return -1;
off = 2048ULL * 1024 * 1024, SEEK_SET;
ret = lseek(fd, off, SEEK_SET);
if (ret != off) {
- printf("seek 2GB error for %llu != %llu\n", ret, off);
+ printf("seek 2GB error for %llu != %llu\n", ret, (unsigned long long) off);
if (ret == -1)
perror("seek 2GB");
return -1;
printf("st_atime=%s", ctime(&statbuf.st_atime));
atime = statbuf.st_atime;
for (i = 0; i < 3; i++) {
+ ssize_t num_read;
sleep(2);
- read(fd, buf, sizeof(buf));
+ /* should not ignore read(2)'s return value */
+ num_read = read(fd, buf, sizeof(buf));
+ if (num_read < 0 ) {
+ printf("read from %s: %s\n", file, strerror(errno));
+ return -1;
+ }
stat(file, &statbuf);
printf("st_atime=%s", ctime(&statbuf.st_atime));
diff = statbuf.st_atime - atime;
close(fd);
t_unlink(file);
return -1;
- }
- atime = statbuf.st_atime;
+ }
+ atime = statbuf.st_atime;
}
close(fd);
t_unlink(file);
struct utimbuf times; /* struct. buffer for utime() */
struct stat stat_buf; /* struct buffer to hold file info. */
time_t mtime, atime;
-
+
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");
-
+
/* Initialize the modification and access time in the times arg */
times.actime = NEW_TIME+10;
times.modtime = NEW_TIME;
-
+
/* file modification/access time */
utime(file, ×);
-
+
if (stat(file, &stat_buf) < 0) {
printf("stat(2) of %s failed, error:%d %s\n",
- file, errno, strerror(errno));
+ file, errno, strerror(errno));
}
mtime = stat_buf.st_mtime;
atime = stat_buf.st_atime;
-
+
if ((mtime == NEW_TIME) && (atime == NEW_TIME + 10)) {
t_unlink(file);
LEAVE();
printf("mod time %ld, expected %ld\n", mtime, (long)NEW_TIME);
printf("acc time %ld, expected %ld\n", atime, (long)NEW_TIME + 10);
-
+
t_unlink(file);
return (-1);
}
lock.l_whence = 0;
lock.l_len = 1;
if ((err = t_fcntl(fd, F_SETLKW, &lock)) != 0) {
- fprintf(stderr, "fcntl returned: %d (%s)\n",
+ fprintf(stderr, "fcntl returned: %d (%s)\n",
err, strerror(err));
close(fd);
t_unlink(file);
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);
-
+
buflen = sizeof(struct lov_user_md);
buflen += STRIPE_COUNT * sizeof(struct lov_user_ost_data);
lum = (struct lov_user_md *)malloc(buflen);
free(lum);
return -1;
}
-
+
lum->lmm_magic = LOV_USER_MAGIC;
lum->lmm_stripe_count = STRIPE_COUNT;
rc = ioctl(fd, LL_IOC_LOV_GETSTRIPE, lum);
if (opt_verbose) {
printf("lmm_magic: 0x%08X\n", lum->lmm_magic);
printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id);
- printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr);
+ printf("lmm_object_seq: "LPX64"\n", lum->lmm_object_seq);
printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count);
printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size);
printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern);
-
+
for (index = 0; index < lum->lmm_stripe_count; index++) {
lo = lum->lmm_objects + index;
printf("object %d:\n", index);
- printf("\tobject_gr: "LPX64"\n", lo->l_object_gr);
+ printf("\tobject_seq: "LPX64"\n", lo->l_object_seq);
printf("\tobject_id: "LPX64"\n", lo->l_object_id);
printf("\tost_gen: %#x\n", lo->l_ost_gen);
printf("\tost_idx: %u\n", lo->l_ost_idx);
}
fd = open(file, O_RDWR, 0644);
if (fd < 0) {
- printf("failed to open(%s): rc = %d (%s)\n",
+ printf("failed to open(%s): rc = %d (%s)\n",
file, fd, strerror(errno));
t_unlink(file);
t_rmdir(path);
if (opt_verbose) {
printf("lmm_magic: 0x%08X\n", lum->lmm_magic);
printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id);
- printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr);
+ printf("lmm_object_seq: "LPX64"\n", lum->lmm_object_seq);
printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count);
printf("lmm_stripe_size: %u\n", lum->lmm_stripe_size);
printf("lmm_stripe_pattern: %x\n", lum->lmm_pattern);
-
+
for (index = 0; index < lum->lmm_stripe_count; index++) {
lo = lum->lmm_objects + index;
printf("object %d:\n", index);
- printf("\tobject_gr: "LPX64"\n", lo->l_object_gr);
+ printf("\tobject_seq: "LPX64"\n", lo->l_object_seq);
printf("\tobject_id: "LPX64"\n", lo->l_object_id);
printf("\tost_gen: %#x\n", lo->l_ost_gen);
printf("\tost_idx: %u\n", lo->l_ost_idx);
int fd;
size_t nbytes;
off_t basep = 0;
- ssize_t rc = 0;
+ long rc = 0;
cfs_dirent_t dir;
ENTER("getdirentries should fail if nbytes is too small");