This patch defines a generic lquota_id structure which is an union
of all the possible identifier types that can be used with quota,
this includes:
- 64-bit user ID
- 64-bit group ID
- a FID which can be used for per-directory quota in the future
Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Change-Id: Idead35f27ee9d07b9b25f39b791a1ad8778e0f2d
Reviewed-on: http://review.whamcloud.com/3888
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b);
extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b);
+/* The lquota_id structure is an union of all the possible identifier types that
+ * can be used with quota, this includes:
+ * - 64-bit user ID
+ * - 64-bit group ID
+ * - a FID which can be used for per-directory quota in the future */
+union lquota_id {
+ struct lu_fid qid_fid; /* FID for per-directory quota */
+ __u64 qid_uid; /* user identifier */
+ __u64 qid_gid; /* group identifier */
+};
+
#define Q_QUOTACHECK 0x800100
#define Q_INITQUOTA 0x800101 /* init slave limits */
#define Q_GETOINFO 0x800102 /* get obd quota info */
#define Q_QUOTACHECK 0x800100
#define Q_INITQUOTA 0x800101 /* init slave limits */
#define Q_GETOINFO 0x800102 /* get obd quota info */
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
+ /* Checks for union lquota_id */
+ LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
+ (long long)(int)sizeof(union lquota_id));
+
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
(long long)(int)sizeof(struct obd_quotactl));
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
(long long)(int)sizeof(struct obd_quotactl));
CHECK_VALUE((int)sizeof(s)); \
} while(0)
CHECK_VALUE((int)sizeof(s)); \
} while(0)
+#define CHECK_UNION(s) \
+do { \
+ COMMENT("Checks for union "#s); \
+ CHECK_VALUE((int)sizeof(union s)); \
+} while(0)
+
#define CHECK_VALUE_SAME(v1, v2) \
do { \
printf("\tLASSERTF("#v1" == "#v2", " \
#define CHECK_VALUE_SAME(v1, v2) \
do { \
printf("\tLASSERTF("#v1" == "#v2", " \
static void
check_obd_quotactl(void)
{
static void
check_obd_quotactl(void)
{
+ BLANK_LINE();
+ CHECK_UNION(lquota_id);
+
BLANK_LINE();
CHECK_STRUCT(obd_quotactl);
CHECK_MEMBER(obd_quotactl, qc_cmd);
BLANK_LINE();
CHECK_STRUCT(obd_quotactl);
CHECK_MEMBER(obd_quotactl, qc_cmd);
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
(long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
+ /* Checks for union lquota_id */
+ LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
+ (long long)(int)sizeof(union lquota_id));
+
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
(long long)(int)sizeof(struct obd_quotactl));
/* Checks for struct obd_quotactl */
LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
(long long)(int)sizeof(struct obd_quotactl));