diff options
author | jkar8572 <jkar8572> | 2003-07-29 20:11:35 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2003-07-29 20:11:35 +0000 |
commit | c3e5a79f06cc0e8e5bc2886c374306cbb395ef27 (patch) | |
tree | 2ef3b7338397904cc7d5ddcd6c88ca6091d0ba3c | |
parent | 6e29c7a8854c14be88eb9c90b208e8402d3fdbdd (diff) | |
download | linuxquota-c3e5a79f06cc0e8e5bc2886c374306cbb395ef27.tar.gz |
Fixed edquota -f option (Jan Kara)
Fixed warnquota formatting (Jan Kara)
Added -s option (smart choice of units) to warnquota (Jan Kara)
Updated documentation of quotactl call (Jan Kara)
-rw-r--r-- | Changelog | 6 | ||||
-rw-r--r-- | edquota.c | 4 | ||||
-rw-r--r-- | quotactl.2 | 148 | ||||
-rw-r--r-- | repquota.8 | 2 | ||||
-rw-r--r-- | warnquota.8 | 6 | ||||
-rw-r--r-- | warnquota.c | 27 |
6 files changed, 114 insertions, 79 deletions
@@ -1,3 +1,9 @@ +Changes in quota-tools from 3.09 to 3.10 +* updated quotactl(2) manpage (Jan Kara) +* fixed bug in -f option of edquota(8) (Jan Kara) +* fixed formatting bug in warnquota(8) (Jan Kara) +* added option -s (choice of more appropriate units) to warnquota(8) (Jan Kara) + Changes in quota-tools from 3.08 to 3.09 * minor update of quota(1) manpage (Jan Kara) * quotacheck(8) now remembers only hardlinked files and not all inodes with @@ -34,7 +34,7 @@ #ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $" #ident "$Copyright: All rights reserved. $" -#ident "$Id: edquota.c,v 1.12 2003/02/14 18:50:16 jkar8572 Exp $" +#ident "$Id: edquota.c,v 1.13 2003/07/29 20:11:36 jkar8572 Exp $" /* * Disk quota editor. @@ -148,7 +148,7 @@ int main(int argc, char **argv) usage(); init_kernel_interface(); - handles = create_handle_list(0, dirname ? &dirname : NULL, quotatype, fmt, rflag ? 0 : IOI_LOCALONLY, 0); + handles = create_handle_list(dirname ? 1 : 0, dirname ? &dirname : NULL, quotatype, fmt, rflag ? 0 : IOI_LOCALONLY, 0); if (!handles[0]) { dispose_handle_list(handles); fputs(_("No filesystems with quota detected.\n"), stderr); @@ -5,6 +5,8 @@ quotactl \- manipulate disk quotas .nf .B #include <linux/quota.h> .B #include <xfs/xqm.h> +.B #include <linux/dqblk_v1.h> +.B #include <linux/dqblk_v2.h> .LP .B long quotactl(int cmd, char \(**special, qid_t id, caddr_t addr) .fi @@ -38,7 +40,15 @@ is given with each command below. .TP 15 .SB Q_QUOTAON Turn on quotas for a filesystem. -.I addr +.I id +is the identification number of the quota format to be used. Format numbers +are defined in the header file of appropriate format. Currently there are +two supported quota formats whose numbers are defined by constants +.IR QFMT_VFS_OLD +(original quota format) and +.IR QFMT_VFS_V0 +(new VFS v0 quota format). +.IR addr points to the path name of file containing the quotas for the filesystem. The quota file must exist; it is normally created with the .BR quotacheck (8) @@ -56,41 +66,79 @@ This call is restricted to the super-user. Get disk quota limits and current usage for user or group .IR id . .I addr -is a pointer to a -.B mem_dqblk +is a pointer to an +.B if_dqblk structure (defined in .BR <linux/quota.h> ). -Only the super-user may get the quotas of a user other than himself. +The field +.I dqb_valid +defines the entries in the structure which are set correctly. On +.B Q_GETQUOTA +call all entries are valid. Only the super-user may get the quotas +of a user other than himself. .TP .SB Q_SETQUOTA -Set disk quota limits and current usage for user or group +Set current quota information for user or group .IR id . .I addr -is a pointer to a -.B mem_dqblk +is a pointer to an +.B if_dqblk structure (defined in .BR <linux/quota.h> ). -This call is restricted to the super-user. +The field +.I dqb_valid +defines which entries in the quota structure are valid and should be set. The constants for +.I dqb_valid +field are defined in the +.B <linux/quota.h> +header file. This call obsoletes calls +.B Q_SETQLIM +and +.B Q_SETUSE +in the previous quota interfaces. This call is restricted to the super-user. .TP -.SB Q_SETQLIM -Set disk quota limits for user or group -.IR id . +.SB Q_GETINFO +Get information (like grace times) about quotafile. .I addr -is a pointer to a -.B mem_dqblk +should be a pointer to an +.B if_dqinfo structure (defined in -.BR <linux/quota.h> ). -This call is restricted to the super-user. +.IR <linux/quota.h> ). +The +.I dqi_valid +field in the structure defines entries in it +which are valid. On +.B Q_GETINFO +call all entries are valid. +Parameter +.I id +is ignored. .TP -.SB Q_SETUSE -Set current usage for user or group -.IR id . +.SB Q_SETINFO +Set information about quotafile. .I addr -is a pointer to a -.B mem_dqblk +should be a pointer to +.B if_dqinfo structure (defined in -.BR <linux/quota.h> ). -This call is restricted to the super-user. +.IR <linux/quota.h> ). +The field +.I dqi_valid +defines which entries in the quota info structure are valid and should be set. The constants for +.I dqi_valid +field are defined in the +.B <linux/quota.h> +header file. This call obsoletes calls +.B Q_SETGRACE +and +.B Q_SETFLAGS +in the previous quota interfaces. Parameter +.I id +is ignored. This operation is restricted to super-user. +.TP +.SB Q_GETFMT +Get quota format used on the specified filesystem. +.I addr +should be a pointer to a memory (4 bytes) where the format number will be stored. .TP .SB Q_SYNC Update the on-disk copy of quota usages for a filesystem. @@ -114,47 +162,6 @@ in which data should be stored. and .I id are ignored. -.PP -New quota format also allows following additional calls: -.TP 15 -.SB Q_GETINFO -Get information (like grace times) about quotafile. -.I addr -should be a pointer to -.B mem_dqinfo -structure (defined in -.IR <linux/quota.h> ). -.I id -is ignored. -.TP -.SB Q_SETINFO -Set information about quotafile. -.I addr should be a pointer to -.B mem_dqinfo -structure (defined in -.IR <linux/quota.h> ). -.I id -is ignored. This operation is restricted to super-user. -.TP -.SB Q_SETGRACE -Set grace times in information about quotafile. -.I addr should be a pointer to -.B mem_dqinfo -structure (defined in -.IR <linux/quota.h> ). -.I id -is ignored. This operation is restricted to super-user. -.TP -.SB Q_SETFLAGS -Set flags in information about quotafile. These flags are defined in -.IR <linux/quota.h> . -Note that there are currently no defined flags. -.I addr should be a pointer to -.B mem_dqinfo -structure (defined in -.IR <linux/quota.h> ). -.I id -is ignored. This operation is restricted to super-user. .TP For XFS filesystems making use of the XFS Quota Manager (XQM), the above commands are bypassed and the following commands are used: .TP 15 @@ -234,12 +241,16 @@ or .I special are invalid. .TP -.SM EINVAL +.SM ENOSYS The kernel has not been compiled with the .SB QUOTA option. +.TP +.SM EINVAL .IP .I cmd +or +.I type is invalid. .TP .SM ENOENT @@ -260,9 +271,6 @@ The call is privileged and the caller was not the super-user. No disc quota is found for the indicated user. .IP Quotas have not been turned on for this filesystem. -.TP -.SM EUSERS -The quota table is full. .LP If .I cmd @@ -282,6 +290,12 @@ exists but is not on the filesystem pointed to by .IR special . .TP +.SM EINVAL +The quota file is corrupted. +.TP +.SM ESRCH +Specified quota format was not found. +.TP .SM EBUSY .SB Q_QUOTAON attempted while another @@ -93,7 +93,7 @@ Don't resolve UIDs/GIDs to names. This can speedup printing a lot. .TP .B \-s Try to report used space, number of used inodes and limits in more appropriate units -than default ones. +than the default ones. .TP .B \-i Ignore mountpoints mounted by automounter. diff --git a/warnquota.8 b/warnquota.8 index d9dfe32..d95a14a 100644 --- a/warnquota.8 +++ b/warnquota.8 @@ -4,7 +4,7 @@ warnquota \- send mail to users over quota .SH SYNOPSIS .B warnquota [ -.B \-ugi +.B \-ugsi ] [ .B \-F .I quotaformat @@ -65,6 +65,10 @@ check whether users are not exceeding quotas (default). check whether groups are not exceeding quotas. If group is exceeding quota a mail is sent to the user specified in /etc/quotagrpadmins. .TP +.B -s +Try to report used space, number of used inodes and limits in more appropriate units +than the default ones. +.TP .B \-i ignore mountpoints mounted by automounter. .SH FILES diff --git a/warnquota.c b/warnquota.c index 220f9f8..c49f743 100644 --- a/warnquota.c +++ b/warnquota.c @@ -10,7 +10,7 @@ * * Author: Marco van Wieringen <mvw@planets.elm.net> * - * Version: $Id: warnquota.c,v 1.12 2003/02/14 18:50:17 jkar8572 Exp $ + * Version: $Id: warnquota.c,v 1.13 2003/07/29 20:11:36 jkar8572 Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -76,6 +76,7 @@ #define FL_USER 1 #define FL_GROUP 2 #define FL_NOAUTOFS 4 +#define FL_SHORTNUMS 8 struct usage { char *devicename; @@ -222,6 +223,7 @@ int mail_user(struct offenderlist *offender, struct configparams *config) FILE *fp; int cnt, status; char timebuf[MAXTIMELEN]; + char numbuf[3][MAXNUMLEN]; struct util_dqblk *dqb; char *to; @@ -274,17 +276,21 @@ int mail_user(struct offenderlist *offender, struct configparams *config) difftime2str(dqb->dqb_btime, timebuf); else timebuf[0] = '\0'; - fprintf(fp, "%c%c%8Lu%8Lu%8Lu%7s", + space2str(toqb(dqb->dqb_curspace), numbuf[0], flags & FL_SHORTNUMS); + space2str(dqb->dqb_bsoftlimit, numbuf[1], flags & FL_SHORTNUMS); + space2str(dqb->dqb_bhardlimit, numbuf[2], flags & FL_SHORTNUMS); + fprintf(fp, "%c%c %7s %7s %7s %6s", dqb->dqb_bsoftlimit && toqb(dqb->dqb_curspace) >= dqb->dqb_bsoftlimit ? '+' : '-', dqb->dqb_isoftlimit && dqb->dqb_curinodes >= dqb->dqb_isoftlimit ? '+' : '-', - (long long)toqb(dqb->dqb_curspace), (long long)dqb->dqb_bsoftlimit, - (long long)dqb->dqb_bhardlimit, timebuf); + numbuf[0], numbuf[1], numbuf[2], timebuf); if (dqb->dqb_isoftlimit && dqb->dqb_isoftlimit <= dqb->dqb_curinodes) difftime2str(dqb->dqb_itime, timebuf); else timebuf[0] = '\0'; - fprintf(fp, " %6Lu%6Lu%6Lu%7s\n\n", (long long)dqb->dqb_curinodes, - (long long)dqb->dqb_isoftlimit, (long long)dqb->dqb_ihardlimit, timebuf); + number2str(dqb->dqb_curinodes, numbuf[0], flags & FL_SHORTNUMS); + number2str(dqb->dqb_isoftlimit, numbuf[1], flags & FL_SHORTNUMS); + number2str(dqb->dqb_ihardlimit, numbuf[2], flags & FL_SHORTNUMS); + fprintf(fp, " %7s %5s %5s %6s\n\n", numbuf[0], numbuf[1], numbuf[2], timebuf); } if (offender->offender_type == USRQUOTA) if (config->user_signature) @@ -599,14 +605,16 @@ void warn_quota(void) /* Print usage information */ static void usage(void) { - errstr(_("Usage:\n warnquota [-ugi] [-F quotaformat] [-c configfile] [-q quotatabfile]\n")); + errstr(_("Usage:\n warnquota [-ugsi] [-F quotaformat] [-c configfile] [-q quotatabfile]\n")); + fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL); + exit(1); } static void parse_options(int argcnt, char **argstr) { int ret; - while ((ret = getopt(argcnt, argstr, "ugVF:hc:q:a:i")) != -1) { + while ((ret = getopt(argcnt, argstr, "ugVF:hc:q:a:is")) != -1) { switch (ret) { case '?': case 'h': @@ -636,6 +644,9 @@ static void parse_options(int argcnt, char **argstr) case 'i': flags |= FL_NOAUTOFS; break; + case 's': + flags |= FL_SHORTNUMS; + break; } } if (!(flags & FL_USER) && !(flags & FL_GROUP)) |