All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v3 1/3] xen: modify parse_size_and_unit() to support percentage
Date: Mon, 10 Dec 2018 12:44:20 +0100	[thread overview]
Message-ID: <20181210114422.27275-2-jgross@suse.com> (raw)
In-Reply-To: <20181210114422.27275-1-jgross@suse.com>

Modify parse_size_and_unit() to support a value followed by a '%'
character. In this case ps is required to be non-NULL to ensure the
caller can detect that case. The returned value will be the integer
value s was pointing to and *ps will point to the '%' character.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/lib.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/common/lib.c b/xen/common/lib.c
index 62330205fe..8ebec811b3 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -476,6 +476,10 @@ unsigned long long parse_size_and_unit(const char *s, const char **ps)
     case 'B': case 'b':
         s1++;
         break;
+    case '%':
+        if ( ps )
+            break;
+        /* fallthrough */
     default:
         ret <<= 10; /* default to kB */
         break;
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-12-10 11:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 11:44 [PATCH v3 0/3] xen/x86: support setting dom0_mem depending on host size Juergen Gross
2018-12-10 11:44 ` Juergen Gross [this message]
2018-12-10 14:39   ` [PATCH v3 1/3] xen: modify parse_size_and_unit() to support percentage Jan Beulich
2018-12-10 11:44 ` [PATCH v3 2/3] xen/x86: add dom0 memory sizing variants Juergen Gross
2018-12-10 14:45   ` Jan Beulich
     [not found]   ` <5C0E7BF80200007800204B94@suse.com>
2018-12-10 14:52     ` Juergen Gross
2018-12-10 11:44 ` [PATCH v3 3/3] xen: add CONFIG item for default dom0 memory size Juergen Gross
2018-12-14 15:32   ` Julien Grall
2019-01-18 13:13   ` Andrew Cooper
2019-01-18 13:19     ` Juergen Gross
2019-01-18 13:44       ` Andrew Cooper
2019-01-18 14:08         ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181210114422.27275-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.