diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-10-04 11:20:50 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-04 11:37:46 -0400 |
commit | edbfd75d8fb4a13eccc2cadb12a453c3425d17d1 (patch) | |
tree | 97102c31509f2b764e07c958ee2d39d9d6e4119a /lib/quota | |
parent | dba14293d97e61dfbeb0f2ad672ac1f3f4eb2157 (diff) | |
download | e2fsprogs-edbfd75d8fb4a13eccc2cadb12a453c3425d17d1.tar.gz |
libquota: clean up some gcc -Wall warnings
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>
Diffstat (limited to 'lib/quota')
-rw-r--r-- | lib/quota/mkquota.c | 17 | ||||
-rw-r--r-- | lib/quota/quota.h | 36 | ||||
-rw-r--r-- | lib/quota/quotaio.c | 7 | ||||
-rw-r--r-- | lib/quota/quotaio.h | 2 | ||||
-rw-r--r-- | lib/quota/quotaio_v2.c | 16 |
5 files changed, 18 insertions, 60 deletions
diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c index 4316243a..263b62b2 100644 --- a/lib/quota/mkquota.c +++ b/lib/quota/mkquota.c @@ -6,6 +6,9 @@ #include "config.h" #include <sys/types.h> #include <sys/stat.h> +#ifdef HAVE_SYS_QUOTA_H +#include <sys/quota.h> +#endif #include <unistd.h> #include <errno.h> #include <string.h> @@ -51,8 +54,10 @@ int is_quota_on(ext2_filsys fs, int type) char tmp[1024]; qid_t id = (type == USRQUOTA) ? getuid() : getgid(); +#ifdef HAVE_QUOTACTL if (!quotactl(QCMD(Q_V2_GETQUOTA, type), fs->device_name, id, tmp)) return 1; +#endif return 0; } @@ -114,10 +119,8 @@ errcode_t remove_quota_inode(ext2_filsys fs, int qtype) static void write_dquots(dict_t *dict, struct quota_handle *qh) { - int i = 0; dnode_t *n; struct dquot *dq; - __u32 key; for (n = dict_first(dict); n; n = dict_next(dict, n)) { dq = dnode_get(n); @@ -131,16 +134,14 @@ static void write_dquots(dict_t *dict, struct quota_handle *qh) errcode_t write_quota_inode(quota_ctx_t qctx, int qtype) { - int retval, i; - unsigned long qf_inums[MAXQUOTAS]; - struct dquot *dquot; + int retval = 0, i; dict_t *dict; ext2_filsys fs; struct quota_handle *h; int fmt = QFMT_VFS_V1; if (!qctx) - return; + return 0; fs = qctx->fs; h = smalloc(sizeof(struct quota_handle)); @@ -179,7 +180,6 @@ errcode_t write_quota_inode(quota_ctx_t qctx, int qtype) } ext2fs_write_bitmaps(fs); -out: free(h); return retval; } @@ -361,7 +361,6 @@ void quota_data_inodes(quota_ctx_t qctx, struct ext2_inode *inode, errcode_t compute_quota(quota_ctx_t qctx, int qtype) { ext2_filsys fs; - const char *name = "lost+found"; ext2_ino_t ino; errcode_t ret; struct ext2_inode inode; @@ -369,7 +368,7 @@ errcode_t compute_quota(quota_ctx_t qctx, int qtype) ext2_inode_scan scan; if (!qctx) - return; + return 0; fs = qctx->fs; ret = ext2fs_open_inode_scan(fs, 0, &scan); diff --git a/lib/quota/quota.h b/lib/quota/quota.h index cc6c98ea..a943ec61 100644 --- a/lib/quota/quota.h +++ b/lib/quota/quota.h @@ -103,42 +103,6 @@ typedef int64_t qsize_t; /* Type in which we store size limitations */ #define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS) /* - * Quota structure used for communication with userspace via quotactl - * Following flags are used to specify which fields are valid - */ -enum { - QIF_BLIMITS_B = 0, - QIF_SPACE_B, - QIF_ILIMITS_B, - QIF_INODES_B, - QIF_BTIME_B, - QIF_ITIME_B, -}; - -#define QIF_BLIMITS (1 << QIF_BLIMITS_B) -#define QIF_SPACE (1 << QIF_SPACE_B) -#define QIF_ILIMITS (1 << QIF_ILIMITS_B) -#define QIF_INODES (1 << QIF_INODES_B) -#define QIF_BTIME (1 << QIF_BTIME_B) -#define QIF_ITIME (1 << QIF_ITIME_B) -#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) -#define QIF_USAGE (QIF_SPACE | QIF_INODES) -#define QIF_TIMES (QIF_BTIME | QIF_ITIME) -#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) - -struct if_dqblk { - __u64 dqb_bhardlimit; - __u64 dqb_bsoftlimit; - __u64 dqb_curspace; - __u64 dqb_ihardlimit; - __u64 dqb_isoftlimit; - __u64 dqb_curinodes; - __u64 dqb_btime; - __u64 dqb_itime; - __u32 dqb_valid; -}; - -/* * Structure used for setting quota information about file via quotactl * Following flags are used to specify which fields are valid */ diff --git a/lib/quota/quotaio.c b/lib/quota/quotaio.c index cf13e35c..ef92f5ae 100644 --- a/lib/quota/quotaio.c +++ b/lib/quota/quotaio.c @@ -117,7 +117,6 @@ static int compute_num_blocks_proc(ext2_filsys fs, blk64_t *blocknr, void truncate_quota_inode(ext2_filsys fs, ext2_ino_t ino) { struct ext2_inode inode; - int i; if (ext2fs_read_inode(fs, ino, &inode)) return; @@ -135,7 +134,6 @@ void truncate_quota_inode(ext2_filsys fs, ext2_ino_t ino) static ext2_off64_t compute_inode_size(ext2_filsys fs, ext2_ino_t ino) { - struct ext2_inode inode; blk64_t num_blocks = 0; ext2fs_block_iterate3(fs, ino, @@ -241,14 +239,9 @@ static errcode_t init_new_quota_inode(ext2_filsys fs, ext2_ino_t ino) */ int new_io(struct quota_handle *h, ext2_filsys fs, int type, int fmt) { - int fd = 0; ext2_file_t e2_file; - const char *mnt_fsname; - char qf_name[PATH_MAX]; int err; - struct ext2_inode inode; unsigned long qf_inum; - struct stat st; if (fmt == -1) fmt = QFMT_VFS_V1; diff --git a/lib/quota/quotaio.h b/lib/quota/quotaio.h index fd39b55a..f2c34f20 100644 --- a/lib/quota/quotaio.h +++ b/lib/quota/quotaio.h @@ -160,4 +160,6 @@ void truncate_quota_inode(ext2_filsys fs, ext2_ino_t ino); const char *type2name(int type); +void update_grace_times(struct dquot *q); + #endif /* GUARD_QUOTAIO_H */ diff --git a/lib/quota/quotaio_v2.c b/lib/quota/quotaio_v2.c index 660d4630..35512c0f 100644 --- a/lib/quota/quotaio_v2.c +++ b/lib/quota/quotaio_v2.c @@ -32,14 +32,14 @@ static int v2_scan_dquots(struct quota_handle *h, static int v2_report(struct quota_handle *h, int verbose); struct quotafile_ops quotafile_ops_2 = { -check_file: v2_check_file, -init_io: v2_init_io, -new_io: v2_new_io, -write_info: v2_write_info, -read_dquot: v2_read_dquot, -commit_dquot: v2_commit_dquot, -scan_dquots: v2_scan_dquots, -report: v2_report + .check_file = v2_check_file, + .init_io = v2_init_io, + .new_io = v2_new_io, + .write_info = v2_write_info, + .read_dquot = v2_read_dquot, + .commit_dquot = v2_commit_dquot, + .scan_dquots = v2_scan_dquots, + .report = v2_report, }; #define getdqbuf() smalloc(V2_DQBLKSIZE) |