mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
ace1ee225f
Always return LLONG_MAX even on 32 bit systems. The limitation
originates from our use of "unsigned long" in several APIs. The internal
data type is unsigned long long. Make the test suite deterministic by
removing the architecture difference.
Flaw was introduced in 645881139b
where
I've added a test that uses too large numbers.
87 lines
1.9 KiB
C
87 lines
1.9 KiB
C
/*
|
|
* 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>
|
|
|
|
#include "internal.h"
|
|
#include "virnuma.h"
|
|
#include "virmock.h"
|
|
#include "virutil.h"
|
|
#include "virstring.h"
|
|
#include "virtpm.h"
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
long virGetSystemPageSize(void)
|
|
{
|
|
return 4096;
|
|
}
|
|
|
|
time_t time(time_t *t)
|
|
{
|
|
const time_t ret = 1234567890;
|
|
if (t)
|
|
*t = ret;
|
|
return ret;
|
|
}
|
|
|
|
int
|
|
virNumaGetMaxNode(void)
|
|
{
|
|
const int maxnodesNum = 7;
|
|
|
|
return maxnodesNum;
|
|
}
|
|
|
|
#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 */
|
|
|
|
char *
|
|
virTPMCreateCancelPath(const char *devpath)
|
|
{
|
|
char *path;
|
|
(void)devpath;
|
|
|
|
ignore_value(VIR_STRDUP(path, "/sys/class/misc/tpm0/device/cancel"));
|
|
|
|
return path;
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|