[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] modify parse_size_and_unit() to support percentage



commit ee507ce9a1e8ef58e75ca3b59bc3db44313c661c
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Dec 11 09:42:20 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 11 09:42:20 2018 +0100

    modify parse_size_and_unit() to support percentage
    
    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@xxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.