* GPL HEADER END
*/
/*
+ * Copyright (c) 2016, 2017, Intel Corporation.
+ */
+/*
* These tests exercise the llapi_layout API which abstracts the layout
* of a Lustre file behind an opaque data type. They assume a Lustre
* file system with at least 2 OSTs and a pool containing at least the
{
int rc;
struct llapi_layout *layout;
- lustre_fid fid;
+ struct lu_fid fid;
char fidstr[4096];
char path[PATH_MAX];
uint64_t size;
const char *lfs = getenv("LFS");
char mypool[LOV_MAXPOOLNAME + 1] = { '\0' };
- char cmd[4096];
+ char cmd[PATH_MAX + 128];
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", lustre_dir, T4FILE);
rc = llapi_layout_stripe_count_get(filelayout, &fcount);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
ASSERTF(rc == 0, "errno = %d", errno);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
ASSERTF(fsize == dsize, "%"PRIu64" != %"PRIu64, fsize, dsize);
llapi_layout_free(filelayout);
ASSERTF(rc == 0, "errno = %d", errno);
rc = llapi_layout_stripe_count_get(deflayout, &dcount);
ASSERTF(rc == 0, "errno = %d", errno);
- ASSERTF(fcount == dcount, "%"PRIu64" != %"PRIu64, fcount, dcount);
+ ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
+ dcount == LLAPI_LAYOUT_WIDE,
+ "%"PRIu64" != %"PRIu64, fcount, dcount);
rc = llapi_layout_stripe_size_get(filelayout, &fsize);
ASSERTF(rc == 0, "errno = %d", errno);
uint64_t size;
uint64_t pattern;
char dir[PATH_MAX];
- char cmd[4096];
+ char cmd[PATH_MAX + 64];
snprintf(dir, sizeof(dir), "%s/%s", lustre_dir, T26DIR);
rc = rmdir(dir);
uint64_t count;
uint64_t size;
uint64_t pattern;
- char dirpath[PATH_MAX];
- char filepath[PATH_MAX];
- char cmd[4096];
+ char dirpath[PATH_MAX + 128];
+ char filepath[PATH_MAX * 2];
+ char cmd[PATH_MAX * 2];
- snprintf(dirpath, sizeof(dirpath), "%s/%s", lustre_dir, T27DIR);
+ snprintf(dirpath, sizeof(dirpath) - 1, "%s/%s", lustre_dir, T27DIR);
snprintf(filepath, sizeof(filepath), "%s/nonesuch", dirpath);
rc = rmdir(dirpath);
const char *lfs = getenv("LFS");
uint64_t count;
char dirpath[PATH_MAX];
- char cmd[4096];
+ char cmd[PATH_MAX + 64];
snprintf(dirpath, sizeof(dirpath), "%s/%s", lustre_dir, T28DIR);
llapi_layout_free(layout);
/* delete non-tail component will fail */
- rc = llapi_layout_file_comp_del(path, id[0]);
+ rc = llapi_layout_file_comp_del(path, id[0], 0);
ASSERTF(rc < 0 && errno == EINVAL, "rc %d, errno %d", rc, errno);
- rc = llapi_layout_file_comp_del(path, id[1]);
+ rc = llapi_layout_file_comp_del(path, id[1], 0);
ASSERTF(rc == 0, "rc %d, errno %d", rc, errno);
/* verify the composite layout after deleting */