4 /* This is unfortunately needed for older lustre_user.h to be usable */
5 #define LASSERT(cond) do { } while (0)
7 #ifdef HAVE_LUSTRE_LUSTREAPI_H
8 #include <lustre/lustreapi.h>
9 #elif HAVE_LUSTRE_LIBLUSTREAPI_H
10 #include <lustre/liblustreapi.h>
14 #define DFID "[%#llx:0x%x:0x%x]"
15 #define PFID(fid) (unsigned long long)fid_seq(fid), fid_oid(fid), fid_ver(fid)
23 /* Unfortunately, neither the 1.8 or 2.x lustre_idl.h file is suitable
24 * for inclusion by userspace programs because of external dependencies.
25 * Define the minimum set of replacement functions here until that is fixed. */
26 #ifndef HAVE_LUSTRE_LUSTRE_IDL_H
27 #define fid_seq(fid) ((fid)->f_seq)
28 #define fid_oid(fid) ((fid)->f_oid)
29 #define fid_ver(fid) ((fid)->f_ver)
31 static inline void fid_be_to_cpu(struct lu_fid *dst, struct lu_fid *src)
33 dst->f_seq = ext2fs_be64_to_cpu(src->f_seq);
34 dst->f_oid = ext2fs_be32_to_cpu(src->f_oid);
35 dst->f_ver = ext2fs_be32_to_cpu(src->f_ver);
38 static inline void fid_le_to_cpu(struct lu_fid *dst, struct lu_fid *src)
40 dst->f_seq = ext2fs_le64_to_cpu(src->f_seq);
41 dst->f_oid = ext2fs_le32_to_cpu(src->f_oid);
42 dst->f_ver = ext2fs_le32_to_cpu(src->f_ver);
44 #endif /* HAVE_LUSTRE_LUSTRE_IDL_H */
46 #define LUSTRE_XATTR_MDT_LOV "lov"
47 #define LUSTRE_XATTR_MDT_LMA "lma"
48 #define LUSTRE_XATTR_MDT_LINK "link"
49 #define LUSTRE_XATTR_OST_FID "fid"
52 #ifndef LMA_INCOMPAT_SUPP
53 struct lustre_mdt_attrs {
56 struct lu_fid lma_self_fid;
58 struct lustre_ost_attrs {
59 struct lustre_mdt_attrs loa_lma;
60 struct lu_fid loa_parent_fid;
61 __u32 loa_stripe_size;
68 struct filter_fid_old {
69 struct lu_fid ff_parent;
75 struct lu_fid ff_parent;
77 __u32 ff_stripe_count;
83 #define LMA_OLD_SIZE 64
84 #endif /* !LMA_OLD_SIZE */
86 #define PFID_STRIPE_IDX_BITS 16
87 #define PFID_STRIPE_COUNT_MASK ((1 << PFID_STRIPE_IDX_BITS) - 1)
90 /** Hardlink data is name and parent fid.
91 * Stored in this crazy struct for maximum packing and endian-neutrality */
92 struct link_ea_entry {
93 /** lee_reclen is a __u16 stored big-endian, unaligned */
94 unsigned char lee_reclen[2]; /* record size in bytes */
95 unsigned char lee_parent_fid[sizeof(struct lu_fid)];
96 char lee_name[0]; /* filename without trailing NUL */
97 }__attribute__((packed));
99 /** The link ea holds 1 \a link_ea_entry for each hardlink */
100 #define LINK_EA_MAGIC 0x11EAF1DFUL
101 struct link_ea_header {
102 __u32 leh_magic; /* LINK_EA_MAGIC */
103 __u32 leh_reccount; /* number of records in leh_entry[] */
104 __u64 leh_len; /* total size in bytes */
105 __u32 leh_overflow_time; /* when link xattr ran out of space */
107 /* struct link_ea_entry leh_entry; packed array of variable-size entries */