X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fliblustreapi_fid.c;h=8d3f2686d72bc5167ae52e78563fa4d508b75eb9;hb=aed829192a5ca07bdac15eb7ac69e7c341413e81;hp=578c6e6c797f055cfa6bc23ee55064de43f5117c;hpb=c45558bf560cf43d440af5679b86ba7e4d2542f3;p=fs%2Flustre-release.git diff --git a/lustre/utils/liblustreapi_fid.c b/lustre/utils/liblustreapi_fid.c index 578c6e6..8d3f268 100644 --- a/lustre/utils/liblustreapi_fid.c +++ b/lustre/utils/liblustreapi_fid.c @@ -160,6 +160,15 @@ out: return rc; } +static inline char *get_gf_path(struct getinfo_fid2path *gf) +{ +#ifndef HAVE_FID2PATH_ANON_UNIONS + return gf->gf_u.gf_path; +#else + return gf->gf_path; +#endif +} + int llapi_fid2path_at(int mnt_fd, const struct lu_fid *fid, char *path_buf, int path_buf_size, long long *recno, int *linkno) @@ -188,7 +197,7 @@ int llapi_fid2path_at(int mnt_fd, const struct lu_fid *fid, goto out; } - rc = copy_strip_dne_path(gf->gf_u.gf_path, path_buf, path_buf_size); + rc = copy_strip_dne_path(get_gf_path(gf), path_buf, path_buf_size); if (recno != NULL) *recno = gf->gf_recno; @@ -215,10 +224,10 @@ int llapi_fid2path(const char *path_or_device, const char *fidstr, char *path, if (*path_or_device == '/') rc = get_root_path(WANT_FD, NULL, &mnt_fd, - (char *)path_or_device, -1); + (char *)path_or_device, -1, NULL); else rc = get_root_path(WANT_FD, (char *)path_or_device, - &mnt_fd, NULL, -1); + &mnt_fd, NULL, -1, NULL); if (rc < 0) goto out; @@ -257,6 +266,7 @@ int llapi_get_mdt_index_by_fid(int fd, const struct lu_fid *fid, static int fid_from_lma(const char *path, int fd, struct lu_fid *fid) { +#ifdef HAVE_SERVER_SUPPORT struct lustre_mdt_attrs *lma; char buf[512]; int rc = -1; @@ -271,6 +281,9 @@ static int fid_from_lma(const char *path, int fd, struct lu_fid *fid) lma = (struct lustre_mdt_attrs *)buf; memcpy(fid, &lma->lma_self_fid, sizeof(lma->lma_self_fid)); return 0; +#else + return -ENOTSUP; +#endif } int llapi_fd2fid(int fd, struct lu_fid *fid)