3 * Interface to the quota library.
5 * The quota library provides interface for creating and updating the quota
6 * files and the ext4 superblock fields. It supports the new VFS_V1 quota
7 * format. The quota library also provides support for keeping track of quotas
9 * The typical way to use the quota library is as follows:
13 * quota_init_context(&qctx, fs, -1);
15 * quota_compute_usage(qctx, -1);
17 * quota_data_add/quota_data_sub/quota_data_inodes();
19 * quota_write_inode(qctx, USRQUOTA);
20 * quota_write_inode(qctx, GRPQUOTA);
21 * quota_release_context(&qctx);
24 * This initial version does not support reading the quota files. This support
25 * will be added in near future.
27 * Aditya Kali <adityakali@google.com>
30 #ifndef __QUOTA_QUOTAIO_H__
31 #define __QUOTA_QUOTAIO_H__
33 #include "ext2fs/ext2_fs.h"
34 #include "ext2fs/ext2fs.h"
36 #include "../e2fsck/dict.h"
38 typedef struct quota_ctx *quota_ctx_t;
42 dict_t *quota_dict[MAXQUOTAS];
46 errcode_t quota_init_context(quota_ctx_t *qctx, ext2_filsys fs, int qtype);
47 void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
49 void quota_data_add(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
51 void quota_data_sub(quota_ctx_t qctx, struct ext2_inode *inode, ext2_ino_t ino,
53 errcode_t quota_write_inode(quota_ctx_t qctx, int qtype);
54 errcode_t quota_update_inode(quota_ctx_t qctx, ext2_ino_t qf_ino, int type);
55 errcode_t quota_compute_usage(quota_ctx_t qctx);
56 void quota_release_context(quota_ctx_t *qctx);
58 errcode_t quota_remove_inode(ext2_filsys fs, int qtype);
59 int quota_file_exists(ext2_filsys fs, int qtype, int fmt);
60 void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype);
61 errcode_t quota_compare_and_update(quota_ctx_t qctx, int qtype,
62 int *usage_inconsistent);
64 #endif /* __QUOTA_QUOTAIO_H__ */