public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_quota: Warn if specified non-zero quota will be round down to zero.
@ 2008-12-15 23:27 Arkadiusz Miskiewicz
  2008-12-16  1:27 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Arkadiusz Miskiewicz @ 2008-12-15 23:27 UTC (permalink / raw)
  To: linux-xfs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]

User specified quota limit is internally converted to "basic blocks"
unit (512 bytes in size). Quota value will be silently converted
to zero when user enters any value lower than 512 bytes.

Warn in such case:

: # ./xfs_quota -x -c "limit -u bsoft=431 12000" /home
: xfs_quota: Warning: `431' in quota blocks is 0 (unlimited).
---
 xfsprogs/po/pl.po     |    5 +++++
 xfsprogs/quota/edit.c |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/xfsprogs/po/pl.po b/xfsprogs/po/pl.po
index b4e1d76..d13184b 100644
--- a/xfsprogs/po/pl.po
+++ b/xfsprogs/po/pl.po
@@ -3670,6 +3670,11 @@ msgstr "%s: nieprawid
 msgid "%s: invalid project name: %s\n"
 msgstr "%s: nieprawid³owa nazwa projektu: %s\n"
 
+#: ../quota/edit.c:237
+#, c-format
+msgid "%s: Warning: `%s' in quota blocks is 0 (unlimited).\n"
+msgstr "%s: Uwaga: `%s' w blokach quoty oznacza 0 (nieograniczone).\n"
+
 #: ../quota/edit.c:318
 #, c-format
 msgid "%s: unrecognised argument %s\n"
diff --git a/xfsprogs/quota/edit.c b/xfsprogs/quota/edit.c
index 15c72c4..ce7f7e9 100644
--- a/xfsprogs/quota/edit.c
+++ b/xfsprogs/quota/edit.c
@@ -233,6 +233,8 @@ extractb(
 		s = string + length + 1;
 		v = (__uint64_t)cvtnum(blocksize, sectorsize, s);
 		*value = v >> 9;	/* syscalls use basic blocks */
+		if (v > 0 && *value == 0)
+			fprintf(stderr, _("%s: Warning: `%s' in quota blocks is 0 (unlimited).\n"), progname, s);
 		return 1;
 	}
 	return 0;
-- 
1.6.0.5


[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs_quota: Warn if specified non-zero quota will be round down to zero.
  2008-12-15 23:27 [PATCH] xfs_quota: Warn if specified non-zero quota will be round down to zero Arkadiusz Miskiewicz
@ 2008-12-16  1:27 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2008-12-16  1:27 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: linux-xfs

Arkadiusz Miskiewicz wrote:
> User specified quota limit is internally converted to "basic blocks"
> unit (512 bytes in size). Quota value will be silently converted
> to zero when user enters any value lower than 512 bytes.
> 
> Warn in such case:
> 
> : # ./xfs_quota -x -c "limit -u bsoft=431 12000" /home
> : xfs_quota: Warning: `431' in quota blocks is 0 (unlimited).


Looks good to me.

-Eric

> ---
>  xfsprogs/po/pl.po     |    5 +++++
>  xfsprogs/quota/edit.c |    2 ++
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/xfsprogs/po/pl.po b/xfsprogs/po/pl.po
> index b4e1d76..d13184b 100644
> --- a/xfsprogs/po/pl.po
> +++ b/xfsprogs/po/pl.po
> @@ -3670,6 +3670,11 @@ msgstr "%s: nieprawid
>  msgid "%s: invalid project name: %s\n"
>  msgstr "%s: nieprawid³owa nazwa projektu: %s\n"
>  
> +#: ../quota/edit.c:237
> +#, c-format
> +msgid "%s: Warning: `%s' in quota blocks is 0 (unlimited).\n"
> +msgstr "%s: Uwaga: `%s' w blokach quoty oznacza 0 (nieograniczone).\n"
> +
>  #: ../quota/edit.c:318
>  #, c-format
>  msgid "%s: unrecognised argument %s\n"
> diff --git a/xfsprogs/quota/edit.c b/xfsprogs/quota/edit.c
> index 15c72c4..ce7f7e9 100644
> --- a/xfsprogs/quota/edit.c
> +++ b/xfsprogs/quota/edit.c
> @@ -233,6 +233,8 @@ extractb(
>  		s = string + length + 1;
>  		v = (__uint64_t)cvtnum(blocksize, sectorsize, s);
>  		*value = v >> 9;	/* syscalls use basic blocks */
> +		if (v > 0 && *value == 0)
> +			fprintf(stderr, _("%s: Warning: `%s' in quota blocks is 0 (unlimited).\n"), progname, s);
>  		return 1;
>  	}
>  	return 0;
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-16  1:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 23:27 [PATCH] xfs_quota: Warn if specified non-zero quota will be round down to zero Arkadiusz Miskiewicz
2008-12-16  1:27 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox