#include <lustre/lustre_user.h>
#include <lustre/lustre_errno.h>
+#include <lustre_ver.h>
/*
* GENERAL STUFF
fid_seq_is_rsvd(fid_seq(fid)));
}
-static inline bool fid_is_zero(const struct lu_fid *fid)
-{
- return fid_seq(fid) == 0 && fid_oid(fid) == 0;
-}
-
extern void lustre_swab_lu_fid(struct lu_fid *fid);
extern void lustre_swab_lu_seq_range(struct lu_seq_range *range);
#define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_IBITS | OBD_CONNECT_FID | \
OBD_CONNECT_FULL20)
-#define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\
- ((patch)<<8) + (fix))
-#define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
-#define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255)
-#define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255)
-#define OBD_OCD_VERSION_FIX(version) ((int)(version)&255)
-
/* This structure is used for both request and reply.
*
* If we eventually have separate connect data for different types, which we
#define LOV_MAGIC_V1_DEF 0x0CD10BD0
#define LOV_MAGIC_V3_DEF 0x0CD30BD0
-#define LOV_PATTERN_RAID0 0x001 /* stripes are used round-robin */
-#define LOV_PATTERN_RAID1 0x002 /* stripes are mirrors of each other */
-#define LOV_PATTERN_FIRST 0x100 /* first stripe is not in round-robin */
-#define LOV_PATTERN_CMOBD 0x200
-
-#define LOV_PATTERN_F_MASK 0xffff0000
-#define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
-
#define lov_pattern(pattern) (pattern & ~LOV_PATTERN_F_MASK)
#define lov_pattern_flags(pattern) (pattern & LOV_PATTERN_F_MASK)
* space for unstable pages; asking
* it to sync quickly */
-#define OBD_OBJECT_EOF 0xffffffffffffffffULL
+#define OBD_OBJECT_EOF LUSTRE_EOF
#define OST_MIN_PRECREATE 32
#define OST_MAX_PRECREATE 20000
*/
#ifndef QUOTABLOCK_BITS
-#define QUOTABLOCK_BITS 10
+# define QUOTABLOCK_BITS LUSTRE_QUOTABLOCK_BITS
#endif
#ifndef QUOTABLOCK_SIZE
-#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
+# define QUOTABLOCK_SIZE LUSTRE_QUOTABLOCK_SIZE
#endif
#ifndef toqb
-#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
+# define toqb lustre_stoqb
#endif
/* The lquota_id structure is an union of all the possible identifier types that
extern void lustre_swab_obd_quotactl(struct obd_quotactl *q);
-#define Q_QUOTACHECK 0x800100 /* deprecated as of 2.4 */
-#define Q_INITQUOTA 0x800101 /* deprecated as of 2.4 */
-#define Q_GETOINFO 0x800102 /* get obd quota info */
-#define Q_GETOQUOTA 0x800103 /* get obd quotas */
-#define Q_FINVALIDATE 0x800104 /* deprecated as of 2.4 */
-
#define Q_COPY(out, in, member) (out)->member = (in)->member
#define QCTL_COPY(out, in) \
* and the higher part will be the flag to indicate the status of object,
* for example the object is being migrated. And the hash function
* might be interpreted differently with different flags. */
-enum lmv_hash_type {
- LMV_HASH_TYPE_ALL_CHARS = 1,
- LMV_HASH_TYPE_FNV_1A_64 = 2,
-};
-
#define LMV_HASH_TYPE_MASK 0x0000ffff
#define LMV_HASH_FLAG_MIGRATION 0x80000000
#define LMV_HASH_FLAG_DEAD 0x40000000
-#define LMV_HASH_NAME_ALL_CHARS "all_char"
-#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64"
-
/**
* The FNV-1a hash algorithm is as follows:
* hash = FNV_offset_basis
#error Unsupported operating system.
#endif
+#define LUSTRE_EOF 0xffffffffffffffffULL
+
/* for statfs() */
#define LL_SUPER_MAGIC 0x0BD00BD0
__u32 f_ver;
};
+static inline bool fid_is_zero(const struct lu_fid *fid)
+{
+ return fid->f_seq == 0 && fid->f_oid == 0;
+}
+
/* Currently, the filter_fid::ff_parent::f_ver is not the real parent
* MDT-object's FID::f_ver, instead it is the OST-object index in its
* parent MDT-object's layout EA. */
#define LMV_USER_MAGIC 0x0CD30CD0 /*default lmv magic*/
-#define LOV_PATTERN_RAID0 0x001
-#define LOV_PATTERN_RAID1 0x002
-#define LOV_PATTERN_FIRST 0x100
+#define LOV_PATTERN_RAID0 0x001
+#define LOV_PATTERN_RAID1 0x002
+#define LOV_PATTERN_FIRST 0x100
+#define LOV_PATTERN_CMOBD 0x200
+
+#define LOV_PATTERN_F_MASK 0xffff0000
+#define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
#define LOV_MAXPOOLNAME 16
#define LOV_POOLNAMEF "%.16s"
__u32 lum_mds;
};
+enum lmv_hash_type {
+ LMV_HASH_TYPE_ALL_CHARS = 1,
+ LMV_HASH_TYPE_FNV_1A_64 = 2,
+};
+
+#define LMV_HASH_NAME_ALL_CHARS "all_char"
+#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64"
+
/* Got this according to how get LOV_MAX_STRIPE_COUNT, see above,
* (max buffer size - lmv+rpc header) / sizeof(struct lmv_user_mds_data) */
#define LMV_MAX_STRIPE_COUNT 2000 /* ((12 * 4096 - 256) / 24) */
/********* Quotas **********/
+#define LUSTRE_QUOTABLOCK_BITS 10
+#define LUSTRE_QUOTABLOCK_SIZE (1 << LUSTRE_QUOTABLOCK_BITS)
+
+static inline __u64 lustre_stoqb(size_t space)
+{
+ return (space + LUSTRE_QUOTABLOCK_SIZE - 1) >> LUSTRE_QUOTABLOCK_BITS;
+}
+
+#define Q_QUOTACHECK 0x800100 /* deprecated as of 2.4 */
+#define Q_INITQUOTA 0x800101 /* deprecated as of 2.4 */
+#define Q_GETOINFO 0x800102 /* get obd quota info */
+#define Q_GETOQUOTA 0x800103 /* get obd quotas */
+#define Q_FINVALIDATE 0x800104 /* deprecated as of 2.4 */
+
/* these must be explicitly translated into linux Q_* in ll_dir_ioctl */
#define LUSTRE_Q_QUOTAON 0x800002 /* turn quotas on */
#define LUSTRE_Q_QUOTAOFF 0x800003 /* turn quotas off */
#define LUSTRE_FIX @AC_LUSTRE_FIX@
#define LUSTRE_VERSION_STRING "@AC_LUSTRE_VERSION_STRING@"
-#define LUSTRE_VERSION_CODE OBD_OCD_VERSION(LUSTRE_MAJOR,LUSTRE_MINOR,LUSTRE_PATCH,LUSTRE_FIX)
+#define OBD_OCD_VERSION(major, minor, patch, fix) \
+ (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))
+
+#define OBD_OCD_VERSION_MAJOR(version) ((int)((version) >> 24) & 255)
+#define OBD_OCD_VERSION_MINOR(version) ((int)((version) >> 16) & 255)
+#define OBD_OCD_VERSION_PATCH(version) ((int)((version) >> 8) & 255)
+#define OBD_OCD_VERSION_FIX(version) ((int)((version) >> 0) & 255)
+
+#define LUSTRE_VERSION_CODE \
+ OBD_OCD_VERSION(LUSTRE_MAJOR, LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX)
/* liblustre clients are only allowed to connect if their LUSTRE_FIX mismatches
* by this amount (set in lustre/autoconf/lustre-version.ac). */
#include <err.h>
#include <pwd.h>
#include <grp.h>
+#include <sys/quota.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
# include <sys/quota.h>
#endif
-/* For dirname() */
-#include <libgen.h>
-
-#include <lnet/lnetctl.h>
-
#include <libcfs/libcfs.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/lustreapi.h>
-
#include <libcfs/libcfsutil.h>
+#include <lnet/lnetctl.h>
+#include <lustre/lustreapi.h>
+#include <lustre_ver.h>
#include "obdctl.h"
/* all functions */
char strbuf[32];
if (dqb->dqb_bhardlimit &&
- toqb(dqb->dqb_curspace) >= dqb->dqb_bhardlimit) {
+ lustre_stoqb(dqb->dqb_curspace) >= dqb->dqb_bhardlimit) {
bover = 1;
} else if (dqb->dqb_bsoftlimit && dqb->dqb_btime) {
if (dqb->dqb_btime > now) {
if (bover)
diff2str(dqb->dqb_btime, timebuf, now);
- kbytes2str(toqb(dqb->dqb_curspace), strbuf, h);
+ kbytes2str(lustre_stoqb(dqb->dqb_curspace), strbuf, h);
if (rc == -EREMOTEIO)
sprintf(numbuf[0], "%s*", strbuf);
else
/* namespace rec includes parent and filename */
printf(" p="DFID" %.*s", PFID(&rec->cr_pfid),
rec->cr_namelen, rec->cr_name);
- if (fid_is_sane(&rec->cr_sfid))
+
+ if (!fid_is_zero(&rec->cr_sfid))
printf(" s="DFID" sp="DFID" %.*s",
PFID(&rec->cr_sfid), PFID(&rec->cr_spfid),
changelog_rec_snamelen(rec),
if ((hps == HPS_RUNNING) &&
(hua == HUA_ARCHIVE || hua == HUA_RESTORE))
printf("("LPX64 " bytes moved)\n", he.length);
- else if ((he.offset + he.length) == OBD_OBJECT_EOF)
+ else if ((he.offset + he.length) == LUSTRE_EOF)
printf("(from "LPX64 " to EOF)\n", he.offset);
else
printf("(from "LPX64 " to "LPX64")\n",
return rc < 0 ? -rc : rc;
}
+#ifdef _LUSTRE_IDL_H_
+/* Everything we need here should be included by lustreapi.h. */
+# error "lfs should not depend on lustre_idl.h"
+#endif /* _LUSTRE_IDL_H_ */