mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
nodeinfo: move host CPU APIs out into virhostcpu.c file
Move all APIs with a virHostCPU name prefix out into new util/virhostcpu.h & util/virhostcpu.c files Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
4053350bfe
commit
eaf18f4c2b
6
cfg.mk
6
cfg.mk
@ -1190,7 +1190,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
|
||||
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir.+mock\.c)$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff|tests/virconfdata/no-newline\.conf$$)
|
||||
(^tests/(qemuhelp|virhostcpu|virpcitest)data/|\.diff|tests/virconfdata/no-newline\.conf$$)
|
||||
|
||||
_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon)
|
||||
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
|
||||
@ -1240,7 +1240,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
|
||||
^(examples/|tools/virsh-edit\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
/qemuhelpdata/|/sysinfodata/.*\.data|/nodeinfodata/.*\.cpuinfo$$
|
||||
/qemuhelpdata/|/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo$$
|
||||
|
||||
exclude_file_name_regexp--sc_unmarked_diagnostics = \
|
||||
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
|
||||
@ -1271,7 +1271,7 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
|
||||
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_first_line = \
|
||||
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/(vmwarever|nodeinfo)data/.*)$$
|
||||
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/(vmwarever|virhostcpu)data/.*)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_useless_translation = \
|
||||
^tests/virpolkittest.c
|
||||
|
@ -196,6 +196,7 @@ src/util/virfile.c
|
||||
src/util/virfirewall.c
|
||||
src/util/virhash.c
|
||||
src/util/virhook.c
|
||||
src/util/virhostcpu.c
|
||||
src/util/virhostdev.c
|
||||
src/util/viridentity.c
|
||||
src/util/virinitctl.c
|
||||
|
@ -119,6 +119,7 @@ UTIL_SOURCES = \
|
||||
util/virhash.c util/virhash.h \
|
||||
util/virhashcode.c util/virhashcode.h \
|
||||
util/virhook.c util/virhook.h \
|
||||
util/virhostcpu.c util/virhostcpu.h util/virhostcpupriv.h \
|
||||
util/virhostdev.c util/virhostdev.h \
|
||||
util/viridentity.c util/viridentity.h \
|
||||
util/virinitctl.c util/virinitctl.h \
|
||||
@ -192,7 +193,7 @@ util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
|
||||
<$(srcdir)/util/keymaps.csv >util/virkeymaps.h
|
||||
|
||||
# Internal generic driver infrastructure
|
||||
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c nodeinfopriv.h
|
||||
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c
|
||||
DATATYPES_SOURCES = datatypes.h datatypes.c
|
||||
DRIVER_SOURCES = \
|
||||
driver.c driver.h \
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Linux-specific private symbols.
|
||||
#
|
||||
|
||||
# nodeinfo.h
|
||||
# util/virhostcpu.h
|
||||
virHostCPUGetInfoPopulateLinux;
|
||||
virHostCPUGetStatsLinux;
|
||||
virHostCPUSetSysFSSystemPathLinux;
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "virfile.h"
|
||||
#include "virpidfile.h"
|
||||
#include "vircommand.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "virrandom.h"
|
||||
#include "virprocess.h"
|
||||
#include "virnuma.h"
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "virnetdevveth.h"
|
||||
#include "virnetdevopenvswitch.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "viruuid.h"
|
||||
#include "virstats.h"
|
||||
#include "virhook.h"
|
||||
|
1171
src/nodeinfo.c
1171
src/nodeinfo.c
File diff suppressed because it is too large
Load Diff
@ -29,10 +29,6 @@
|
||||
int nodeGetInfo(virNodeInfoPtr nodeinfo);
|
||||
int nodeCapsInitNUMA(virCapsPtr caps);
|
||||
|
||||
int virHostCPUGetStats(int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
int virHostMemGetStats(int cellNum,
|
||||
virNodeMemoryStatsPtr params,
|
||||
int *nparams,
|
||||
@ -43,11 +39,6 @@ int virHostMemGetCellsFree(unsigned long long *freeMems,
|
||||
int virHostMemGetInfo(unsigned long long *mem,
|
||||
unsigned long long *freeMem);
|
||||
|
||||
virBitmapPtr virHostCPUGetPresentBitmap(void);
|
||||
virBitmapPtr virHostCPUGetOnlineBitmap(void);
|
||||
int virHostCPUGetCount(void);
|
||||
int virHostCPUGetThreadsPerSubcore(virArch arch);
|
||||
|
||||
int virHostMemGetParameters(virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
@ -56,10 +47,6 @@ int virHostMemSetParameters(virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
int virHostCPUGetMap(unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags);
|
||||
|
||||
int virHostMemGetFreePages(unsigned int npages,
|
||||
unsigned int *pages,
|
||||
int startCell,
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "virbuffer.h"
|
||||
#include "openvz_conf.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "viralloc.h"
|
||||
#include "virfile.h"
|
||||
#include "virtypedparam.h"
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "datatypes.h"
|
||||
#include "virbuffer.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "virstats.h"
|
||||
#include "capabilities.h"
|
||||
#include "viralloc.h"
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "virhook.h"
|
||||
#include "virfile.h"
|
||||
#include "virpidfile.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "domain_audit.h"
|
||||
#include "domain_nwfilter.h"
|
||||
#include "locking/domain_lock.h"
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "uml_conf.h"
|
||||
#include "virbuffer.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "virstats.h"
|
||||
#include "capabilities.h"
|
||||
#include "viralloc.h"
|
||||
|
@ -59,8 +59,7 @@
|
||||
#include "virstring.h"
|
||||
#include "virsystemd.h"
|
||||
#include "virtypedparam.h"
|
||||
|
||||
#include "nodeinfo.h"
|
||||
#include "virhostcpu.h"
|
||||
|
||||
VIR_LOG_INIT("util.cgroup");
|
||||
|
||||
|
1299
src/util/virhostcpu.c
Normal file
1299
src/util/virhostcpu.c
Normal file
File diff suppressed because it is too large
Load Diff
54
src/util/virhostcpu.h
Normal file
54
src/util/virhostcpu.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* virhostcpu.h: helper APIs for host CPU info
|
||||
*
|
||||
* Copyright (C) 2006-2016 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __VIR_HOSTCPU_H__
|
||||
# define __VIR_HOSTCPU_H__
|
||||
|
||||
# include "internal.h"
|
||||
# include "virarch.h"
|
||||
# include "virbitmap.h"
|
||||
|
||||
# define VIR_HOST_CPU_MASK_LEN 1024
|
||||
|
||||
int virHostCPUGetStats(int cpuNum,
|
||||
virNodeCPUStatsPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
|
||||
virBitmapPtr virHostCPUGetPresentBitmap(void);
|
||||
virBitmapPtr virHostCPUGetOnlineBitmap(void);
|
||||
int virHostCPUGetCount(void);
|
||||
int virHostCPUGetThreadsPerSubcore(virArch arch);
|
||||
|
||||
int virHostCPUGetMap(unsigned char **cpumap,
|
||||
unsigned int *online,
|
||||
unsigned int flags);
|
||||
int virHostCPUGetInfo(virArch hostarch,
|
||||
unsigned int *cpus,
|
||||
unsigned int *mhz,
|
||||
unsigned int *nodes,
|
||||
unsigned int *sockets,
|
||||
unsigned int *cores,
|
||||
unsigned int *threads);
|
||||
|
||||
#endif /* __VIR_HOSTCPU_H__*/
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* nodeinfopriv.h: internal APIs for testing nodeinfo code
|
||||
* virhostcpupriv.h: helper APIs for host CPU info
|
||||
*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
* Copyright (C) 2014-2016 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -19,10 +19,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NODEINFO_PRIV_H__
|
||||
# define __NODEINFO_PRIV_H__
|
||||
#ifndef __VIR_HOSTCPU_PRIV_H__
|
||||
# define __VIR_HOSTCPU_PRIV_H__
|
||||
|
||||
# include "nodeinfo.h"
|
||||
# include "virhostcpu.h"
|
||||
|
||||
# ifdef __linux__
|
||||
void virHostCPUSetSysFSSystemPathLinux(const char *path);
|
||||
@ -42,4 +42,4 @@ int virHostCPUGetStatsLinux(FILE *procstat,
|
||||
int *nparams);
|
||||
# endif
|
||||
|
||||
#endif /* __NODEINFO_PRIV_H__ */
|
||||
#endif /* __VIR_HOSTCPU_PRIV_H__ */
|
@ -109,7 +109,7 @@ EXTRA_DIST = \
|
||||
networkxml2xmlupdatein \
|
||||
networkxml2xmlupdateout \
|
||||
nodedevschemadata \
|
||||
nodeinfodata \
|
||||
virhostcpudata \
|
||||
nssdata \
|
||||
nwfilterxml2firewalldata \
|
||||
nwfilterxml2xmlin \
|
||||
@ -159,7 +159,7 @@ EXTRA_DIST = \
|
||||
|
||||
test_helpers = commandhelper ssh virconftest
|
||||
test_programs = virshtest sockettest \
|
||||
nodeinfotest virbuftest \
|
||||
virhostcputest virbuftest \
|
||||
commandtest seclabeltest \
|
||||
virhashtest \
|
||||
viratomictest \
|
||||
@ -404,7 +404,7 @@ test_libraries = libshunload.la \
|
||||
virpcimock.la \
|
||||
virnetdevmock.la \
|
||||
virrandommock.la \
|
||||
nodeinfomock.la \
|
||||
virhostcpumock.la \
|
||||
nssmock.la \
|
||||
$(NULL)
|
||||
if WITH_QEMU
|
||||
@ -880,9 +880,9 @@ virconftest_SOURCES = \
|
||||
virconftest.c
|
||||
virconftest_LDADD = $(LDADDS)
|
||||
|
||||
nodeinfotest_SOURCES = \
|
||||
nodeinfotest.c testutils.h testutils.c
|
||||
nodeinfotest_LDADD = $(LDADDS)
|
||||
virhostcputest_SOURCES = \
|
||||
virhostcputest.c testutils.h testutils.c
|
||||
virhostcputest_LDADD = $(LDADDS)
|
||||
|
||||
commandtest_SOURCES = \
|
||||
commandtest.c testutils.h testutils.c
|
||||
@ -1093,11 +1093,11 @@ virrandommock_la_CFLAGS = $(AM_CFLAGS)
|
||||
virrandommock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
|
||||
virrandommock_la_LIBADD = $(MOCKLIBS_LIBS)
|
||||
|
||||
nodeinfomock_la_SOURCES = \
|
||||
nodeinfomock.c
|
||||
nodeinfomock_la_CFLAGS = $(AM_CFLAGS)
|
||||
nodeinfomock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
|
||||
nodeinfomock_la_LIBADD = $(MOCKLIBS_LIBS)
|
||||
virhostcpumock_la_SOURCES = \
|
||||
virhostcpumock.c
|
||||
virhostcpumock_la_CFLAGS = $(AM_CFLAGS)
|
||||
virhostcpumock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
|
||||
virhostcpumock_la_LIBADD = $(MOCKLIBS_LIBS)
|
||||
|
||||
nsstest_SOURCES = \
|
||||
nsstest.c testutils.h testutils.c
|
||||
|
@ -34,7 +34,7 @@
|
||||
# include "virfile.h"
|
||||
# include "virbuffer.h"
|
||||
# include "testutilslxc.h"
|
||||
# include "nodeinfo.h"
|
||||
# include "virhostcpu.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user