numa: Move QemuOpts parsing to set_numa_nodes()

This allows us to make numa_init_func() static.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2015-02-08 16:51:20 -02:00
parent 25712ffe84
commit 7dcd1d70fe
3 changed files with 8 additions and 7 deletions

View File

@ -20,6 +20,5 @@ void set_numa_nodes(void);
void set_numa_modes(void);
void query_numa_node_mem(uint64_t node_mem[]);
extern QemuOptsList qemu_numa_opts;
int numa_init_func(QemuOpts *opts, void *opaque);
#endif

9
numa.c
View File

@ -36,6 +36,8 @@
#include "sysemu/hostmem.h"
#include "qmp-commands.h"
#include "hw/mem/pc-dimm.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
QemuOptsList qemu_numa_opts = {
.name = "numa",
@ -121,7 +123,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
}
int numa_init_func(QemuOpts *opts, void *opaque)
static int numa_init_func(QemuOpts *opts, void *opaque)
{
NumaOptions *object = NULL;
Error *err = NULL;
@ -168,6 +170,11 @@ void set_numa_nodes(void)
{
int i;
if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func,
NULL, 1) != 0) {
exit(1);
}
assert(max_numa_nodeid <= MAX_NODES);
/* No support for sparse NUMA node IDs yet: */

5
vl.c
View File

@ -4157,11 +4157,6 @@ int main(int argc, char **argv, char **envp)
default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
if (qemu_opts_foreach(qemu_find_opts("numa"), numa_init_func,
NULL, 1) != 0) {
exit(1);
}
set_numa_nodes();
if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, 1) != 0) {