Replace it with struct lu_fid. Update the userland code and man
pages to reflect this change.
Linux-commit:
d8f6bc9a53f97d1ea4b2b955672904338643308b
Test-Parameters: trivial
Change-Id: I0b7e0770dd9da9bdac55c02c2ec98aea7cea7100
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: https://review.whamcloud.com/29849
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
18 files changed:
}
/* struct hsm_user_item { */
}
/* struct hsm_user_item { */
-/* lustre_fid hui_fid; */
+/* struct lu_fid hui_fid; */
/* struct hsm_extent hui_extent; */
/* } __attribute__((packed)); */
static int
/* struct hsm_extent hui_extent; */
/* } __attribute__((packed)); */
static int
}
/* struct hsm_progress_kernel { */
}
/* struct hsm_progress_kernel { */
-/* lustre_fid hpk_fid; */
+/* struct lu_fid hpk_fid; */
/* __u64 hpk_cookie; */
/* struct hsm_extent hpk_extent; */
/* __u16 hpk_flags; */
/* __u64 hpk_cookie; */
/* struct hsm_extent hpk_extent; */
/* __u16 hpk_flags; */
struct hsm_action_item {
__u32 hai_len; /* valid size of this struct */
__u32 hai_action; /* hsm_copytool_action, but use known size */
struct hsm_action_item {
__u32 hai_len; /* valid size of this struct */
__u32 hai_action; /* hsm_copytool_action, but use known size */
- lustre_fid hai_fid; /* Lustre FID to operated on */
- lustre_fid hai_dfid; /* fid used for data access */
+ struct lu_fid hai_fid; /* Lustre FID to operated on */
+ struct lu_fid hai_dfid; /* fid used for data access */
struct hsm_extent hai_extent; /* byte range to operate on */
__u64 hai_cookie; /* action cookie from coordinator */
__u64 hai_gid; /* grouplock id */
struct hsm_extent hai_extent; /* byte range to operate on */
__u64 hai_cookie; /* action cookie from coordinator */
__u64 hai_gid; /* grouplock id */
.BI "struct llapi_layout *llapi_layout_get_by_fd(int "fd ", uint32_t " flags );
.PP
.BI "struct llapi_layout *llapi_layout_get_by_fid(const char *"lustre_path ,
.BI "struct llapi_layout *llapi_layout_get_by_fd(int "fd ", uint32_t " flags );
.PP
.BI "struct llapi_layout *llapi_layout_get_by_fid(const char *"lustre_path ,
-.BI " const lustre_fid *"fid ,
+.BI " const struct lu_fid *"fid ,
.BI " uint32_t " flags );
.PP
.BI "struct llapi_layout *llapi_layout_get_by_path(const char *"path ,
.BI " uint32_t " flags );
.PP
.BI "struct llapi_layout *llapi_layout_get_by_path(const char *"path ,
the root. Use the function
.BR llapi_path2fid (3)
to obtain a
the root. Use the function
.BR llapi_path2fid (3)
to obtain a
associated with a given path.
.PP
The function
associated with a given path.
.PP
The function
.nf
.B #include <lustre/lustreapi.h>
.PP
.nf
.B #include <lustre/lustreapi.h>
.PP
-.BI "int llapi_path2fid(const char *"path ", lustre_fid *"fid );
+.BI "int llapi_path2fid(const char *"path ", struct lu_fid *"fid );
The
.I fid
may be then be passed to other llapi functions that expect the
The
.I fid
may be then be passed to other llapi functions that expect the
data type.
.SH RETURN VALUES
.LP
data type.
.SH RETURN VALUES
.LP
.B #include <lustre/lustreapi.h>
.PP
.BI "int llapi_path2parent(const char *" path ", unsigned int " linkno ","
.B #include <lustre/lustreapi.h>
.PP
.BI "int llapi_path2parent(const char *" path ", unsigned int " linkno ","
-.BI " lustre_fid *" parent_fid ", char *" name ","
+.BI " struct lu_fid *" parent_fid ", char *" name ","
.BI " size_t " name_size );
.BI "int llapi_fd2parent(int " fd ", unsigned int " linkno ","
.BI " size_t " name_size );
.BI "int llapi_fd2parent(int " fd ", unsigned int " linkno ","
-.BI " lustre_fid *" parent_fid ", char *" name ","
+.BI " struct lu_fid *" parent_fid ", char *" name ","
.BI " size_t " name_size );
.sp
.fi
.BI " size_t " name_size );
.sp
.fi
#include <stdint.h>
#include <linux/lustre/lustre_user.h>
#include <stdint.h>
#include <linux/lustre/lustre_user.h>
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
#ifndef LL_MAXQUOTAS
#define LL_MAXQUOTAS 3
#endif
#ifndef LL_MAXQUOTAS
#define LL_MAXQUOTAS 3
#endif
#define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
#endif
#define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
#endif
+#define lustre_fid struct lu_fid
+
extern bool liblustreapi_initialized;
extern bool liblustreapi_initialized;
int llapi_mv(char *path, struct find_param *param);
struct mntent;
int llapi_mv(char *path, struct find_param *param);
struct mntent;
#define HAVE_LLAPI_IS_LUSTRE_MNT
int llapi_is_lustre_mnt(struct mntent *mnt);
int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
#define HAVE_LLAPI_IS_LUSTRE_MNT
int llapi_is_lustre_mnt(struct mntent *mnt);
int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
int llapi_ls(int argc, char *argv[]);
int llapi_fid2path(const char *device, const char *fidstr, char *path,
int pathlen, long long *recno, int *linkno);
int llapi_ls(int argc, char *argv[]);
int llapi_fid2path(const char *device, const char *fidstr, char *path,
int pathlen, long long *recno, int *linkno);
-int llapi_path2fid(const char *path, lustre_fid *fid);
-int llapi_get_mdt_index_by_fid(int fd, const lustre_fid *fid, int *mdt_index);
-int llapi_fd2fid(int fd, lustre_fid *fid);
+int llapi_path2fid(const char *path, struct lu_fid *fid);
+int llapi_get_mdt_index_by_fid(int fd, const struct lu_fid *fid,
+ int *mdt_index);
+int llapi_fd2fid(int fd, struct lu_fid *fid);
/* get FID of parent dir + the related name of entry in this parent dir */
int llapi_path2parent(const char *path, unsigned int linkno,
/* get FID of parent dir + the related name of entry in this parent dir */
int llapi_path2parent(const char *path, unsigned int linkno,
- lustre_fid *parent_fid, char *name, size_t name_size);
-int llapi_fd2parent(int fd, unsigned int linkno, lustre_fid *parent_fid,
+ struct lu_fid *parent_fid, char *name, size_t name_size);
+int llapi_fd2parent(int fd, unsigned int linkno, struct lu_fid *parent_fid,
char *name, size_t name_size);
int llapi_chomp_string(char *buf);
char *name, size_t name_size);
int llapi_chomp_string(char *buf);
-int llapi_open_by_fid(const char *dir, const lustre_fid *fid, int open_flags);
-
+int llapi_open_by_fid(const char *dir, const struct lu_fid *fid,
+ int open_flags);
int llapi_get_version_string(char *version, unsigned int version_size);
/* llapi_get_version() is deprecated, use llapi_get_version_string() instead */
int llapi_get_version(char *buffer, int buffer_size, char **version)
int llapi_get_version_string(char *version, unsigned int version_size);
/* llapi_get_version() is deprecated, use llapi_get_version_string() instead */
int llapi_get_version(char *buffer, int buffer_size, char **version)
const struct hsm_extent *he, __u64 total,
int hp_flags);
int llapi_hsm_action_get_dfid(const struct hsm_copyaction_private *hcp,
const struct hsm_extent *he, __u64 total,
int hp_flags);
int llapi_hsm_action_get_dfid(const struct hsm_copyaction_private *hcp,
int llapi_hsm_action_get_fd(const struct hsm_copyaction_private *hcp);
int llapi_hsm_import(const char *dst, int archive, const struct stat *st,
unsigned long long stripe_size, int stripe_offset,
int stripe_count, int stripe_pattern, char *pool_name,
int llapi_hsm_action_get_fd(const struct hsm_copyaction_private *hcp);
int llapi_hsm_import(const char *dst, int archive, const struct stat *st,
unsigned long long stripe_size, int stripe_offset,
int stripe_count, int stripe_pattern, char *pool_name,
+ struct lu_fid *newfid);
/* HSM user interface */
struct hsm_user_request *llapi_hsm_user_request_alloc(int itemcount,
/* HSM user interface */
struct hsm_user_request *llapi_hsm_user_request_alloc(int itemcount,
* stored in errno.
*/
struct llapi_layout *llapi_layout_get_by_fid(const char *path,
* stored in errno.
*/
struct llapi_layout *llapi_layout_get_by_fid(const char *path,
+ const struct lu_fid *fid,
+#if defined(__cplusplus)
+}
+#endif
+
# include <linux/lustre/lustre_ver.h>
#endif
# include <linux/lustre/lustre_ver.h>
#endif
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
*/
struct hsm_progress_kernel {
/* Field taken from struct hsm_progress */
*/
struct hsm_progress_kernel {
/* Field taken from struct hsm_progress */
__u64 hpk_cookie;
struct hsm_extent hpk_extent;
__u16 hpk_flags;
__u64 hpk_cookie;
struct hsm_extent hpk_extent;
__u16 hpk_flags;
struct lu_ladvise lah_advise[0]; /* advices in this header */
};
struct lu_ladvise lah_advise[0]; /* advices in this header */
};
+#if defined(__cplusplus)
+}
+#endif
+
#endif
/** @} lustreidl */
#endif
/** @} lustreidl */
# include <linux/lustre/lustre_fiemap.h>
#endif /* __KERNEL__ */
# include <linux/lustre/lustre_fiemap.h>
#endif /* __KERNEL__ */
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
/*
* This is a temporary solution of adding quota type.
* Should be removed as soon as system header is updated.
/*
* This is a temporary solution of adding quota type.
* Should be removed as soon as system header is updated.
/* Userspace should treat lu_fid as opaque, and only use the following methods
* to print or parse them. Other functions (e.g. compare, swab) could be moved
* here from lustre_idl.h if needed. */
/* Userspace should treat lu_fid as opaque, and only use the following methods
* to print or parse them. Other functions (e.g. compare, swab) could be moved
* here from lustre_idl.h if needed. */
-typedef struct lu_fid lustre_fid;
enum lma_compat {
LMAC_HSM = 0x00000001,
enum lma_compat {
LMAC_HSM = 0x00000001,
__u64 cr_prev; /**< last index for this target fid */
__u64 cr_time;
union {
__u64 cr_prev; /**< last index for this target fid */
__u64 cr_time;
union {
- lustre_fid cr_tfid; /**< target fid */
+ struct lu_fid cr_tfid; /**< target fid */
__u32 cr_markerflags; /**< CL_MARK flags */
};
__u32 cr_markerflags; /**< CL_MARK flags */
};
- lustre_fid cr_pfid; /**< parent fid */
+ struct lu_fid cr_pfid; /**< parent fid */
};
/* Changelog extension for RENAME. */
struct changelog_ext_rename {
};
/* Changelog extension for RENAME. */
struct changelog_ext_rename {
- lustre_fid cr_sfid; /**< source fid, or zero */
- lustre_fid cr_spfid; /**< source parent fid, or zero */
+ struct lu_fid cr_sfid; /**< source fid, or zero */
+ struct lu_fid cr_spfid; /**< source parent fid, or zero */
};
/* Changelog extension to include JOBID. */
};
/* Changelog extension to include JOBID. */
};
struct hsm_user_item {
};
struct hsm_user_item {
struct hsm_extent hui_extent;
} __attribute__((packed));
struct hsm_extent hui_extent;
} __attribute__((packed));
struct hsm_action_item {
__u32 hai_len; /* valid size of this struct */
__u32 hai_action; /* hsm_copytool_action, but use known size */
struct hsm_action_item {
__u32 hai_len; /* valid size of this struct */
__u32 hai_action; /* hsm_copytool_action, but use known size */
- lustre_fid hai_fid; /* Lustre FID to operate on */
- lustre_fid hai_dfid; /* fid used for data access */
+ struct lu_fid hai_fid; /* Lustre FID to operate on */
+ struct lu_fid hai_dfid; /* fid used for data access */
struct hsm_extent hai_extent; /* byte range to operate on */
__u64 hai_cookie; /* action cookie from coordinator */
__u64 hai_gid; /* grouplock id */
struct hsm_extent hai_extent; /* byte range to operate on */
__u64 hai_cookie; /* action cookie from coordinator */
__u64 hai_gid; /* grouplock id */
#define HP_FLAG_RETRY 0x02
struct hsm_progress {
#define HP_FLAG_RETRY 0x02
struct hsm_progress {
__u64 hp_cookie;
struct hsm_extent hp_extent;
__u16 hp_flags;
__u64 hp_cookie;
struct hsm_extent hp_extent;
__u16 hp_flags;
+#if defined(__cplusplus)
+}
+#endif
+
/** @} lustreuser */
#endif /* _LUSTRE_USER_H */
/** @} lustreuser */
#endif /* _LUSTRE_USER_H */
}
/* Return true if a FID is present in an action list. */
}
/* Return true if a FID is present in an action list. */
-static bool is_fid_in_hal(struct hsm_action_list *hal, const lustre_fid *fid)
+static bool is_fid_in_hal(struct hsm_action_list *hal, const struct lu_fid *fid)
{
struct hsm_action_item *hai;
int i;
{
struct hsm_action_item *hai;
int i;
* 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;
+ 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 fidstr[FID_LEN + 1];
char path1[PATH_MAX];
char path2[PATH_MAX];
char fidstr[FID_LEN + 1];
char path[PATH_MAX];
long long recno;
char fidstr[FID_LEN + 1];
char path[PATH_MAX];
long long recno;
int fd;
int fd2;
int fd3;
int fd;
int fd2;
int fd3;
/* Against a volatile file */
rc = mkdir(mainpath, 0);
/* Against a volatile file */
rc = mkdir(mainpath, 0);
} links[num_links];
char buf[PATH_MAX];
char buf2[PATH_MAX];
} links[num_links];
char buf[PATH_MAX];
char buf2[PATH_MAX];
char fidstr[FID_LEN + 1];
int rc;
int i;
char fidstr[FID_LEN + 1];
int rc;
int i;
* 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;
const int num_links = 100;
struct {
char subdir[PATH_MAX];
const int num_links = 100;
struct {
char subdir[PATH_MAX];
+ struct lu_fid subdir_fid;
char filename[PATH_MAX];
bool seen;
} links[num_links];
char filename[PATH_MAX];
bool seen;
} links[num_links];
int i;
int fd;
int linkno;
int i;
int fd;
int linkno;
+ struct lu_fid parent_fid;
/* Create the containing directory. */
rc = mkdir(mainpath, 0);
/* Create the containing directory. */
rc = mkdir(mainpath, 0);
{
int rc;
struct llapi_layout *layout;
{
int rc;
struct llapi_layout *layout;
char fidstr[4096];
char path[PATH_MAX];
char fidstr[4096];
char path[PATH_MAX];
int save_errno;
int verbose = 0;
int gid = 0;
int save_errno;
int verbose = 0;
int gid = 0;
struct timespec ts;
struct lov_user_md_v3 lum;
__u64 dv;
struct timespec ts;
struct lov_user_md_v3 lum;
__u64 dv;
int rc;
char *filename;
int fd;
int rc;
char *filename;
int fd;
rc = mkdir(mainpath, 0);
ASSERTF(rc == 0, "mkdir failed for '%s': %s",
rc = mkdir(mainpath, 0);
ASSERTF(rc == 0, "mkdir failed for '%s': %s",
char **path;
const char short_opts[] = "p";
const char *sep = "";
char **path;
const char short_opts[] = "p";
const char *sep = "";
int rc = 0;
bool show_parents = false;
int rc = 0;
bool show_parents = false;
}
static int ct_path_lustre(char *buf, int sz, const char *mnt,
}
static int ct_path_lustre(char *buf, int sz, const char *mnt,
+ const struct lu_fid *fid)
{
return snprintf(buf, sz, "%s/%s/fid/"DFID_NOBRACE, mnt,
dot_lustre_name, PFID(fid));
}
static int ct_path_archive(char *buf, int sz, const char *archive_dir,
{
return snprintf(buf, sz, "%s/%s/fid/"DFID_NOBRACE, mnt,
dot_lustre_name, PFID(fid));
}
static int ct_path_archive(char *buf, int sz, const char *archive_dir,
+ const struct lu_fid *fid)
{
return snprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
DFID_NOBRACE, archive_dir,
{
return snprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
DFID_NOBRACE, archive_dir,
static int ct_import_one(const char *src, const char *dst)
{
char newarc[PATH_MAX];
static int ct_import_one(const char *src, const char *dst)
{
char newarc[PATH_MAX];
-static int ct_import_fid(const lustre_fid *import_fid)
+static int ct_import_fid(const struct lu_fid *import_fid)
{
char fid_path[PATH_MAX];
int rc;
{
char fid_path[PATH_MAX];
int rc;
DIR *dir;
struct dirent *ent;
char *srcpath, *newpath;
DIR *dir;
struct dirent *ent;
char *srcpath, *newpath;
+ struct lu_fid import_fid;
int rc;
if (relpath == NULL)
int rc;
if (relpath == NULL)
-static int ct_rebind_one(const lustre_fid *old_fid, const lustre_fid *new_fid)
+static int ct_rebind_one(const struct lu_fid *old_fid,
+ const struct lu_fid *new_fid)
{
char src[PATH_MAX];
char dst[PATH_MAX];
{
char src[PATH_MAX];
char dst[PATH_MAX];
-static bool fid_is_file(lustre_fid *fid)
+static bool fid_is_file(struct lu_fid *fid)
{
return fid_is_norm(fid) || fid_is_igif(fid);
}
{
return fid_is_norm(fid) || fid_is_igif(fid);
}
/* each line consists of 2 FID */
while ((r = getline(&line, &line_size, filp)) != -1) {
/* each line consists of 2 FID */
while ((r = getline(&line, &line_size, filp)) != -1) {
- lustre_fid old_fid;
- lustre_fid new_fid;
+ struct lu_fid old_fid;
+ struct lu_fid new_fid;
/* Ignore empty and commented out ('#...') lines. */
if (should_ignore_line(line))
/* Ignore empty and commented out ('#...') lines. */
if (should_ignore_line(line))
- lustre_fid old_fid;
- lustre_fid new_fid;
+ struct lu_fid old_fid;
+ struct lu_fid new_fid;
if (sscanf(opt.o_src, SFID, RFID(&old_fid)) != 3 ||
!fid_is_file(&old_fid)) {
if (sscanf(opt.o_src, SFID, RFID(&old_fid)) != 3 ||
!fid_is_file(&old_fid)) {
-static int fid_from_lma(const char *path, int fd, lustre_fid *fid)
+static int fid_from_lma(const char *path, int fd, struct lu_fid *fid)
{
char buf[512];
struct lustre_mdt_attrs *lma;
{
char buf[512];
struct lustre_mdt_attrs *lma;
-int llapi_get_mdt_index_by_fid(int fd, const lustre_fid *fid,
+int llapi_get_mdt_index_by_fid(int fd, const struct lu_fid *fid,
int *mdt_index)
{
int rc;
int *mdt_index)
{
int rc;
-int llapi_fd2fid(int fd, lustre_fid *fid)
+int llapi_fd2fid(int fd, struct lu_fid *fid)
-int llapi_path2fid(const char *path, lustre_fid *fid)
+int llapi_path2fid(const char *path, struct lu_fid *fid)
-int llapi_fd2parent(int fd, unsigned int linkno, lustre_fid *parent_fid,
+int llapi_fd2parent(int fd, unsigned int linkno, struct lu_fid *parent_fid,
char *name, size_t name_size)
{
struct getparent *gp;
char *name, size_t name_size)
{
struct getparent *gp;
}
int llapi_path2parent(const char *path, unsigned int linkno,
}
int llapi_path2parent(const char *path, unsigned int linkno,
- lustre_fid *parent_fid, char *name, size_t name_size)
+ struct lu_fid *parent_fid, char *name, size_t name_size)
* \retval non-negative file descriptor on successful open
* \retval -1 if an error occurred
*/
* \retval non-negative file descriptor on successful open
* \retval -1 if an error occurred
*/
-int llapi_open_by_fid(const char *lustre_dir, const lustre_fid *fid, int flags)
+int llapi_open_by_fid(const char *lustre_dir, const struct lu_fid *fid,
+ int flags)
{
char mntdir[PATH_MAX];
char path[PATH_MAX];
{
char mntdir[PATH_MAX];
char path[PATH_MAX];
* \param parent_len Destination buffer size.
* \return 0 on success.
*/
* \param parent_len Destination buffer size.
* \return 0 on success.
*/
-static int fid_parent(const char *mnt, const lustre_fid *fid, char *parent,
+static int fid_parent(const char *mnt, const struct lu_fid *fid, char *parent,
size_t parent_len)
{
int rc;
size_t parent_len)
{
int rc;
* @return error code if the action is not a copy operation.
*/
int llapi_hsm_action_get_dfid(const struct hsm_copyaction_private *hcp,
* @return error code if the action is not a copy operation.
*/
int llapi_hsm_action_get_dfid(const struct hsm_copyaction_private *hcp,
{
const struct hsm_action_item *hai = &hcp->copy.hc_hai;
{
const struct hsm_action_item *hai = &hcp->copy.hc_hai;
int llapi_hsm_import(const char *dst, int archive, const struct stat *st,
unsigned long long stripe_size, int stripe_offset,
int stripe_count, int stripe_pattern, char *pool_name,
int llapi_hsm_import(const char *dst, int archive, const struct stat *st,
unsigned long long stripe_size, int stripe_offset,
int stripe_count, int stripe_pattern, char *pool_name,
{
struct hsm_user_import hui;
int fd;
{
struct hsm_user_import hui;
int fd;
* \retval NULL if an error occurs
*/
struct llapi_layout *llapi_layout_get_by_fid(const char *lustre_dir,
* \retval NULL if an error occurs
*/
struct llapi_layout *llapi_layout_get_by_fid(const char *lustre_dir,
+ const struct lu_fid *fid,
uint32_t flags)
{
int fd;
uint32_t flags)
{
int fd;