Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[safe/jmp/linux-2.6] / include / linux / quota.h
index 9ea4683..d72d5d8 100644 (file)
@@ -36,8 +36,7 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 
-#define __DQUOT_VERSION__      "dquot_6.5.1"
-#define __DQUOT_NUM_VERSION__  6*10000+5*100+1
+#define __DQUOT_VERSION__      "dquot_6.5.2"
 
 #define MAXQUOTAS 2
 #define USRQUOTA  0            /* element used for user quotas */
 #define Q_GETQUOTA 0x800007    /* get user quota structure */
 #define Q_SETQUOTA 0x800008    /* set user quota structure */
 
+/* Quota format type IDs */
+#define        QFMT_VFS_OLD 1
+#define        QFMT_VFS_V0 2
+
 /* Size of block in which space limits are passed through the quota
  * interface */
 #define QIF_DQBLKSIZE_BITS 10
  * Quota structure used for communication with userspace via quotactl
  * Following flags are used to specify which fields are valid
  */
-#define QIF_BLIMITS    1
-#define QIF_SPACE      2
-#define QIF_ILIMITS    4
-#define QIF_INODES     8
-#define QIF_BTIME      16
-#define QIF_ITIME      32
+enum {
+       QIF_BLIMITS_B = 0,
+       QIF_SPACE_B,
+       QIF_ILIMITS_B,
+       QIF_INODES_B,
+       QIF_BTIME_B,
+       QIF_ITIME_B,
+};
+
+#define QIF_BLIMITS    (1 << QIF_BLIMITS_B)
+#define QIF_SPACE      (1 << QIF_SPACE_B)
+#define QIF_ILIMITS    (1 << QIF_ILIMITS_B)
+#define QIF_INODES     (1 << QIF_INODES_B)
+#define QIF_BTIME      (1 << QIF_BTIME_B)
+#define QIF_ITIME      (1 << QIF_ITIME_B)
 #define QIF_LIMITS     (QIF_BLIMITS | QIF_ILIMITS)
 #define QIF_USAGE      (QIF_SPACE | QIF_INODES)
 #define QIF_TIMES      (QIF_BTIME | QIF_ITIME)
@@ -168,7 +180,7 @@ enum {
 #include <asm/atomic.h>
 
 typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
-typedef __u64 qsize_t;          /* Type in which we store sizes */
+typedef long long qsize_t;     /* Type in which we store sizes */
 
 extern spinlock_t dq_data_lock;
 
@@ -208,10 +220,7 @@ struct mem_dqinfo {
        unsigned int dqi_igrace;
        qsize_t dqi_maxblimit;
        qsize_t dqi_maxilimit;
-       union {
-               struct v1_mem_dqinfo v1_i;
-               struct v2_mem_dqinfo v2_i;
-       } u;
+       void *dqi_priv;
 };
 
 struct super_block;
@@ -245,6 +254,11 @@ extern struct dqstats dqstats;
 #define DQ_FAKE_B      3       /* no limits only usage */
 #define DQ_READ_B      4       /* dquot was read into memory */
 #define DQ_ACTIVE_B    5       /* dquot is active (dquot_release not called) */
+#define DQ_LASTSET_B   6       /* Following 6 bits (see QIF_) are reserved\
+                                * for the mask of entries set via SETQUOTA\
+                                * quotactl. They are set under dq_data_lock\
+                                * and the quota format handling dquot can\
+                                * clear them when it sees fit. */
 
 struct dquot {
        struct hlist_node dq_hash;      /* Hash list in memory */
@@ -318,12 +332,42 @@ struct quota_format_type {
        struct quota_format_type *qf_next;
 };
 
-#define DQUOT_USR_ENABLED      0x01            /* User diskquotas enabled */
-#define DQUOT_GRP_ENABLED      0x02            /* Group diskquotas enabled */
-#define DQUOT_USR_SUSPENDED    0x04            /* User diskquotas are off, but
+/* Quota state flags - they actually come in two flavors - for users and groups */
+enum {
+       _DQUOT_USAGE_ENABLED = 0,               /* Track disk usage for users */
+       _DQUOT_LIMITS_ENABLED,                  /* Enforce quota limits for users */
+       _DQUOT_SUSPENDED,                       /* User diskquotas are off, but
                                                 * we have necessary info in
                                                 * memory to turn them on */
-#define DQUOT_GRP_SUSPENDED    0x08            /* The same for group quotas */
+       _DQUOT_STATE_FLAGS
+};
+#define DQUOT_USAGE_ENABLED    (1 << _DQUOT_USAGE_ENABLED)
+#define DQUOT_LIMITS_ENABLED   (1 << _DQUOT_LIMITS_ENABLED)
+#define DQUOT_SUSPENDED                (1 << _DQUOT_SUSPENDED)
+#define DQUOT_STATE_FLAGS      (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
+                                DQUOT_SUSPENDED)
+/* Other quota flags */
+#define DQUOT_QUOTA_SYS_FILE   (1 << 6)        /* Quota file is a special
+                                                * system file and user cannot
+                                                * touch it. Filesystem is
+                                                * responsible for setting
+                                                * S_NOQUOTA, S_NOATIME flags
+                                                */
+#define DQUOT_NEGATIVE_USAGE   (1 << 7)        /* Allow negative quota usage */
+
+static inline unsigned int dquot_state_flag(unsigned int flags, int type)
+{
+       if (type == USRQUOTA)
+               return flags;
+       return flags << _DQUOT_STATE_FLAGS;
+}
+
+static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
+{
+       if (type == USRQUOTA)
+               return flags;
+       return flags >> _DQUOT_STATE_FLAGS;
+}
 
 struct quota_info {
        unsigned int flags;                     /* Flags for diskquotas on this device */