summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.c2
-rw-r--r--common.h2
-rw-r--r--convertquota.812
-rw-r--r--convertquota.c3
-rw-r--r--edquota.818
-rw-r--r--quota.c4
-rw-r--r--quotacheck.c110
-rw-r--r--quotaio.c1
-rw-r--r--quotaio.h7
-rw-r--r--quotaio_v2.c20
-rw-r--r--quotasys.c31
-rw-r--r--quotasys.h3
-rw-r--r--repquota.c15
-rw-r--r--setquota.82
-rw-r--r--setquota.c3
-rw-r--r--xqmstats.c2
16 files changed, 150 insertions, 85 deletions
diff --git a/common.c b/common.c
index f77f2e5..754c7ac 100644
--- a/common.c
+++ b/common.c
@@ -2,6 +2,7 @@
*
* Common things for all utilities
*
+ * Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
#include <stdio.h>
@@ -71,4 +72,5 @@ void version(void)
puts(_("EXT2_DIRECT"));
#endif /* defined RPC && EXT2_DIRECT */
#endif /* defined RPC || EXT2_DIRECT */
+ printf(_("Bugs to %s\n"), MY_EMAIL);
}
diff --git a/common.h b/common.h
index 8da6df9..58119a6 100644
--- a/common.h
+++ b/common.h
@@ -7,7 +7,7 @@
#ifndef _COMMON_H
#define _COMMON_H
-#define MY_EMAIL "mvw@planets.elm.net, jack@atrey.karlin.mff.cuni.cz"
+#define MY_EMAIL "mvw@planets.elm.net, jack@suse.cz"
/* Finish programs being */
void die(int, char *, ...);
diff --git a/convertquota.8 b/convertquota.8
index de0d76e..705b045 100644
--- a/convertquota.8
+++ b/convertquota.8
@@ -18,27 +18,27 @@ to files
.BR aquota.user
and
.BR aquota.group
-in new format currently used by kernels 2.4.0-ac? and newer on
+in new format currently used by 2.4.0-ac? and newer or by Red Hat Linux 2.4 kernels on
.IR filesystem .
.PP
New file format allows using quotas for 32-bit uids / gids, setting quotas for root,
accounting used space in bytes (and so allowing use of quotas in ReiserFS) and it
-is also architecture independent. This format introduces radix trie (a simple form of tree
+is also architecture independent. This format introduces Radix Tree (a simple form of tree
structure) to quota file.
.SH OPTIONS
.TP
.B -u
-convert user quota file. This is default.
+convert user quota file. This is the default.
.TP
.B -g
convert group quota file.
.SH FILES
.TP 20
.B aquota.user
-user quota file
+new user quota file
.TP
.B aquota.group
-group quota file
+new group quota file
.SH "SEE ALSO"
.BR quota (1),
.BR setquota (8),
@@ -47,5 +47,5 @@ group quota file
.BR quotaon (8),
.BR repquota (8)
.SH AUTHOR
-Jan Kara \<jack@atrey.karlin.mff.cuni.cz\>
+Jan Kara \<jack@suse.cz\>
diff --git a/convertquota.c b/convertquota.c
index 26f34e9..73696d8 100644
--- a/convertquota.c
+++ b/convertquota.c
@@ -2,6 +2,7 @@
*
* Utility for converting quota file from old to new format
*
+ * Sponsored by SuSE CR
*/
#include <stdio.h>
@@ -39,7 +40,7 @@ void parse_options(int argcnt, char **argstr)
case '?':
case 'h':
usage:
- printf(_("Utility for converting quota files.\nUsage:\n%s [-u] [-g] mountpoint\n"), cmdname);
+ printf(_("Utility for converting quota files.\nUsage:\n\t%s [-u] [-g] mountpoint\n"), cmdname);
printf(_("Bugs to %s\n"), MY_EMAIL);
exit(1);
case 'V':
diff --git a/edquota.8 b/edquota.8
index e02218c..69f56d1 100644
--- a/edquota.8
+++ b/edquota.8
@@ -5,11 +5,11 @@ edquota \- edit user quotas
.B edquota
[
.B \-p
-.I proto-user
+.I proto-username
] [
.B \-ug
]
-.IR name .\|.\|.
+.IR username .\|.\|.
.LP
.B edquota
[
@@ -32,7 +32,17 @@ line. For each user or group a temporary file is created with an
.SM ASCII
representation of the current disk quotas for that user or group and an editor
is then invoked on the file. The quotas may then be modified, new
-quotas added, etc. Upon leaving the editor,
+quotas added, etc.
+Setting a quota to zero indicates that no quota should be imposed.
+.PP
+Users are permitted to exceed their soft limits for a grace period that
+may be specified per filesystem. Once the grace period has expired, the
+soft limit is enforced as a hard limit.
+.PP
+The current usage information in the file is for imformational purposes;
+only the hard and soft limits can be changed.
+.PP
+Upon leaving the editor,
.B edquota
reads the temporary file and modifies the binary quota files to reflect
the changes made.
@@ -84,7 +94,7 @@ quota file at the filesystem root (version 2 quota, non-XFS filesystems)
quota file at the filesystem root (version 1 quota, non-XFS filesystems)
.TP
.B /etc/mtab
-mounted filesystems
+mounted filesystems table
.PD
.SH SEE ALSO
.BR quota (1),
diff --git a/quota.c b/quota.c
index 0bb7def..30bb4e5 100644
--- a/quota.c
+++ b/quota.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quota.c,v 1.1 2001/03/23 12:03:26 jkar8572 Exp $"
+#ident "$Id: quota.c,v 1.2 2001/04/04 10:42:12 jkar8572 Exp $"
/*
* Disk quota reporting program.
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
if (gflag) {
ngroups = getgroups(NGROUPS, gidset);
if (ngroups < 0)
- die(1, "quota: getgroups(): %s\n", strerror(errno));
+ die(1, _("quota: getgroups(): %s\n"), strerror(errno));
for (i = 0; i < ngroups; i++)
showquotas(GRPQUOTA, gidset[i]);
}
diff --git a/quotacheck.c b/quotacheck.c
index 5ed85bd..3f9aeaf 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -5,9 +5,10 @@
* Some parts of this utility are copied from old quotacheck by
* Marco van Wieringen <mvw@planets.elm.net> and Edvard Tuinder <ed@elm.ent>
*
+ * New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR
*/
-#ident "$Id: quotacheck.c,v 1.1 2001/03/23 12:03:27 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.2 2001/04/04 10:42:12 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -56,11 +57,14 @@ struct dirs {
dev_t cur_dev; /* Device we are working on */
int files_done, dirs_done;
-int flags, fmt = -1; /* Options from command line; Quota format to use */
+int flags, fmt = -1, cfmt; /* Options from command line; Quota format to use spec. by user; Actual format to check */
int uwant, gwant, ucheck, gcheck; /* Does user want to check user/group quota; Do we check user/group quota? */
char *mntpoint; /* Mountpoint to check */
struct util_dqinfo old_info[MAXQUOTAS]; /* Loaded infos */
+char extensions[MAXQUOTAS + 2][20] = INITQFNAMES; /* Extensions depending on quota type */
+char *basenames[] = INITQFBASENAMES; /* Names of quota files */
+
#ifdef DEBUG_MALLOC
size_t malloc_mem = 0;
size_t free_mem = 0;
@@ -81,7 +85,7 @@ void *xmalloc(size_t size)
#endif
ptr = malloc(size);
if (!ptr)
- die(3, "Not enough memory.\n");
+ die(3, _("Not enough memory.\n"));
memset(ptr, 0, size);
return (ptr);
}
@@ -111,7 +115,7 @@ static int store_dlinks(int type, ino_t i_num)
struct dlinks *lptr;
uint hash = hash_ino(i_num);
- debug(FL_DEBUG, "Adding hardlink for ino %d\n", i_num);
+ debug(FL_DEBUG, _("Adding hardlink for ino %d\n"), i_num);
for (lptr = links_hash[type][hash]; lptr; lptr = lptr->next)
if (lptr->i_num == i_num)
@@ -154,7 +158,7 @@ struct dquot *add_dquot(qid_t id, int type)
struct dquot *lptr;
uint hash = hash_dquot(id);
- debug(FL_DEBUG, "Adding dquot structure type %s for %d\n", type2name(type), (int)id);
+ debug(FL_DEBUG, _("Adding dquot structure type %s for %d\n"), type2name(type), (int)id);
lptr = (struct dquot *)xmalloc(sizeof(struct dquot));
@@ -238,13 +242,12 @@ static loff_t getqsize(char *fname, struct stat *st)
if (S_ISLNK(st->st_mode)) /* There's no way to do ioctl() on links... */
return st->st_blocks << 9;
if ((fd = open(fname, O_RDONLY)) == -1)
- die(2, _("Can't open file %s: %s\n"), fname, strerror(errno));
+ die(2, _("Cannot open file %s: %s\n"), fname, strerror(errno));
if (ioctl(fd, FIOQSIZE, &size) == -1) {
size = st->st_blocks << 9;
if (!ioctl_fail_warn) {
ioctl_fail_warn = 1;
- fputs(_("Can't get exact used space... Results might be inaccurate.\n"),
- stderr);
+ fputs(_("Cannot get exact used space... Results might be inaccurate.\n"), stderr);
}
}
close(fd);
@@ -324,23 +327,17 @@ static void parse_options(int argcnt, char **argstr)
break;
default:
usage:
- printf(_
- ("Utility for checking and repairing quota files.\n%s [-gucfinvdmMR] -F <quota-format> filesystem|-a\n"),
-slash);
+ printf(_("Utility for checking and repairing quota files.\n%s [-gucfinvdmMR] [-F <quota-format>] filesystem|-a\n"), slash);
printf(_("Bugs to %s\n"), MY_EMAIL);
exit(1);
}
}
if (!(uwant | gwant))
uwant = 1;
- if (argcnt == optind) {
+ if (argcnt == optind && !(flags & FL_ALL)) {
fputs(_("Bad number of arguments.\n"), stderr);
goto usage;
}
- if (fmt == -1) {
- fputs(_("Quota format must be specified for scanning.\n"), stderr);
- goto usage;
- }
if (fmt == QF_XFS) {
fputs(_("XFS quota format needs no checking.\n"), stderr);
exit(0);
@@ -438,7 +435,7 @@ static int scan_dir(char *pathname)
int ret;
if ((dp = opendir(pathname)) == (DIR *) NULL)
- die(2, "\nCan open directory %s: %s\n", pathname, strerror(errno));
+ die(2, _("\nCan open directory %s: %s\n"), pathname, strerror(errno));
chdir(pathname);
while ((de = readdir(dp)) != (struct dirent *)NULL) {
@@ -450,7 +447,7 @@ static int scan_dir(char *pathname)
if ((lstat(de->d_name, &st)) == -1) {
fprintf(stderr,
_
- ("lstat can't stat `%s/%s': %s\nGuess you'd better run fsck first !\nexiting...\n"),
+ ("lstat Cannot stat `%s/%s': %s\nGuess you'd better run fsck first !\nexiting...\n"),
pathname, de->d_name, strerror(errno));
goto out;
}
@@ -488,7 +485,7 @@ static int scan_dir(char *pathname)
/*
* Traverse the directory stack, and check it.
*/
- debug(FL_DEBUG, "Scanning stored directories from directory stack\n");
+ debug(FL_DEBUG, _("Scanning stored directories from directory stack\n"));
while (dir_stack != (struct dirs *)NULL) {
new_dir = dir_stack;
dir_stack = dir_stack->next;
@@ -547,7 +544,7 @@ static int process_file(char *mnt_fsname, struct mntent *mnt, int type)
debug(FL_DEBUG | FL_VERBOSE, _("Going to check %s quota file of %s\n"), type2name(type),
mnt->mnt_dir);
- if (kern_quota_on(mnt_fsname, type, (1 << fmt)) > 0) { /* Is quota enabled? */
+ if (kern_quota_on(mnt_fsname, type, (1 << cfmt)) > 0) { /* Is quota enabled? */
if (!(flags & FL_FORCE)) {
if (flags & FL_INTERACTIVE) {
printf(_
@@ -570,20 +567,20 @@ Please turn quotas off or use -f to force checking.\n"),
die(4, _("Error while syncing quotas: %s\n"), strerror(errno));
}
- qfname = get_qf_name(mnt, type, fmt);
+ qfname = get_qf_name(mnt, type, cfmt);
if (!qfname) {
- fprintf(stderr, _("Can't get quotafile name for %s\n"), mnt_fsname);
+ fprintf(stderr, _("Cannot get quotafile name for %s\n"), mnt_fsname);
return -1;
}
if ((fd = open(qfname, O_RDONLY)) < 0) {
- fprintf(stderr, _("Can't open quotafile %s: %s\n"), qfname, strerror(errno));
+ fprintf(stderr, _("Cannot open quotafile %s: %s\n"), qfname, strerror(errno));
free(qfname);
return -1;
}
memset(old_info + type, 0, sizeof(old_info[type]));
ret = 0;
- switch (fmt) {
+ switch (cfmt) {
case QF_TOONEW:
fprintf(stderr, _("Too new quotafile format on %s\n"), mnt_fsname);
ret = -1;
@@ -606,8 +603,8 @@ static int rename_files(struct mntent *mnt, int type)
char *filename, newfilename[PATH_MAX];
struct stat st;
- if (!(filename = get_qf_name(mnt, type, fmt)))
- die(2, _("Can't get name of old quotafile on %s.\n"), mnt->mnt_dir);
+ if (!(filename = get_qf_name(mnt, type, cfmt)))
+ die(2, _("Cannot get name of old quotafile on %s.\n"), mnt->mnt_dir);
debug(FL_DEBUG | FL_VERBOSE, _("Data dumped.\nRenaming old quotafile to %s~\n"), filename);
if (stat(filename, &st) < 0) { /* File doesn't exist? */
if (errno == ENOENT) {
@@ -626,7 +623,7 @@ static int rename_files(struct mntent *mnt, int type)
if (newfilename[strlen(newfilename) - 1] != '~')
die(8, _("Name of quota file too long. Contact %s.\n"), MY_EMAIL);
if (rename(filename, newfilename) < 0) {
- fprintf(stderr, _("Can't rename old quotafile %s to %s: %s\n"), filename,
+ fprintf(stderr, _("Cannot rename old quotafile %s to %s: %s\n"), filename,
newfilename, strerror(errno));
free(filename);
return -1;
@@ -637,7 +634,7 @@ static int rename_files(struct mntent *mnt, int type)
strcpy(newfilename, filename);
sstrncat(newfilename, ".new", PATH_MAX);
if (rename(newfilename, filename) < 0) {
- fprintf(stderr, _("Can't rename new quotafile %s to name %s: %s\n"), newfilename,
+ fprintf(stderr, _("Cannot rename new quotafile %s to name %s: %s\n"), newfilename,
filename, strerror(errno));
free(filename);
return -1;
@@ -658,8 +655,8 @@ static int dump_to_file(char *mnt_fsname, struct mntent *mnt, int type)
struct quota_handle *h;
debug(FL_DEBUG | FL_VERBOSE, _("Dumping gathered data for %ss.\n"), type2name(type));
- if (!(h = new_io(mnt, type, fmt))) {
- fprintf(stderr, _("Can't initialize IO on new quotafile: %s\n"), strerror(errno));
+ if (!(h = new_io(mnt, type, cfmt))) {
+ fprintf(stderr, _("Cannot initialize IO on new quotafile: %s\n"), strerror(errno));
return -1;
}
memcpy(&h->qh_info, old_info + type, sizeof(h->qh_info));
@@ -675,26 +672,27 @@ static int dump_to_file(char *mnt_fsname, struct mntent *mnt, int type)
h->qh_ops->commit_dquot(dquot);
}
if (end_io(h) < 0) {
- fprintf(stderr, _("Can't finish IO on new quotafile: %s\n"), strerror(errno));
+ fprintf(stderr, _("Cannot finish IO on new quotafile: %s\n"), strerror(errno));
return -1;
}
if (rename_files(mnt, type) < 0)
return -1;
- if (fmt == kern_quota_on(mnt_fsname, type, 1 << fmt)) { /* Quota turned on? */
+ if (cfmt == kern_quota_on(mnt_fsname, type, 1 << cfmt)) { /* Quota turned on? */
char *filename;
- filename = get_qf_name(mnt, type, fmt);
+ filename = get_qf_name(mnt, type, cfmt);
if (quotactl(QCMD(Q_QUOTAOFF, type), mnt_fsname, 0, NULL)
|| quotactl(QCMD(Q_QUOTAON, type), mnt_fsname, 0, filename))
fprintf(stderr,
_
- ("Can't turn %s quotas on %s off and on: %s\nKernel won't know about changes quotacheck did.\n"),
+ ("Cannot turn %s quotas on %s off and on: %s\nKernel won't know about changes quotacheck did.\n"),
type2name(type), mnt_fsname, strerror(errno));
free(filename);
}
return 0;
}
+/* Buffer quotafile, run filesystem scan, dump quotafiles */
static void check_dir(char *mnt_fsname, struct mntent *mnt)
{
struct stat st;
@@ -702,7 +700,7 @@ static void check_dir(char *mnt_fsname, struct mntent *mnt)
loff_t qspace;
if (lstat(mnt->mnt_dir, &st) < 0)
- die(2, _("Can't stat mountpoint %s: %s\n"), mnt, strerror(errno));
+ die(2, _("Cannot stat mountpoint %s: %s\n"), mnt, strerror(errno));
if (!S_ISDIR(st.st_mode))
die(2, _("Mountpoint %s isn't directory?!\n"), mnt);
qspace = getqsize(mnt->mnt_dir, &st);
@@ -731,7 +729,7 @@ static void check_dir(char *mnt_fsname, struct mntent *mnt)
NULL) < 0 && !(flags & FL_FORCEREMOUNT)) {
if (flags & FL_INTERACTIVE) {
printf(_
- ("Can't remount filesystem mounted on %s read-only. Counted values might not be right.\n"),
+ ("Cannot remount filesystem mounted on %s read-only. Counted values might not be right.\n"),
mnt->mnt_dir);
if (!ask_yn(_("Should I continue"), 0)) {
printf(_("As you wish... Canceling check of this file.\n"));
@@ -741,7 +739,7 @@ mnt->mnt_dir);
else {
fprintf(stderr,
_
- ("Can't remount filesystem mounted on %s read-only so counted values might not be right.\n\
+ ("Cannot remount filesystem mounted on %s read-only so counted values might not be right.\n\
Please stop all programs writing to filesystem or use -F flag to force checking.\n"),
mnt->mnt_dir);
goto out;
@@ -749,7 +747,7 @@ Please stop all programs writing to filesystem or use -F flag to force checking.
}
else
remounted = 1;
- debug(FL_DEBUG | FL_VERBOSE, _("Filesystem remounted RO\n"));
+ debug(FL_DEBUG | FL_VERBOSE, _("Filesystem remounted read-only\n"));
}
debug(FL_VERBOSE, _("Scanning %s [%s] "), mnt_fsname, mnt->mnt_dir);
#if defined(EXT2_DIRECT)
@@ -771,10 +769,7 @@ Please stop all programs writing to filesystem or use -F flag to force checking.
files_done);
if (remounted) {
if (mount(NULL, mnt->mnt_dir, mnt->mnt_type, MS_MGC_VAL | MS_REMOUNT, NULL) < 0)
- die(4,
- _
- ("Can't remount filesystem %s read-write. Can't write new quota files.\n"),
- mnt->mnt_dir);
+ die(4, _("Cannot remount filesystem %s read-write. cannot write new quota files.\n"), mnt->mnt_dir);
debug(FL_DEBUG | FL_VERBOSE, _("Filesystem remounted RW.\n"));
}
if (ucheck)
@@ -785,6 +780,23 @@ Please stop all programs writing to filesystem or use -F flag to force checking.
remove_list();
}
+/* Detect quota format from filename of present files */
+static int detect_filename_format(struct mntent *mnt, int type)
+{
+ struct stat statbuf;
+ char namebuf[PATH_MAX];
+
+ sprintf(namebuf, "%s/%s.%s", mnt->mnt_dir, basenames[QF_VFSV0], extensions[type]);
+ if (!stat(namebuf, &statbuf))
+ return QF_VFSV0;
+ if (errno != ENOENT)
+ return -1;
+ sprintf(namebuf, "%s/%s.%s", mnt->mnt_dir, basenames[QF_VFSOLD], extensions[type]);
+ if (!stat(namebuf, &statbuf))
+ return QF_VFSOLD;
+ return -1;
+}
+
static void check_all(void)
{
FILE *mntf;
@@ -794,7 +806,7 @@ static void check_all(void)
int gotmnt = 0, i;
if (!(mntf = setmntent(MOUNTED, "r")))
- die(2, _("Can't open %s: %s\n"), MOUNTED, strerror(errno));
+ die(2, _("Cannot open %s: %s\n"), MOUNTED, strerror(errno));
while ((mnt = getmntent(mntf))) {
if (gotmnt == MAXMNTPOINTS)
die(3, _("Too many mountpoints. Please report to: %s\n"), MY_EMAIL);
@@ -816,6 +828,7 @@ static void check_all(void)
mnt->mnt_dir);
continue;
}
+ cfmt = fmt;
if (uwant && hasquota(mnt, USRQUOTA))
ucheck = 1;
else
@@ -824,12 +837,21 @@ static void check_all(void)
gcheck = 1;
else
gcheck = 0;
+ if (!ucheck && !gcheck)
+ continue;
+ if (cfmt == -1) {
+ if ((cfmt = detect_filename_format(mnt, ucheck ? USRQUOTA : GRPQUOTA)) == -1) {
+ fprintf(stderr, _("Cannot guess format from filename on %s. Please specify format on commandline.\n"), mnt_fslabel);
+ continue;
+ }
+ debug(FL_DEBUG | FL_VERBOSE, _("Detected quota format %s\n"), fmt2name(cfmt));
+ }
check_dir(devlist[gotmnt - 1], mnt);
}
}
endmntent(mntf);
if (!(flags & FL_ALL) && !gotmnt)
- die(1, _("Can't find mountpoint %s.\n"), mntpoint);
+ die(1, _("Cannot find mountpoint %s.\n"), mntpoint);
for (i = 0; i < gotmnt; i++)
free(devlist[i]);
}
diff --git a/quotaio.c b/quotaio.c
index 0a1927d..f790887 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -2,6 +2,7 @@
*
* Generic IO operations on quotafiles
*
+ * Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
#include <stdio.h>
diff --git a/quotaio.h b/quotaio.h
index f5d790c..e9f88d5 100644
--- a/quotaio.h
+++ b/quotaio.h
@@ -32,6 +32,13 @@
""\
}
+#define INITQFMTNAMES {\
+ "vfsold",\
+ "vfsv0",\
+ "rpc",\
+ "xfs"\
+}
+
/* Values for format handling */
#define QF_TOONEW -2 /* Quota format is too new to handle */
#define QF_ERROR -1 /* There was error while detecting format (maybe unknown format...) */
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 7d82dcf..ecbce1d 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -1,5 +1,7 @@
/*
* Implementation of new quotafile format
+ *
+ * Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
#include <sys/types.h>
@@ -223,7 +225,7 @@ static void read_blk(struct quota_handle *h, uint blk, dqbuf_t buf)
lseek(h->qh_fd, blk << V2_DQBLKSIZE_BITS, SEEK_SET);
err = read(h->qh_fd, buf, V2_DQBLKSIZE);
if (err < 0)
- die(2, "Can't read block %u: %s\n", blk, strerror(errno));
+ die(2, _("Can't read block %u: %s\n"), blk, strerror(errno));
else if (err != V2_DQBLKSIZE)
memset(buf + err, 0, V2_DQBLKSIZE - err);
}
@@ -236,7 +238,7 @@ static int write_blk(struct quota_handle *h, uint blk, dqbuf_t buf)
lseek(h->qh_fd, blk << V2_DQBLKSIZE_BITS, SEEK_SET);
err = write(h->qh_fd, buf, V2_DQBLKSIZE);
if (err < 0 && errno != ENOSPC)
- die(2, "Can't write block (%u): %s\n", blk, strerror(errno));
+ die(2, _("Can't write block (%u): %s\n"), blk, strerror(errno));
if (err != V2_DQBLKSIZE)
return -ENOSPC;
return 0;
@@ -365,7 +367,7 @@ static uint find_free_dqentry(struct quota_handle *h, struct dquot *dquot, int *
/* Find free structure in block */
for (i = 0; i < V2_DQSTRINBLK && !empty_dquot(ddquot + i); i++);
if (i == V2_DQSTRINBLK)
- die(2, "find_free_dqentry(): Data block full but it shouldn't.\n");
+ die(2, _("find_free_dqentry(): Data block full but it shouldn't.\n"));
write_blk(h, blk, buf);
dquot->dq_dqb.u.v2_mdqb.dqb_off =
(blk << V2_DQBLKSIZE_BITS) + sizeof(struct v2_disk_dqdbheader) +
@@ -401,7 +403,7 @@ static int do_insert_tree(struct quota_handle *h, struct dquot *dquot, uint * tr
newson = 1;
if (depth == V2_DQTREEDEPTH - 1) {
if (newblk)
- die(2, "Inserting already present quota entry (block %u).\n",
+ die(2, _("Inserting already present quota entry (block %u).\n"),
ref[V2_GETIDINDEX(dquot->dq_id, depth)]);
newblk = find_free_dqentry(h, dquot, &ret);
}
@@ -424,7 +426,7 @@ static inline void dq_insert_tree(struct quota_handle *h, struct dquot *dquot)
int tmp = V2_DQTREEOFF;
if (do_insert_tree(h, dquot, &tmp, 0) < 0)
- die(2, "Can't write quota (id %u): %s\n", (uint) dquot->dq_id, strerror(errno));
+ die(2, _("Can't write quota (id %u): %s\n"), (uint) dquot->dq_id, strerror(errno));
}
/* Write dquot to file */
@@ -442,7 +444,7 @@ static void v2_write_dquot(struct dquot *dquot)
if (ret != sizeof(struct v2_disk_dqblk)) {
if (ret > 0)
errno = ENOSPC;
- die(2, "Quota write failed (id %u): %s\n", (uint) dquot->dq_id, strerror(errno));
+ die(2, _("Quota write failed (id %u): %s\n"), (uint) dquot->dq_id, strerror(errno));
}
}
@@ -453,7 +455,7 @@ static void free_dqentry(struct quota_handle *h, struct dquot *dquot, uint blk)
dqbuf_t buf = getdqbuf();
if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> V2_DQBLKSIZE_BITS != blk)
- die(2, "Quota structure has offset to other block (%u) than it should (%u).\n", blk,
+ die(2, _("Quota structure has offset to other block (%u) than it should (%u).\n"), blk,
(uint) (dquot->dq_dqb.u.v2_mdqb.dqb_off >> V2_DQBLKSIZE_BITS));
read_blk(h, blk, buf);
dh = (struct v2_disk_dqdbheader *)buf;
@@ -532,7 +534,7 @@ static loff_t find_block_dqentry(struct quota_handle *h, struct dquot *dquot, ui
break;
}
if (i == V2_DQSTRINBLK)
- die(2, "Quota for id %u referenced but not present.\n", dquot->dq_id);
+ die(2, _("Quota for id %u referenced but not present.\n"), dquot->dq_id);
freedqbuf(buf);
return (blk << V2_DQBLKSIZE_BITS) + sizeof(struct v2_disk_dqdbheader) +
@@ -601,7 +603,7 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
if (ret != sizeof(struct v2_disk_dqblk)) {
if (ret > 0)
errno = EIO;
- die(2, "Can't read quota structure for id %u: %s\n", dquot->dq_id,
+ die(2, _("Can't read quota structure for id %u: %s\n"), dquot->dq_id,
strerror(errno));
}
v2_disk2memdqblk(&dquot->dq_dqb, &ddquot);
diff --git a/quotasys.c b/quotasys.c
index 01badd4..224ac95 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -2,6 +2,7 @@
*
* Interactions of quota with system - filenames, fstab and so on...
*
+ * Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
#include <stdio.h>
@@ -37,6 +38,7 @@
static char extensions[MAXQUOTAS + 2][20] = INITQFNAMES;
static char *basenames[] = INITQFBASENAMES;
+static char *fmtnames[] = INITQFMTNAMES;
/*
* Convert type of quota to written representation
@@ -137,20 +139,31 @@ void id2name(int id, int qtype, char *buf)
*/
int name2fmt(char *str)
{
- if (!strcmp(str, _("vfsold"))) /* Old quota format */
- return QF_VFSOLD;
- if (!strcmp(str, _("vfsv0"))) /* New quota format */
- return QF_VFSV0;
- if (!strcmp(str, _("rpc"))) /* RPC quota calls */
- return QF_RPC;
+ int fmt;
+
+ for (fmt = 0; fmt < QUOTAFORMATS; fmt++)
+ if (!strcmp(str, fmtnames[fmt]))
+ return fmt;
fprintf(stderr, _("Unknown quota format: %s\nSupported formats are:\n\
vfsold - original quota format\n\
vfsv0 - new quota format\n\
- rpc - use RPC calls\n"), str);
+ rpc - use RPC calls\n\
+ xfs - XFS quota format\n"), str);
return QF_ERROR;
}
/*
+ * Convert quota format number to name
+ */
+char *fmt2name(int fmt)
+{
+
+ if (fmt < 0)
+ return _("Unknown format");
+ return fmtnames[fmt];
+}
+
+/*
* Convert time difference of seconds and current time
*/
void difftime2str(time_t seconds, char *buf)
@@ -259,7 +272,7 @@ static int check_fmtfile_exists(struct mntent *mnt, int type, int fmt, char *nam
if (!stat(namebuf, &buf))
return 1;
if (errno != ENOENT) {
- fprintf(stderr, "Can't stat quotafile %s: %s\n", namebuf, strerror(errno));
+ fprintf(stderr, _("Can't stat quotafile %s: %s\n"), namebuf, strerror(errno));
return -1;
}
return 0;
@@ -405,7 +418,7 @@ int kern_quota_format(void)
return QF_ERROR;
if (errno == EINVAL || errno == EFAULT || errno == EPERM) /* Old quota compiled? */
return ret | (1 << QF_VFSOLD);
- die(4, "Error while detecting kernel quota version: %s\n", strerror(errno));
+ die(4, _("Error while detecting kernel quota version: %s\n"), strerror(errno));
}
/* We might do some more generic checks in future but this should be enough for now */
if (stats.version > KERN_KNOWN_QUOTA_VERSION) /* Newer kernel than we know? */
diff --git a/quotasys.h b/quotasys.h
index e0380fb..f5db080 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -44,6 +44,9 @@ void id2name(int id, int qtype, char *buf);
/* Convert quota format name to number */
int name2fmt(char *str);
+/* Convert quota format number to name */
+char *fmt2name(int fmt);
+
/* Convert time difference between given time and current time to printable form */
void difftime2str(time_t, char *);
diff --git a/repquota.c b/repquota.c
index b296149..164e528 100644
--- a/repquota.c
+++ b/repquota.c
@@ -2,6 +2,8 @@
*
* Utility for reporting quotas
*
+ * Based on old repquota.
+ * Jan Kara <jack@suse.cz> - Sponsored by SuSE CZ
*/
#include <stdio.h>
@@ -41,10 +43,7 @@ static void parse_options(int argcnt, char **argstr)
case '?':
case 'h':
usage:
- fprintf(stderr,
- _
- ("Utility for reporting quotas.\nUsage:\n%s [-vug] [-F quotaformat] (-a | mntpoint)\n"),
- slash);
+ fprintf(stderr, _("Utility for reporting quotas.\nUsage:\n%s [-vug] [-F quotaformat] (-a | mntpoint)\n"), slash);
fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL);
exit(1);
case 'V':
@@ -124,13 +123,17 @@ static void report_it(struct quota_handle *h, int type)
time2str(h->qh_info.dqi_bgrace, bgbuf, TF_ROUND);
time2str(h->qh_info.dqi_igrace, igbuf, TF_ROUND);
printf("Block grace time: %s Inode grace time: %s\n", bgbuf, igbuf);
- printf(" Block limits File limits\n");
+ printf(" Block limits File limits\n");
printf("User used soft hard grace used soft hard grace\n");
+ printf("----------------------------------------------------------------------\n");
if (h->qh_ops->scan_dquots(h, print) < 0)
return;
- if (h->qh_ops->report)
+ if (h->qh_ops->report) {
+ putchar('\n');
h->qh_ops->report(h, flags & FL_VERBOSE);
+ putchar('\n');
+ }
}
static void report(int type)
diff --git a/setquota.8 b/setquota.8
index 4e4323d..c4f9fcb 100644
--- a/setquota.8
+++ b/setquota.8
@@ -77,7 +77,7 @@ quota file at the filesystem root (version 2 quota, non-XFS filesystems)
quota file at the filesystem root (version 1 quota, non-XFS filesystems)
.TP
.B /etc/mtab
-mounted filesystems
+mounted filesystem table
.PD
.SH SEE ALSO
.BR edquota (8),
diff --git a/setquota.c b/setquota.c
index 63f80c4..a08783a 100644
--- a/setquota.c
+++ b/setquota.c
@@ -1,7 +1,8 @@
/*
*
- * Set disk quota from command line
+ * Set disk quota from command line
*
+ * Jan Kara <jack@suse.cz> - sponsored by SuSE CR
*/
#include <rpc/rpc.h>
#include <sys/types.h>
diff --git a/xqmstats.c b/xqmstats.c
index ed66e46..9de5434 100644
--- a/xqmstats.c
+++ b/xqmstats.c
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
memset(values, 0, sizeof(unsigned) * 8);
if ((stats = fopen(STATFILE, "r")) == NULL || (xqm = fopen(XQMFILE, "r")) == NULL) {
- fprintf(stderr, "The running kernel does not support XFS\n");
+ fprintf(stderr, _("The running kernel does not support XFS\n"));
return 1;
}
while (!feof(stats)) {