Subject: [PATCH 1/2] serial: Add flush_buffer() operation to uart_ops
[sfrench/cifs-2.6.git] / include / linux / quota.h
index 62439828395e3f3faa424f3305844713f02aca60..dcddfb2009479f42a543363d0c0873c76d4bfcee 100644 (file)
@@ -128,15 +128,50 @@ struct if_dqinfo {
        __u32 dqi_valid;
 };
 
+/*
+ * Definitions for quota netlink interface
+ */
+#define QUOTA_NL_NOWARN 0
+#define QUOTA_NL_IHARDWARN 1           /* Inode hardlimit reached */
+#define QUOTA_NL_ISOFTLONGWARN 2       /* Inode grace time expired */
+#define QUOTA_NL_ISOFTWARN 3           /* Inode softlimit reached */
+#define QUOTA_NL_BHARDWARN 4           /* Block hardlimit reached */
+#define QUOTA_NL_BSOFTLONGWARN 5       /* Block grace time expired */
+#define QUOTA_NL_BSOFTWARN 6           /* Block softlimit reached */
+
+enum {
+       QUOTA_NL_C_UNSPEC,
+       QUOTA_NL_C_WARNING,
+       __QUOTA_NL_C_MAX,
+};
+#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
+
+enum {
+       QUOTA_NL_A_UNSPEC,
+       QUOTA_NL_A_QTYPE,
+       QUOTA_NL_A_EXCESS_ID,
+       QUOTA_NL_A_WARNING,
+       QUOTA_NL_A_DEV_MAJOR,
+       QUOTA_NL_A_DEV_MINOR,
+       QUOTA_NL_A_CAUSED_ID,
+       __QUOTA_NL_A_MAX,
+};
+#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
+
+
 #ifdef __KERNEL__
-#include <linux/spinlock.h>
-#include <linux/rwsem.h>
+#include <linux/list.h>
 #include <linux/mutex.h>
+#include <linux/rwsem.h>
+#include <linux/spinlock.h>
+#include <linux/wait.h>
 
 #include <linux/dqblk_xfs.h>
 #include <linux/dqblk_v1.h>
 #include <linux/dqblk_v2.h>
 
+#include <asm/atomic.h>
+
 extern spinlock_t dq_data_lock;
 
 /* Maximal numbers of writes for quota operation (insert/delete/update)
@@ -167,10 +202,14 @@ struct quota_format_type;
 
 struct mem_dqinfo {
        struct quota_format_type *dqi_format;
+       int dqi_fmt_id;         /* Id of the dqi_format - used when turning
+                                * quotas on after remount RW */
        struct list_head dqi_dirty_list;        /* List of dirty dquots */
        unsigned long dqi_flags;
        unsigned int dqi_bgrace;
        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;
@@ -261,8 +300,8 @@ struct dquot_operations {
 
 /* Operations handling requests from userspace */
 struct quotactl_ops {
-       int (*quota_on)(struct super_block *, int, int, char *);
-       int (*quota_off)(struct super_block *, int);
+       int (*quota_on)(struct super_block *, int, int, char *, int);
+       int (*quota_off)(struct super_block *, int, int);
        int (*quota_sync)(struct super_block *, int);
        int (*get_info)(struct super_block *, int, struct if_dqinfo *);
        int (*set_info)(struct super_block *, int, struct if_dqinfo *);
@@ -283,6 +322,10 @@ struct quota_format_type {
 
 #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
+                                                * we have necessary info in
+                                                * memory to turn them on */
+#define DQUOT_GRP_SUSPENDED    0x08            /* The same for group quotas */
 
 struct quota_info {
        unsigned int flags;                     /* Flags for diskquotas on this device */
@@ -294,17 +337,19 @@ struct quota_info {
        struct quota_format_ops *ops[MAXQUOTAS];        /* Operations for each type */
 };
 
-/* Inline would be better but we need to dereference super_block which is not defined yet */
-int mark_dquot_dirty(struct dquot *dquot);
-
-#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)
-
 #define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
        (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
 
 #define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
                                  sb_has_quota_enabled(sb, GRPQUOTA))
 
+#define sb_has_quota_suspended(sb, type) \
+       ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
+                             (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
+
+#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
+                                 sb_has_quota_suspended(sb, GRPQUOTA))
+
 int register_quota_format(struct quota_format_type *fmt);
 void unregister_quota_format(struct quota_format_type *fmt);