aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quota.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/quota.h')
-rw-r--r--include/linux/quota.h55
1 files changed, 26 insertions, 29 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 78c48895b12a..b462916b2a0a 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -73,6 +73,8 @@
73/* Quota format type IDs */ 73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1 74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2 75#define QFMT_VFS_V0 2
76#define QFMT_OCFS2 3
77#define QFMT_VFS_V1 4
76 78
77/* Size of block in which space limits are passed through the quota 79/* Size of block in which space limits are passed through the quota
78 * interface */ 80 * interface */
@@ -277,9 +279,6 @@ struct dquot {
277 struct mem_dqblk dq_dqb; /* Diskquota usage */ 279 struct mem_dqblk dq_dqb; /* Diskquota usage */
278}; 280};
279 281
280#define QUOTA_OK 0
281#define NO_QUOTA 1
282
283/* Operations which must be implemented by each quota format */ 282/* Operations which must be implemented by each quota format */
284struct quota_format_ops { 283struct quota_format_ops {
285 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */ 284 int (*check_quota_file)(struct super_block *sb, int type); /* Detect whether file is in our format */
@@ -293,13 +292,6 @@ struct quota_format_ops {
293 292
294/* Operations working with dquots */ 293/* Operations working with dquots */
295struct dquot_operations { 294struct dquot_operations {
296 int (*initialize) (struct inode *, int);
297 int (*drop) (struct inode *);
298 int (*alloc_space) (struct inode *, qsize_t, int);
299 int (*alloc_inode) (const struct inode *, qsize_t);
300 int (*free_space) (struct inode *, qsize_t);
301 int (*free_inode) (const struct inode *, qsize_t);
302 int (*transfer) (struct inode *, struct iattr *);
303 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 295 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
304 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ 296 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
305 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ 297 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
@@ -307,21 +299,16 @@ struct dquot_operations {
307 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 299 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
308 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 300 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
309 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ 301 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
310 /* reserve quota for delayed block allocation */ 302 /* get reserved quota for delayed alloc, value returned is managed by
311 int (*reserve_space) (struct inode *, qsize_t, int); 303 * quota code only */
312 /* claim reserved quota for delayed alloc */ 304 qsize_t *(*get_reserved_space) (struct inode *);
313 int (*claim_space) (struct inode *, qsize_t);
314 /* release rsved quota for delayed alloc */
315 void (*release_rsv) (struct inode *, qsize_t);
316 /* get reserved quota for delayed alloc */
317 qsize_t (*get_reserved_space) (struct inode *);
318}; 305};
319 306
320/* Operations handling requests from userspace */ 307/* Operations handling requests from userspace */
321struct quotactl_ops { 308struct quotactl_ops {
322 int (*quota_on)(struct super_block *, int, int, char *, int); 309 int (*quota_on)(struct super_block *, int, int, char *, int);
323 int (*quota_off)(struct super_block *, int, int); 310 int (*quota_off)(struct super_block *, int, int);
324 int (*quota_sync)(struct super_block *, int); 311 int (*quota_sync)(struct super_block *, int, int);
325 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 312 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
326 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 313 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
327 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 314 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *);
@@ -334,7 +321,7 @@ struct quotactl_ops {
334 321
335struct quota_format_type { 322struct quota_format_type {
336 int qf_fmt_id; /* Quota format id */ 323 int qf_fmt_id; /* Quota format id */
337 struct quota_format_ops *qf_ops; /* Operations of format */ 324 const struct quota_format_ops *qf_ops; /* Operations of format */
338 struct module *qf_owner; /* Module implementing quota format */ 325 struct module *qf_owner; /* Module implementing quota format */
339 struct quota_format_type *qf_next; 326 struct quota_format_type *qf_next;
340}; 327};
@@ -354,27 +341,37 @@ enum {
354#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 341#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
355 DQUOT_SUSPENDED) 342 DQUOT_SUSPENDED)
356/* Other quota flags */ 343/* Other quota flags */
357#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special 344#define DQUOT_STATE_LAST (_DQUOT_STATE_FLAGS * MAXQUOTAS)
345#define DQUOT_QUOTA_SYS_FILE (1 << DQUOT_STATE_LAST)
346 /* Quota file is a special
358 * system file and user cannot 347 * system file and user cannot
359 * touch it. Filesystem is 348 * touch it. Filesystem is
360 * responsible for setting 349 * responsible for setting
361 * S_NOQUOTA, S_NOATIME flags 350 * S_NOQUOTA, S_NOATIME flags
362 */ 351 */
363#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */ 352#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
353 /* Allow negative quota usage */
364 354
365static inline unsigned int dquot_state_flag(unsigned int flags, int type) 355static inline unsigned int dquot_state_flag(unsigned int flags, int type)
366{ 356{
367 if (type == USRQUOTA) 357 return flags << _DQUOT_STATE_FLAGS * type;
368 return flags;
369 return flags << _DQUOT_STATE_FLAGS;
370} 358}
371 359
372static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 360static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
373{ 361{
374 if (type == USRQUOTA) 362 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS;
375 return flags; 363}
376 return flags >> _DQUOT_STATE_FLAGS; 364
365#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
366extern void quota_send_warning(short type, unsigned int id, dev_t dev,
367 const char warntype);
368#else
369static inline void quota_send_warning(short type, unsigned int id, dev_t dev,
370 const char warntype)
371{
372 return;
377} 373}
374#endif /* CONFIG_QUOTA_NETLINK_INTERFACE */
378 375
379struct quota_info { 376struct quota_info {
380 unsigned int flags; /* Flags for diskquotas on this device */ 377 unsigned int flags; /* Flags for diskquotas on this device */
@@ -383,7 +380,7 @@ struct quota_info {
383 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ 380 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
384 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 381 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
385 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 382 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
386 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 383 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
387}; 384};
388 385
389int register_quota_format(struct quota_format_type *fmt); 386int register_quota_format(struct quota_format_type *fmt);