diff mbox

[4/3] xfs_quota: remove dodgy init_cvtnum

Message ID 72d932f4-5ae1-29b1-e4de-d4740913e901@sandeen.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Sandeen Aug. 22, 2017, 9:22 p.m. UTC
init_cvtnum() in quota is a lie; it sets blocksize to
4096 and sector size to 512 unconditionally.

Now that cvtnum can cope with unset block and/or sectors,
just pass in zeros, meaning that we can't specify limits
in terms of block or sector count.

Now that we're not using the "fake" sizes, remove them
from the extractb() args as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/quota/edit.c b/quota/edit.c
index 8418e85..aa8c14e 100644
--- a/quota/edit.c
+++ b/quota/edit.c
@@ -222,8 +222,6 @@  extractb(
 	char		*string,
 	const char	*prefix,
 	int		length,
-	uint		blocksize,
-	uint		sectorsize,
 	uint64_t	*value)
 {
 	long long	v;
@@ -231,7 +229,7 @@  extractb(
 
 	if (strncmp(string, prefix, length) == 0) {
 		s = string + length + 1;
-		v = cvtnum(blocksize, sectorsize, s);
+		v = cvtnum(0, 0, s);
 		if (v == -1LL) {
 			fprintf(stderr,
 				_("%s: Error: could not parse size %s.\n"),
@@ -272,9 +270,8 @@  limit_f(
 	char		*name;
 	uint64_t	bsoft, bhard, isoft, ihard, rtbsoft, rtbhard;
 	int		c, type = 0, mask = 0, flags = 0;
-	uint		bsize, ssize, endoptions;
+	uint		endoptions;
 
-	init_cvtnum(&bsize, &ssize);
 	bsoft = bhard = isoft = ihard = rtbsoft = rtbhard = 0;
 	while ((c = getopt(argc, argv, "dgpu")) != EOF) {
 		switch (c) {
@@ -315,17 +312,17 @@  limit_f(
 	 */
 	while (argc > optind + endoptions - 1) {
 		char *s = argv[optind++];
-		if (extractb(s, "bsoft=", 5, bsize, ssize, &bsoft))
+		if (extractb(s, "bsoft=", 5, &bsoft))
 			mask |= FS_DQ_BSOFT;
-		else if (extractb(s, "bhard=", 5, bsize, ssize, &bhard))
+		else if (extractb(s, "bhard=", 5, &bhard))
 			mask |= FS_DQ_BHARD;
 		else if (extracti(s, "isoft=", 5, &isoft))
 			mask |= FS_DQ_ISOFT;
 		else if (extracti(s, "ihard=", 5, &ihard))
 			mask |= FS_DQ_IHARD;
-		else if (extractb(s, "rtbsoft=", 7, bsize, ssize, &rtbsoft))
+		else if (extractb(s, "rtbsoft=", 7, &rtbsoft))
 			mask |= FS_DQ_RTBSOFT;
-		else if (extractb(s, "rtbhard=", 7, bsize, ssize, &rtbhard))
+		else if (extractb(s, "rtbhard=", 7, &rtbhard))
 			mask |= FS_DQ_RTBHARD;
 		else {
 			exitcode = 1;
diff --git a/quota/init.c b/quota/init.c
index d45dc4c..eb2b9ca 100644
--- a/quota/init.c
+++ b/quota/init.c
@@ -51,15 +51,6 @@  usage(void)
 	exit(1);
 }
 
-void
-init_cvtnum(
-	unsigned int	*blocksize,
-	unsigned int	*sectsize)
-{
-	*blocksize = 4096;
-	*sectsize = 512;
-}
-
 static void
 init_commands(void)
 {
diff --git a/quota/init.h b/quota/init.h
index 6879855..10b4d68 100644
--- a/quota/init.h
+++ b/quota/init.h
@@ -29,5 +29,3 @@  extern void	quot_init(void);
 extern void	quota_init(void);
 extern void	report_init(void);
 extern void	state_init(void);
-
-extern void init_cvtnum(unsigned int *, unsigned int *);