|
|
dba0f0 |
From 73316c7746e89896c63fc49f24cafe32335df288 Mon Sep 17 00:00:00 2001
|
|
|
dba0f0 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
dba0f0 |
Date: Wed, 9 Jan 2013 18:16:14 +0100
|
|
|
dba0f0 |
Subject: [PATCH 5/5] Recognize units at inode limits by edquota
|
|
|
dba0f0 |
MIME-Version: 1.0
|
|
|
dba0f0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
dba0f0 |
Content-Transfer-Encoding: 8bit
|
|
|
dba0f0 |
|
|
|
dba0f0 |
With this patch, it's possible to specify inode values including
|
|
|
dba0f0 |
decimal units in the editor run by edquota.
|
|
|
dba0f0 |
|
|
|
dba0f0 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
dba0f0 |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
dba0f0 |
---
|
|
|
dba0f0 |
edquota.8 | 4 ++++
|
|
|
dba0f0 |
quotaops.c | 26 ++++++++++++++++++++++----
|
|
|
dba0f0 |
setquota.c | 2 --
|
|
|
dba0f0 |
3 files changed, 26 insertions(+), 6 deletions(-)
|
|
|
dba0f0 |
|
|
|
dba0f0 |
diff --git a/edquota.8 b/edquota.8
|
|
|
dba0f0 |
index 2617068..fefb5d4 100644
|
|
|
dba0f0 |
--- a/edquota.8
|
|
|
dba0f0 |
+++ b/edquota.8
|
|
|
dba0f0 |
@@ -68,6 +68,10 @@ Block usage and limits are reported and interpereted as multiples of kibibyte
|
|
|
dba0f0 |
(1024 bytes) blocks by default. Symbols K, M, G, and T can be appended to
|
|
|
dba0f0 |
numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes.
|
|
|
dba0f0 |
.PP
|
|
|
dba0f0 |
+Inode usage and limits are interpreted literally. Symbols k, m, g, and t can
|
|
|
dba0f0 |
+be appended to numeric value to express multiples of 10^3, 10^6, 10^9, and
|
|
|
dba0f0 |
+10^12 inodes.
|
|
|
dba0f0 |
+.PP
|
|
|
dba0f0 |
Users are permitted to exceed their soft limits for a grace period that
|
|
|
dba0f0 |
may be specified per filesystem. Once the grace period has expired, the
|
|
|
dba0f0 |
soft limit is enforced as a hard limit.
|
|
|
dba0f0 |
diff --git a/quotaops.c b/quotaops.c
|
|
|
dba0f0 |
index 32e21da..175a945 100644
|
|
|
dba0f0 |
--- a/quotaops.c
|
|
|
dba0f0 |
+++ b/quotaops.c
|
|
|
dba0f0 |
@@ -310,11 +310,11 @@ int readprivs(struct dquot *qlist, int infd)
|
|
|
dba0f0 |
{
|
|
|
dba0f0 |
FILE *fd;
|
|
|
dba0f0 |
int cnt;
|
|
|
dba0f0 |
- qsize_t blocks, bsoft, bhard;
|
|
|
dba0f0 |
- long long inodes, isoft, ihard;
|
|
|
dba0f0 |
+ qsize_t blocks, bsoft, bhard, inodes, isoft, ihard;
|
|
|
dba0f0 |
struct dquot *q;
|
|
|
dba0f0 |
char fsp[BUFSIZ], line[BUFSIZ];
|
|
|
dba0f0 |
char blocksstring[BUFSIZ], bsoftstring[BUFSIZ], bhardstring[BUFSIZ];
|
|
|
dba0f0 |
+ char inodesstring[BUFSIZ], isoftstring[BUFSIZ], ihardstring[BUFSIZ];
|
|
|
dba0f0 |
const char *error;
|
|
|
dba0f0 |
|
|
|
dba0f0 |
lseek(infd, 0, SEEK_SET);
|
|
|
dba0f0 |
@@ -328,9 +328,9 @@ int readprivs(struct dquot *qlist, int infd)
|
|
|
dba0f0 |
fgets(line, sizeof(line), fd);
|
|
|
dba0f0 |
|
|
|
dba0f0 |
while (fgets(line, sizeof(line), fd)) {
|
|
|
dba0f0 |
- cnt = sscanf(line, "%s %s %s %s %llu %llu %llu",
|
|
|
dba0f0 |
+ cnt = sscanf(line, "%s %s %s %s %s %s %s",
|
|
|
dba0f0 |
fsp, blocksstring, bsoftstring, bhardstring,
|
|
|
dba0f0 |
- &inodes, &isoft, &ihard);
|
|
|
dba0f0 |
+ inodesstring, isoftstring, ihardstring);
|
|
|
dba0f0 |
|
|
|
dba0f0 |
if (cnt != 7) {
|
|
|
dba0f0 |
errstr(_("Bad format:\n%s\n"), line);
|
|
|
dba0f0 |
@@ -354,6 +354,24 @@ int readprivs(struct dquot *qlist, int infd)
|
|
|
dba0f0 |
bhardstring, error);
|
|
|
dba0f0 |
return -1;
|
|
|
dba0f0 |
}
|
|
|
dba0f0 |
+ error = str2number(inodesstring, &inodes);
|
|
|
dba0f0 |
+ if (error) {
|
|
|
dba0f0 |
+ errstr(_("Bad inode usage: %s: %s\n"),
|
|
|
dba0f0 |
+ inodesstring, error);
|
|
|
dba0f0 |
+ return -1;
|
|
|
dba0f0 |
+ }
|
|
|
dba0f0 |
+ error = str2number(isoftstring, &isoft);
|
|
|
dba0f0 |
+ if (error) {
|
|
|
dba0f0 |
+ errstr(_("Bad inode soft limit: %s: %s\n"),
|
|
|
dba0f0 |
+ isoftstring, error);
|
|
|
dba0f0 |
+ return -1;
|
|
|
dba0f0 |
+ }
|
|
|
dba0f0 |
+ error = str2number(ihardstring, &ihard);
|
|
|
dba0f0 |
+ if (error) {
|
|
|
dba0f0 |
+ errstr(_("Bad inode hard limit: %s: %s\n"),
|
|
|
dba0f0 |
+ ihardstring, error);
|
|
|
dba0f0 |
+ return -1;
|
|
|
dba0f0 |
+ }
|
|
|
dba0f0 |
|
|
|
dba0f0 |
merge_limits_to_list(qlist, fsp, blocks, bsoft, bhard, inodes, isoft, ihard);
|
|
|
dba0f0 |
}
|
|
|
dba0f0 |
diff --git a/setquota.c b/setquota.c
|
|
|
dba0f0 |
index 19449ad..cc5fee8 100644
|
|
|
dba0f0 |
--- a/setquota.c
|
|
|
dba0f0 |
+++ b/setquota.c
|
|
|
dba0f0 |
@@ -406,8 +406,6 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
|
|
|
dba0f0 |
}
|
|
|
dba0f0 |
break;
|
|
|
dba0f0 |
}
|
|
|
dba0f0 |
- *isoftlimit = is;
|
|
|
dba0f0 |
- *ihardlimit = ih;
|
|
|
dba0f0 |
return 0;
|
|
|
dba0f0 |
}
|
|
|
dba0f0 |
|
|
|
dba0f0 |
--
|
|
|
dba0f0 |
1.8.1.4
|
|
|
dba0f0 |
|