summaryrefslogtreecommitdiff
path: root/lib/quota
AgeCommit message (Collapse)AuthorFilesLines
2011-11-27libquota: remove use of PATH_MAX and replace it with QUOTA_NAME_LENTheodore Ts'o3-7/+10
PATH_MAX is not portable (for example, it doesn't exist on the Hurd). So replace it with a new define, which defines the maximum length of the base quota name. As it turns out, this is substantially smaller than PATH_MAX. Also move the definitions relating to quotaio.c from mkquota.h to quotaio.h, as a cleanup. Addresses-Debian-Bug: #649689 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-14libquota: log an error message if ext2fs_file_open() failsTheodore Ts'o1-1/+1
This also fixes a format string type compiler warning. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-14libquota: fix get_dq()Niu Yawei1-0/+1
The dq_id should be set on newly created dqout. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: fix quota usage computeNiu1-2/+1
In quota_compute_usage(), the space usage should be in bytes but not quota block. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: quota file read supportNiu7-18/+179
This patch adds read quota file support, which includes: - Improve scan dquot APIs & fix defects in scan dquot functions; - Implement quota_file_open(); - Introduce quota_update_inode() to update usage in old quota file, and keep the limits unchanged. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: cleanup libquota codeAditya Kali9-209/+236
This patch cleans up the quota code as suggested in previous reviews. This includes * remove BUG_ON()s and 'exit()' calls from library code * remove calls to malloc/free and instead use ext2fs_get/free_mem functions. * lib/quota/common.c file in not needed anymore and is removed. * rename exported functions to start with quota_ (ex: init_quota_context --> quota_init_context) * better error handling in quota library Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-10-16libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flagTheodore Ts'o1-1/+1
The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to only check i_file_acl_high if the 64-bit flag is set. This is needed because otherwise we will run into problems on Hurd systems which actually use that field for h_i_mode_high. This involves an ABI change since we need to pass ext2_filsys to these functions. Fortunately these functions were first included in the 1.42-WIP series, so it's OK for us to change them now. (This is why we have 1.42-WIP releases. :-) Addresses-Sourceforge-Bug: #3379227 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05libquota: remove flag argument to commit_dquot()Theodore Ts'o3-11/+4
The flag parameter wasn't being used, and using it meant that we had to define the COMMIT_* flags, which relied on the QIF_* flags being present. Removing this allows for increased portability. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: remove NLS supportTheodore Ts'o1-26/+4
In general libraries should never (a) call exit() or (b) print output directly to the stdout (they might be used by GUI programs. From (b) follows (c), should never call internationalization functions directly. Also, since po/POTFILES.in wasn't edited, these strings weren't getting included in e2fsprogs.pot for translation, so the _() indirection didn't actually buy us anything. We eventually need to nuke all of the log_fatal() and log_err() from libquota, so best thing to do for now is remove NLS support completely; no point whipsawing the translators with strings to translate that will be disappearing soon anyway! Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: use ext2_loff_t instead of loff_tTheodore Ts'o3-12/+16
The type loff_t is not portable. Use ext2_loff_t which handles this for us. Cc: Aditya Kali <adityakali@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: remove get_qf_name()Theodore Ts'o3-19/+4
The get_qf_name() function used PATH_MAX, which is non-portable. Worse, it blindly assumed that PATH_MAX was the size of the buffer passed to it --- which in the one and only place where it was used in libquota, was a buffer declared to a fixed size 256 bytes. Fix this by simply getting rid of the function altogether. Cc: Aditya Kali <adityakali@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: clean up some gcc -Wall warningsTheodore Ts'o5-60/+18
Remove unused variables, places where 'return' was used with no value in a non-void function, missing function declarations, etc. Don't assume that all systems have quotactl(), and use <sys/quota.h> if it exists to define the quotactl interfaces. One of the unused variables also got rid of a non-portable use of PATH_MAX. Cc: Aditya Kali <adityakali@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: remove get_qf_path()Theodore Ts'o2-20/+0
This function isn't used anywhere, so remove it. It also uses PATH_MAX which is not portable. Cc: Aditya Kali <adityakali@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03libext2fs, libquota: fix some makefile dependency issuesTheodore Ts'o1-7/+8
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28libquota: use ext2fs byte swapping functions for portabilityTheodore Ts'o4-65/+69
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24misc: quiet minor compiler errorsAndreas Dilger1-1/+1
Several compiler errors are quieted: - zero-length gnu_printf format string - unused variable - uninitalized variable (though it isn't actually used for anything) - fixed a bug in ext2fs_stat() if stat64() does not exist Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-19libquota: only build a static libraryTheodore Ts'o1-19/+19
Since the libquota library has namespace contamination issues, don't build a shared library and link against it statically. Don't include it as part of the Debian packages. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18Shorten compile commands run by the build systemTheodore Ts'o6-17/+26
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and this was starting to cause some tools heartburn. It also made "make V=1" almost useless, since trying to following the individual commands run by make was lost in the noise of all of the defines. So fix this by putting the configure-generated defines in lib/config.h and the directory pathnames to lib/dirpaths.h. In addition, clean up some vestigal defines in configure.in and in the Makefiles to further shorten the cc command lines. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16libquota: indicate in the ELF library image that it requires libext2fsTheodore Ts'o1-1/+1
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-14libquota: fix "make install" so it works in with a VPATH build directoryTheodore Ts'o1-2/+2
Also fix up the name of the header file which we are installing so it is correct. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-08-31e2fsprogs: add quota library to e2fsprogsAditya Kali14-0/+2585
This patch adds the quota library (ported form Jan Kara's quota-tools) in e2fsprogs in order to make quotas as a first class supported feature in Ext4. This patch also provides interface in lib/quota/mkquota.h that will be used by mke2fs, tune2fs, e2fsck, etc. to initialize and update quota files. This first version of the quota library does not support reading existing quota files. This support will be added in the near future. Thanks to Jan Kara for his work on quota-tools. Most of the files in this patch are taken as-is from quota tools and were simply modified to work with libext2fs in e2fsprogs. Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>