2014-02-05 18:18:46 +04: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 16:54:53 +04:00
# include "internal.h"
2016-03-23 18:19:26 +03:00
# include "vircommand.h"
2015-02-02 13:26:49 +03:00
# include "virmock.h"
2016-03-23 18:19:26 +03:00
# include "virnetdev.h"
# include "virnetdevtap.h"
# include "virnuma.h"
# include "virscsi.h"
2015-11-18 03:44:13 +03:00
# include "virstring.h"
# include "virtpm.h"
2016-03-23 18:19:26 +03:00
# include "virutil.h"
2014-02-06 16:54:53 +04:00
# include <time.h>
2015-02-02 13:26:49 +03:00
# include <unistd.h>
2015-11-18 03:44:13 +03:00
# define VIR_FROM_THIS VIR_FROM_NONE
2015-02-02 13:26:49 +03:00
long virGetSystemPageSize ( void )
{
return 4096 ;
}
2014-02-05 18:18:46 +04:00
time_t time ( time_t * t )
{
const time_t ret = 1234567890 ;
if ( t )
* t = ret ;
return ret ;
}
2014-11-04 05:44:40 +03:00
int
virNumaGetMaxNode ( void )
{
const int maxnodesNum = 7 ;
return maxnodesNum ;
}
2014-11-06 14:16:54 +03: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 03:44:13 +03: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 16:36:51 +03: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 ;
}
2016-03-23 11:57:06 +03:00
char *
virSCSIDeviceGetSgName ( const char * sysfs_prefix ATTRIBUTE_UNUSED ,
const char * adapter ATTRIBUTE_UNUSED ,
unsigned int bus ATTRIBUTE_UNUSED ,
unsigned int target ATTRIBUTE_UNUSED ,
unsigned long long unit ATTRIBUTE_UNUSED )
{
char * ret ;
ignore_value ( VIR_STRDUP ( ret , " sg0 " ) ) ;
return ret ;
}
2016-03-23 18:19:26 +03:00
int
virNetDevTapCreate ( char * * ifname ,
const char * tunpath ATTRIBUTE_UNUSED ,
int * tapfd ,
size_t tapfdSize ,
unsigned int flags ATTRIBUTE_UNUSED )
{
size_t i ;
for ( i = 0 ; i < tapfdSize ; i + + )
tapfd [ i ] = STDERR_FILENO + 1 + i ;
return VIR_STRDUP ( * ifname , " vnet0 " ) ;
}
int
virNetDevSetMAC ( const char * ifname ATTRIBUTE_UNUSED ,
const virMacAddr * macaddr ATTRIBUTE_UNUSED )
{
return 0 ;
}
2016-04-05 00:00:06 +03:00
int
virNetDevSetOnline ( const char * ifname ATTRIBUTE_UNUSED ,
bool online ATTRIBUTE_UNUSED )
{
return 0 ;
}
2016-03-23 18:19:26 +03:00
int
2016-04-13 11:36:00 +03:00
virNetDevRunEthernetScript ( const char * ifname ATTRIBUTE_UNUSED ,
const char * script ATTRIBUTE_UNUSED )
2016-03-23 18:19:26 +03:00
{
return 0 ;
}
void
virCommandPassFD ( virCommandPtr cmd ATTRIBUTE_UNUSED ,
int fd ATTRIBUTE_UNUSED ,
unsigned int flags ATTRIBUTE_UNUSED )
{
/* nada */
}