aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quotaops.h
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-02-16 00:31:49 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:26 -0500
commitad1e6e8da9fe8cb7ecfde8eabacedc3b50fceae4 (patch)
tree0971e2039c2d6feb6763ba018e9c73123d207ddb /include/linux/quotaops.h
parent86963918965eb8fe0c8ae009e7c1b4c630f533d5 (diff)
quota: sb_quota state flags cleanup
- remove hardcoded USRQUOTA/GRPQUOTA flags - convert int to bool for appropriate functions Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r--include/linux/quotaops.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 8cfd0d44c994..e563a20cff4f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -79,53 +79,56 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
79 * Functions for checking status of quota 79 * Functions for checking status of quota
80 */ 80 */
81 81
82static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type) 82static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type)
83{ 83{
84 return sb_dqopt(sb)->flags & 84 return sb_dqopt(sb)->flags &
85 dquot_state_flag(DQUOT_USAGE_ENABLED, type); 85 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
86} 86}
87 87
88static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type) 88static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type)
89{ 89{
90 return sb_dqopt(sb)->flags & 90 return sb_dqopt(sb)->flags &
91 dquot_state_flag(DQUOT_LIMITS_ENABLED, type); 91 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
92} 92}
93 93
94static inline int sb_has_quota_suspended(struct super_block *sb, int type) 94static inline bool sb_has_quota_suspended(struct super_block *sb, int type)
95{ 95{
96 return sb_dqopt(sb)->flags & 96 return sb_dqopt(sb)->flags &
97 dquot_state_flag(DQUOT_SUSPENDED, type); 97 dquot_state_flag(DQUOT_SUSPENDED, type);
98} 98}
99 99
100static inline int sb_any_quota_suspended(struct super_block *sb) 100static inline unsigned sb_any_quota_suspended(struct super_block *sb)
101{ 101{
102 return sb_has_quota_suspended(sb, USRQUOTA) || 102 unsigned type, tmsk = 0;
103 sb_has_quota_suspended(sb, GRPQUOTA); 103 for (type = 0; type < MAXQUOTAS; type++)
104 tmsk |= sb_has_quota_suspended(sb, type) << type;
105 return tmsk;
104} 106}
105 107
106/* Does kernel know about any quota information for given sb + type? */ 108/* Does kernel know about any quota information for given sb + type? */
107static inline int sb_has_quota_loaded(struct super_block *sb, int type) 109static inline bool sb_has_quota_loaded(struct super_block *sb, int type)
108{ 110{
109 /* Currently if anything is on, then quota usage is on as well */ 111 /* Currently if anything is on, then quota usage is on as well */
110 return sb_has_quota_usage_enabled(sb, type); 112 return sb_has_quota_usage_enabled(sb, type);
111} 113}
112 114
113static inline int sb_any_quota_loaded(struct super_block *sb) 115static inline unsigned sb_any_quota_loaded(struct super_block *sb)
114{ 116{
115 return sb_has_quota_loaded(sb, USRQUOTA) || 117 unsigned type, tmsk = 0;
116 sb_has_quota_loaded(sb, GRPQUOTA); 118 for (type = 0; type < MAXQUOTAS; type++)
119 tmsk |= sb_has_quota_loaded(sb, type) << type;
120 return tmsk;
117} 121}
118 122
119static inline int sb_has_quota_active(struct super_block *sb, int type) 123static inline bool sb_has_quota_active(struct super_block *sb, int type)
120{ 124{
121 return sb_has_quota_loaded(sb, type) && 125 return sb_has_quota_loaded(sb, type) &&
122 !sb_has_quota_suspended(sb, type); 126 !sb_has_quota_suspended(sb, type);
123} 127}
124 128
125static inline int sb_any_quota_active(struct super_block *sb) 129static inline unsigned sb_any_quota_active(struct super_block *sb)
126{ 130{
127 return sb_has_quota_active(sb, USRQUOTA) || 131 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb);
128 sb_has_quota_active(sb, GRPQUOTA);
129} 132}
130 133
131/* 134/*