]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/quotaops.h
fbdev/logo: check compatibility of main and extra logos
[linux-2.6-omap-h63xx.git] / include / linux / quotaops.h
index ffd97071cd1e5082a3376d6824acaf8a01f29eda..21b781a3350f6cb939ae53510095341603edc99d 100644 (file)
@@ -24,6 +24,15 @@ void sync_dquots(struct super_block *sb, int type);
 
 int dquot_initialize(struct inode *inode, int type);
 int dquot_drop(struct inode *inode);
+int dquot_drop_locked(struct inode *inode);
+struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
+void dqput(struct dquot *dquot);
+int dquot_is_cached(struct super_block *sb, unsigned int id, int type);
+int dquot_scan_active(struct super_block *sb,
+                     int (*fn)(struct dquot *dquot, unsigned long priv),
+                     unsigned long priv);
+struct dquot *dquot_alloc(struct super_block *sb, int type);
+void dquot_destroy(struct dquot *dquot);
 
 int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
 int dquot_alloc_inode(const struct inode *inode, qsize_t number);
@@ -40,11 +49,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
 
 int vfs_quota_on(struct super_block *sb, int type, int format_id,
        char *path, int remount);
+int vfs_quota_enable(struct inode *inode, int type, int format_id,
+       unsigned int flags);
 int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
        struct path *path);
 int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
        int format_id, int type);
 int vfs_quota_off(struct super_block *sb, int type, int remount);
+int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
 int vfs_quota_sync(struct super_block *sb, int type);
 int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
 int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -64,26 +76,22 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
  * Functions for checking status of quota
  */
 
-static inline int sb_has_quota_enabled(struct super_block *sb, int type)
+static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
 {
-       if (type == USRQUOTA)
-               return (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED)
-                       && !(sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED);
-       return (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)
-               && !(sb_dqopt(sb)->flags & DQUOT_GROUP_SUSPENDED);
+       return sb_dqopt(sb)->flags &
+                               dquot_state_flag(DQUOT_USAGE_ENABLED, type);
 }
 
-static inline int sb_any_quota_enabled(struct super_block *sb)
+static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
 {
-       return sb_has_quota_enabled(sb, USRQUOTA) ||
-               sb_has_quota_enabled(sb, GRPQUOTA);
+       return sb_dqopt(sb)->flags &
+                               dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
 }
 
 static inline int sb_has_quota_suspended(struct super_block *sb, int type)
 {
-       if (type == USRQUOTA)
-               return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED;
-       return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
+       return sb_dqopt(sb)->flags &
+                               dquot_state_flag(DQUOT_SUSPENDED, type);
 }
 
 static inline int sb_any_quota_suspended(struct super_block *sb)
@@ -92,6 +100,31 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
                sb_has_quota_suspended(sb, GRPQUOTA);
 }
 
+/* Does kernel know about any quota information for given sb + type? */
+static inline int sb_has_quota_loaded(struct super_block *sb, int type)
+{
+       /* Currently if anything is on, then quota usage is on as well */
+       return sb_has_quota_usage_enabled(sb, type);
+}
+
+static inline int sb_any_quota_loaded(struct super_block *sb)
+{
+       return sb_has_quota_loaded(sb, USRQUOTA) ||
+               sb_has_quota_loaded(sb, GRPQUOTA);
+}
+
+static inline int sb_has_quota_active(struct super_block *sb, int type)
+{
+       return sb_has_quota_loaded(sb, type) &&
+              !sb_has_quota_suspended(sb, type);
+}
+
+static inline int sb_any_quota_active(struct super_block *sb)
+{
+       return sb_has_quota_active(sb, USRQUOTA) ||
+              sb_has_quota_active(sb, GRPQUOTA);
+}
+
 /*
  * Operations supported for diskquotas.
  */
@@ -106,7 +139,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
 static inline void vfs_dq_init(struct inode *inode)
 {
        BUG_ON(!inode->i_sb);
-       if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
+       if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
                inode->i_sb->dq_op->initialize(inode, -1);
 }
 
@@ -114,7 +147,7 @@ static inline void vfs_dq_init(struct inode *inode)
  * a transaction (deadlocks possible otherwise) */
 static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
 {
-       if (sb_any_quota_enabled(inode->i_sb)) {
+       if (sb_any_quota_active(inode->i_sb)) {
                /* Used space is updated in alloc_space() */
                if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
                        return 1;
@@ -134,7 +167,7 @@ static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
 
 static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
 {
-       if (sb_any_quota_enabled(inode->i_sb)) {
+       if (sb_any_quota_active(inode->i_sb)) {
                /* Used space is updated in alloc_space() */
                if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
                        return 1;
@@ -154,7 +187,7 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
 
 static inline int vfs_dq_alloc_inode(struct inode *inode)
 {
-       if (sb_any_quota_enabled(inode->i_sb)) {
+       if (sb_any_quota_active(inode->i_sb)) {
                vfs_dq_init(inode);
                if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
                        return 1;
@@ -164,7 +197,7 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
 
 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
 {
-       if (sb_any_quota_enabled(inode->i_sb))
+       if (sb_any_quota_active(inode->i_sb))
                inode->i_sb->dq_op->free_space(inode, nr);
        else
                inode_sub_bytes(inode, nr);
@@ -178,7 +211,7 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
 
 static inline void vfs_dq_free_inode(struct inode *inode)
 {
-       if (sb_any_quota_enabled(inode->i_sb))
+       if (sb_any_quota_active(inode->i_sb))
                inode->i_sb->dq_op->free_inode(inode, 1);
 }
 
@@ -199,12 +232,12 @@ static inline int vfs_dq_off(struct super_block *sb, int remount)
 
 #else
 
-static inline int sb_has_quota_enabled(struct super_block *sb, int type)
+static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
 {
        return 0;
 }
 
-static inline int sb_any_quota_enabled(struct super_block *sb)
+static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
 {
        return 0;
 }
@@ -219,6 +252,27 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
        return 0;
 }
 
+/* Does kernel know about any quota information for given sb + type? */
+static inline int sb_has_quota_loaded(struct super_block *sb, int type)
+{
+       return 0;
+}
+
+static inline int sb_any_quota_loaded(struct super_block *sb)
+{
+       return 0;
+}
+
+static inline int sb_has_quota_active(struct super_block *sb, int type)
+{
+       return 0;
+}
+
+static inline int sb_any_quota_active(struct super_block *sb)
+{
+       return 0;
+}
+
 /*
  * NO-OP when quota not configured.
  */