X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fllapi_fid_test.c;h=8f2f9465550c965fca8211e0cb2820691be8d3eb;hb=be009cb4a73b3bef7302083bec7d1d6289d515b7;hp=574bf435960e37fc4b56a07441c276ff8fb08338;hpb=72057a3af19ee02d9a686bd7e7d074917e381310;p=fs%2Flustre-release.git diff --git a/lustre/tests/llapi_fid_test.c b/lustre/tests/llapi_fid_test.c index 574bf43..8f2f946 100644 --- a/lustre/tests/llapi_fid_test.c +++ b/lustre/tests/llapi_fid_test.c @@ -22,6 +22,9 @@ /* * Copyright 2014 Cray Inc, all rights reserved. + * + * Copyright (c) 2016, Intel Corporation. + * * Author: Frank Zago. * * A few portions are extracted from llapi_layout_test.c @@ -42,7 +45,7 @@ #include #include -#include +#include #define ERROR(fmt, ...) \ fprintf(stderr, "%s: %s:%d: %s: " fmt "\n", \ @@ -99,9 +102,9 @@ static void cleanup(void) * file/directory */ static void helper_fid2path(const char *filename, int fd) { - lustre_fid fid; - lustre_fid fid2; - lustre_fid fid3; + struct lu_fid fid; + struct lu_fid fid2; + struct lu_fid fid3; char fidstr[FID_LEN + 1]; char path1[PATH_MAX]; char path2[PATH_MAX]; @@ -237,7 +240,7 @@ static void test11(void) { int rc; int fd; - lustre_fid fid; + struct lu_fid fid; char fidstr[FID_LEN + 1]; char path[PATH_MAX]; long long recno; @@ -273,13 +276,13 @@ static void test12(void) int fd; int fd2; int fd3; - lustre_fid fid; + struct lu_fid fid; /* Against a volatile file */ rc = mkdir(mainpath, 0); ASSERTF(rc == 0, "mkdir failed for '%s': %s", mainpath, strerror(errno)); - fd = llapi_create_volatile_idx(mainpath, -1, 0600); + fd = llapi_create_volatile_idx(mainpath, -1, 0); ASSERTF(fd >= 0, "creat failed for '%s': %s", mainpath, strerror(errno)); @@ -288,7 +291,7 @@ static void test12(void) mainpath, strerror(-rc)); /* No many ways to test, except to open by fid. */ - fd2 = llapi_open_by_fid(mainpath, &fid, 0600); + fd2 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd2 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -296,7 +299,7 @@ static void test12(void) /* Check the file can still be opened, since fd2 is not * closed. */ - fd3 = llapi_open_by_fid(mainpath, &fid, 0600); + fd3 = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd3 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s", PFID(&fid), strerror(errno)); @@ -304,7 +307,7 @@ static void test12(void) close(fd3); /* The volatile file is gone now. */ - fd = llapi_open_by_fid(mainpath, &fid, 0600); + fd = llapi_open_by_fid(mainpath, &fid, O_RDONLY); ASSERTF(fd < 0, "llapi_open_by_fid for " DFID_NOBRACE ": %d", PFID(&fid), fd); } @@ -330,7 +333,7 @@ static void test20(void) /* Create subdirectories as long as we can. Each new subdir is * "/x", so we need at least 3 characters left in testpath. */ while (len <= sizeof(testpath) - 3) { - strncat(testpath, "/x", 2); + strncat(testpath, "/x", sizeof(testpath) - 1); len += 2; @@ -366,8 +369,8 @@ static void test30(void) bool seen; } links[num_links]; char buf[PATH_MAX]; - char buf2[PATH_MAX]; - lustre_fid fid; + char buf2[PATH_MAX * 2]; + struct lu_fid fid; char fidstr[FID_LEN + 1]; int rc; int i; @@ -473,8 +476,8 @@ static void test30(void) * type). mainpath must exist. */ static void help_test40(void) { - lustre_fid parent_fid; - lustre_fid fid2; + struct lu_fid parent_fid; + struct lu_fid fid2; char buf[PATH_MAX]; int rc; @@ -571,7 +574,7 @@ static void test42(void) const int num_links = 100; struct { char subdir[PATH_MAX]; - lustre_fid subdir_fid; + struct lu_fid subdir_fid; char filename[PATH_MAX]; bool seen; } links[num_links]; @@ -581,7 +584,7 @@ static void test42(void) int i; int fd; int linkno; - lustre_fid parent_fid; + struct lu_fid parent_fid; /* Create the containing directory. */ rc = mkdir(mainpath, 0);