Message ID | 54c1bcb40afa8a6f36ab4bec8c91523a535c911b.1633090722.git.isaikin-dmitry@yandex.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v5] tools/xl: fix autoballoon regex | expand |
On Tue, Nov 09, 2021 at 07:17:53PM +0300, Dmitry Isaykin wrote:
> Up
The patch as been committed ;-)
https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=2faeb4213d9b412836fe80e5685bfcccc51feb92
Cheers,
diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 4107d10fd4..f422f9fed5 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -80,14 +80,20 @@ static int auto_autoballoon(void) if (!info) return 1; /* default to on */ +#define SIZE_PATTERN "-?[0-9]+[bBkKmMgGtT]?" + ret = regcomp(®ex, - "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )", + "(^| )dom0_mem=((|min:|max:)(" SIZE_PATTERN "|(" SIZE_PATTERN "\\+)?[0-9]{1,2}%),?)+($| )", REG_NOSUB | REG_EXTENDED); + +#undef SIZE_PATTERN + if (ret) return 1; ret = regexec(®ex, info->commandline, 0, NULL, 0); regfree(®ex); + return ret == REG_NOMATCH; }