2014-02-05 14:18:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 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
|
|
|
|
* 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: Michal Privoznik <mprivozn@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2014-02-06 12:54:53 +00:00
|
|
|
#include "internal.h"
|
2014-11-04 02:44:40 +00:00
|
|
|
#include "virnuma.h"
|
2015-02-02 10:26:49 +00:00
|
|
|
#include "virmock.h"
|
|
|
|
#include "virutil.h"
|
2015-11-18 00:44:13 +00:00
|
|
|
#include "virstring.h"
|
|
|
|
#include "virtpm.h"
|
2014-02-06 12:54:53 +00:00
|
|
|
#include <time.h>
|
2015-02-02 10:26:49 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2015-11-18 00:44:13 +00:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
|
2015-02-02 10:26:49 +00:00
|
|
|
long virGetSystemPageSize(void)
|
|
|
|
{
|
|
|
|
return 4096;
|
|
|
|
}
|
2014-02-05 14:18:46 +00:00
|
|
|
|
|
|
|
time_t time(time_t *t)
|
|
|
|
{
|
|
|
|
const time_t ret = 1234567890;
|
|
|
|
if (t)
|
|
|
|
*t = ret;
|
|
|
|
return ret;
|
|
|
|
}
|
2014-11-04 02:44:40 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
virNumaGetMaxNode(void)
|
|
|
|
{
|
|
|
|
const int maxnodesNum = 7;
|
|
|
|
|
|
|
|
return maxnodesNum;
|
|
|
|
}
|
2014-11-06 11:16:54 +00:00
|
|
|
|
|
|
|
#if WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET
|
|
|
|
/*
|
|
|
|
* In case libvirt is compiled with full NUMA support, we need to mock
|
|
|
|
* this function in order to fake what numa nodes are available.
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
virNumaNodeIsAvailable(int node)
|
|
|
|
{
|
|
|
|
return node >= 0 && node <= virNumaGetMaxNode();
|
|
|
|
}
|
|
|
|
#endif /* WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET */
|
2015-11-18 00:44:13 +00:00
|
|
|
|
|
|
|
char *
|
|
|
|
virTPMCreateCancelPath(const char *devpath)
|
|
|
|
{
|
|
|
|
char *path;
|
|
|
|
(void)devpath;
|
|
|
|
|
|
|
|
ignore_value(VIR_STRDUP(path, "/sys/class/misc/tpm0/device/cancel"));
|
|
|
|
|
|
|
|
return path;
|
|
|
|
}
|
2015-12-10 13:36:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Large values for memory would fail on 32 bit systems, despite having
|
|
|
|
* variables that support it.
|
|
|
|
*/
|
|
|
|
unsigned long long
|
|
|
|
virMemoryMaxValue(bool capped ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
return LLONG_MAX;
|
|
|
|
}
|