Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-10070 lod: SEL: Repeated components
[fs/lustre-release.git]
/
lustre
/
tests
/
llapi_fid_test.c
diff --git
a/lustre/tests/llapi_fid_test.c
b/lustre/tests/llapi_fid_test.c
index
e7d18f9
..
8f2f946
100644
(file)
--- a/
lustre/tests/llapi_fid_test.c
+++ b/
lustre/tests/llapi_fid_test.c
@@
-15,17
+15,16
@@
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
/*
* Copyright 2014 Cray Inc, all rights reserved.
*
* GPL HEADER END
*/
/*
* 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
* Author: Frank Zago.
*
* A few portions are extracted from llapi_layout_test.c
@@
-42,10
+41,11
@@
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>
+#include <sys/ioctl.h>
#include <time.h>
#include <lustre/lustreapi.h>
#include <time.h>
#include <lustre/lustreapi.h>
-#include <lustre/lustre_idl.h>
+#include <l
inux/l
ustre/lustre_idl.h>
#define ERROR(fmt, ...) \
fprintf(stderr, "%s: %s:%d: %s: " fmt "\n", \
#define ERROR(fmt, ...) \
fprintf(stderr, "%s: %s:%d: %s: " fmt "\n", \
@@
-102,10
+102,10
@@
static void cleanup(void)
* file/directory */
static void helper_fid2path(const char *filename, int fd)
{
* file/directory */
static void helper_fid2path(const char *filename, int fd)
{
-
lustre
_fid fid;
-
lustre
_fid fid2;
-
lustre
_fid fid3;
- char fidstr[FID_LEN];
+
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];
char path3[PATH_MAX];
char path1[PATH_MAX];
char path2[PATH_MAX];
char path3[PATH_MAX];
@@
-240,8
+240,8
@@
static void test11(void)
{
int rc;
int fd;
{
int rc;
int fd;
-
lustre
_fid fid;
- char fidstr[FID_LEN];
+
struct lu
_fid fid;
+ char fidstr[FID_LEN
+ 1
];
char path[PATH_MAX];
long long recno;
int linkno;
char path[PATH_MAX];
long long recno;
int linkno;
@@
-276,13
+276,13
@@
static void test12(void)
int fd;
int fd2;
int fd3;
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));
/* 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, 0
600
);
+ fd = llapi_create_volatile_idx(mainpath, -1, 0);
ASSERTF(fd >= 0, "creat failed for '%s': %s",
mainpath, strerror(errno));
ASSERTF(fd >= 0, "creat failed for '%s': %s",
mainpath, strerror(errno));
@@
-291,7
+291,7
@@
static void test12(void)
mainpath, strerror(-rc));
/* No many ways to test, except to open by fid. */
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));
ASSERTF(fd2 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s",
PFID(&fid), strerror(errno));
@@
-299,7
+299,7
@@
static void test12(void)
/* Check the file can still be opened, since fd2 is not
* closed. */
/* 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));
ASSERTF(fd3 >= 0, "llapi_open_by_fid for " DFID_NOBRACE ": %s",
PFID(&fid), strerror(errno));
@@
-307,7
+307,7
@@
static void test12(void)
close(fd3);
/* The volatile file is gone now. */
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);
}
ASSERTF(fd < 0, "llapi_open_by_fid for " DFID_NOBRACE ": %d",
PFID(&fid), fd);
}
@@
-333,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) {
/* 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;
len += 2;
@@
-369,9
+369,9
@@
static void test30(void)
bool seen;
} links[num_links];
char buf[PATH_MAX];
bool seen;
} links[num_links];
char buf[PATH_MAX];
- char buf2[PATH_MAX];
-
lustre
_fid fid;
- char fidstr[FID_LEN];
+ char buf2[PATH_MAX
* 2
];
+
struct lu
_fid fid;
+ char fidstr[FID_LEN
+ 1
];
int rc;
int i;
int j;
int rc;
int i;
int j;
@@
-476,8
+476,8
@@
static void test30(void)
* type). mainpath must exist. */
static void help_test40(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;
char buf[PATH_MAX];
int rc;
@@
-574,7
+574,7
@@
static void test42(void)
const int num_links = 100;
struct {
char subdir[PATH_MAX];
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];
char filename[PATH_MAX];
bool seen;
} links[num_links];
@@
-584,7
+584,7
@@
static void test42(void)
int i;
int fd;
int linkno;
int i;
int fd;
int linkno;
-
lustre
_fid parent_fid;
+
struct lu
_fid parent_fid;
/* Create the containing directory. */
rc = mkdir(mainpath, 0);
/* Create the containing directory. */
rc = mkdir(mainpath, 0);
@@
-698,7
+698,7
@@
static void process_args(int argc, char *argv[])
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
- char fsname[8];
+ char fsname[8
+ 1
];
int rc;
process_args(argc, argv);
int rc;
process_args(argc, argv);