diff options
Diffstat (limited to 'include/linux/quotaops.h')
-rw-r--r-- | include/linux/quotaops.h | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 38218c1334b1..742187f7a05c 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -11,10 +11,12 @@ | |||
11 | #define _LINUX_QUOTAOPS_ | 11 | #define _LINUX_QUOTAOPS_ |
12 | 12 | ||
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | |||
15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
16 | 15 | ||
17 | #define sb_dqopt(sb) (&(sb)->s_dquot) | 16 | static inline struct quota_info *sb_dqopt(struct super_block *sb) |
17 | { | ||
18 | return &sb->s_dquot; | ||
19 | } | ||
18 | 20 | ||
19 | #if defined(CONFIG_QUOTA) | 21 | #if defined(CONFIG_QUOTA) |
20 | 22 | ||
@@ -54,24 +56,40 @@ void vfs_dq_drop(struct inode *inode); | |||
54 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | 56 | int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); |
55 | int vfs_dq_quota_on_remount(struct super_block *sb); | 57 | int vfs_dq_quota_on_remount(struct super_block *sb); |
56 | 58 | ||
57 | #define sb_dqinfo(sb, type) (sb_dqopt(sb)->info+(type)) | 59 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) |
60 | { | ||
61 | return sb_dqopt(sb)->info + type; | ||
62 | } | ||
58 | 63 | ||
59 | /* | 64 | /* |
60 | * Functions for checking status of quota | 65 | * Functions for checking status of quota |
61 | */ | 66 | */ |
62 | 67 | ||
63 | #define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ | 68 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) |
64 | (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) | 69 | { |
70 | if (type == USRQUOTA) | ||
71 | return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; | ||
72 | return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED; | ||
73 | } | ||
65 | 74 | ||
66 | #define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ | 75 | static inline int sb_any_quota_enabled(struct super_block *sb) |
67 | sb_has_quota_enabled(sb, GRPQUOTA)) | 76 | { |
77 | return sb_has_quota_enabled(sb, USRQUOTA) || | ||
78 | sb_has_quota_enabled(sb, GRPQUOTA); | ||
79 | } | ||
68 | 80 | ||
69 | #define sb_has_quota_suspended(sb, type) \ | 81 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) |
70 | ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ | 82 | { |
71 | (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) | 83 | if (type == USRQUOTA) |
84 | return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; | ||
85 | return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED; | ||
86 | } | ||
72 | 87 | ||
73 | #define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ | 88 | static inline int sb_any_quota_suspended(struct super_block *sb) |
74 | sb_has_quota_suspended(sb, GRPQUOTA)) | 89 | { |
90 | return sb_has_quota_suspended(sb, USRQUOTA) || | ||
91 | sb_has_quota_suspended(sb, GRPQUOTA); | ||
92 | } | ||
75 | 93 | ||
76 | /* | 94 | /* |
77 | * Operations supported for diskquotas. | 95 | * Operations supported for diskquotas. |
@@ -180,10 +198,25 @@ static inline int vfs_dq_off(struct super_block *sb, int remount) | |||
180 | 198 | ||
181 | #else | 199 | #else |
182 | 200 | ||
183 | #define sb_has_quota_enabled(sb, type) 0 | 201 | static inline int sb_has_quota_enabled(struct super_block *sb, int type) |
184 | #define sb_any_quota_enabled(sb) 0 | 202 | { |
185 | #define sb_has_quota_suspended(sb, type) 0 | 203 | return 0; |
186 | #define sb_any_quota_suspended(sb) 0 | 204 | } |
205 | |||
206 | static inline int sb_any_quota_enabled(struct super_block *sb) | ||
207 | { | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static inline int sb_has_quota_suspended(struct super_block *sb, int type) | ||
212 | { | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static inline int sb_any_quota_suspended(struct super_block *sb) | ||
217 | { | ||
218 | return 0; | ||
219 | } | ||
187 | 220 | ||
188 | /* | 221 | /* |
189 | * NO-OP when quota not configured. | 222 | * NO-OP when quota not configured. |