aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quota.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/quota.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/quota.h')
-rw-r--r--include/linux/quota.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 570348cbccb1..92547a57e25a 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -357,26 +357,25 @@ enum {
357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 357#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
358 DQUOT_SUSPENDED) 358 DQUOT_SUSPENDED)
359/* Other quota flags */ 359/* Other quota flags */
360#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special 360#define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS)
361#define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST)
362 /* Quota file is a special
361 * system file and user cannot 363 * system file and user cannot
362 * touch it. Filesystem is 364 * touch it. Filesystem is
363 * responsible for setting 365 * responsible for setting
364 * S_NOQUOTA, S_NOATIME flags 366 * S_NOQUOTA, S_NOATIME flags
365 */ 367 */
366#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ 368#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
369 /* Allow negative quota usage */
367 370
368static inline unsigned int dquot_state_flag(unsigned int flags, int type) 371static inline unsigned int dquot_state_flag(unsigned int flags, int type)
369{ 372{
370 if (type == USRQUOTA) 373 return flags << _DQUOT_STATE_FLAGS * type;
371 return flags;
372 return flags << _DQUOT_STATE_FLAGS;
373} 374}
374 375
375static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 376static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
376{ 377{
377 if (type == USRQUOTA) 378 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS;
378 return flags;
379 return flags >> _DQUOT_STATE_FLAGS;
380} 379}
381 380
382#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 381#ifdef CONFIG_QUOTA_NETLINK_INTERFACE