You need to sign in or sign up before continuing.
提交 e07314f4 编写于 作者: J Jiri Denemark

Deal with CPU models in []

Qemu committed a patch which list some CPU names in [] when asked for
supported CPUs (qemu -cpu ?). Yet, it needs such CPUs to be passed
without those square braces. When probing for supported CPU models, we
can just strip the square braces and pretend we have never seen them.
上级 9fbb810c
...@@ -629,6 +629,8 @@ typedef int ...@@ -629,6 +629,8 @@ typedef int
/* Format: /* Format:
* <arch> <model> * <arch> <model>
* qemu-0.13 encloses some model names in []:
* <arch> [<model>]
*/ */
static int static int
qemudParseX86Models(const char *output, qemudParseX86Models(const char *output,
...@@ -661,15 +663,22 @@ qemudParseX86Models(const char *output, ...@@ -661,15 +663,22 @@ qemudParseX86Models(const char *output,
continue; continue;
if (retcpus) { if (retcpus) {
unsigned int len;
if (VIR_REALLOC_N(cpus, count + 1) < 0) if (VIR_REALLOC_N(cpus, count + 1) < 0)
goto error; goto error;
if (next) if (next)
cpus[count] = strndup(p, next - p - 1); len = next - p - 1;
else else
cpus[count] = strdup(p); len = strlen(p);
if (len > 2 && *p == '[' && p[len - 1] == ']') {
p++;
len -= 2;
}
if (!cpus[count]) if (!(cpus[count] = strndup(p, len)))
goto error; goto error;
} }
count++; count++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册