Index: 2.4.x-xfs/fs/quota.c =================================================================== --- 2.4.x-xfs.orig/fs/quota.c 2004-10-19 10:26:51.000000000 +1000 +++ 2.4.x-xfs/fs/quota.c 2005-06-06 12:41:17.369225868 +1000 @@ -16,13 +16,12 @@ struct dqstats dqstats; +/* Macros for short-circuiting the compatibility tests */ +#define NEW_COMMAND(c) ((c) & (0x80 << 16)) + /* Check validity of quotactl */ static int check_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id) { - if (type >= MAXQUOTAS) - return -EINVAL; - if (!sb && cmd != Q_SYNC) - return -ENODEV; /* Is operation supported? */ if (sb && !sb->s_qcop) return -ENOSYS; @@ -447,10 +446,6 @@ return 0; } -/* Macros for short-circuiting the compatibility tests */ -#define NEW_COMMAND(c) ((c) & (0x80 << 16)) -#define XQM_COMMAND(c) (((c) & ('X' << 8)) == ('X' << 8)) - /* * This is the system call interface. This communicates with * the user-level programs. Currently this only supports diskquota @@ -472,7 +467,17 @@ sb = NULL; goto out; } - if (!NEW_COMMAND(cmds) && !XQM_COMMAND(cmds)) { + if (NEW_COMMAND(cmds)) { + if (type >= MAXQUOTAS) + return -EINVAL; + if (!sb && cmds != Q_SYNC) + return -ENODEV; + } else if (XQM_COMMAND(cmds)) { + if (type >= XQM_MAXQUOTAS) + return -EINVAL; + if (!sb) + return -ENODEV; + } else { if ((ret = check_compat_quotactl_valid(sb, type, cmds, id)) < 0) goto out; ret = do_compat_quotactl(sb, type, cmds, id, addr); Index: 2.4.x-xfs/include/linux/dqblk_xfs.h =================================================================== --- 2.4.x-xfs.orig/include/linux/dqblk_xfs.h 2005-01-20 16:07:41.000000000 +1100 +++ 2.4.x-xfs/include/linux/dqblk_xfs.h 2005-06-06 12:41:17.370202431 +1000 @@ -28,6 +28,13 @@ */ #define XQM_CMD(x) (('X'<<8)+(x)) /* note: forms first QCMD argument */ +#define XQM_COMMAND(x) (((x) & (0xff<<8)) == ('X'<<8)) /* test if for XFS */ + +#define XQM_USRQUOTA 0 /* system call user quota type */ +#define XQM_GRPQUOTA 1 /* system call group quota type */ +#define XQM_PRJQUOTA 2 /* system call project quota type */ +#define XQM_MAXQUOTAS 3 + #define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ #define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ #define Q_XGETQUOTA XQM_CMD(3) /* get disk limits and usage */