mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@suse.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
63b52584a3
commit
ee507ce9a1
1 file changed
+4
@@ -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;
|
||||
|
||||