mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-29 20:11:16 +00:00
Use K&R style for curly braces in src/util/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
6e28dee258
commit
daedff47ae
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virconf.c: parser for a subset of the Python encoded Xen configuration files
|
* virconf.c: parser for a subset of the Python encoded Xen configuration files
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -708,7 +708,8 @@ virConfParseStatement(virConfParserCtxtPtr ctxt)
|
|||||||
*/
|
*/
|
||||||
static virConfPtr
|
static virConfPtr
|
||||||
virConfParse(const char *filename, const char *content, int len,
|
virConfParse(const char *filename, const char *content, int len,
|
||||||
unsigned int flags) {
|
unsigned int flags)
|
||||||
|
{
|
||||||
virConfParserCtxt ctxt;
|
virConfParserCtxt ctxt;
|
||||||
|
|
||||||
ctxt.filename = filename;
|
ctxt.filename = filename;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virdbus.c: helper for using DBus
|
* virdbus.c: helper for using DBus
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2013 Red Hat, Inc.
|
* Copyright (C) 2012-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -217,7 +217,8 @@ static int virDBusTranslateWatchFlags(int dbus_flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void virDBusWatchFree(void *data) {
|
static void virDBusWatchFree(void *data)
|
||||||
|
{
|
||||||
struct virDBusWatch *info = data;
|
struct virDBusWatch *info = data;
|
||||||
VIR_FREE(info);
|
VIR_FREE(info);
|
||||||
}
|
}
|
||||||
@ -296,7 +297,8 @@ static const char virDBusBasicTypes[] = {
|
|||||||
DBUS_TYPE_SIGNATURE,
|
DBUS_TYPE_SIGNATURE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool virDBusIsBasicType(char c) {
|
static bool virDBusIsBasicType(char c)
|
||||||
|
{
|
||||||
return !!memchr(virDBusBasicTypes, c, ARRAY_CARDINALITY(virDBusBasicTypes));
|
return !!memchr(virDBusBasicTypes, c, ARRAY_CARDINALITY(virDBusBasicTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@ virErrorFunc virErrorHandler = NULL; /* global error handler */
|
|||||||
void *virUserData = NULL; /* associated data */
|
void *virUserData = NULL; /* associated data */
|
||||||
virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
|
virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
|
||||||
|
|
||||||
static virLogPriority virErrorLevelPriority(virErrorLevel level) {
|
static virLogPriority virErrorLevelPriority(virErrorLevel level)
|
||||||
|
{
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case VIR_ERR_NONE:
|
case VIR_ERR_NONE:
|
||||||
return VIR_LOG_INFO;
|
return VIR_LOG_INFO;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* vireventpoll.c: Poll based event loop for monitoring file handles
|
* vireventpoll.c: Poll based event loop for monitoring file handles
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2010-2013 Red Hat, Inc.
|
* Copyright (C) 2007, 2010-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2007 Daniel P. Berrange
|
* Copyright (C) 2007 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -106,7 +106,8 @@ static int nextTimer = 1;
|
|||||||
int virEventPollAddHandle(int fd, int events,
|
int virEventPollAddHandle(int fd, int events,
|
||||||
virEventHandleCallback cb,
|
virEventHandleCallback cb,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
virFreeCallback ff) {
|
virFreeCallback ff)
|
||||||
|
{
|
||||||
int watch;
|
int watch;
|
||||||
virMutexLock(&eventLoop.lock);
|
virMutexLock(&eventLoop.lock);
|
||||||
if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
|
if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
|
||||||
@ -142,7 +143,8 @@ int virEventPollAddHandle(int fd, int events,
|
|||||||
return watch;
|
return watch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void virEventPollUpdateHandle(int watch, int events) {
|
void virEventPollUpdateHandle(int watch, int events)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
PROBE(EVENT_POLL_UPDATE_HANDLE,
|
PROBE(EVENT_POLL_UPDATE_HANDLE,
|
||||||
@ -176,7 +178,8 @@ void virEventPollUpdateHandle(int watch, int events) {
|
|||||||
* For this reason we only ever set a flag in the existing list.
|
* For this reason we only ever set a flag in the existing list.
|
||||||
* Actual deletion will be done out-of-band
|
* Actual deletion will be done out-of-band
|
||||||
*/
|
*/
|
||||||
int virEventPollRemoveHandle(int watch) {
|
int virEventPollRemoveHandle(int watch)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
PROBE(EVENT_POLL_REMOVE_HANDLE,
|
PROBE(EVENT_POLL_REMOVE_HANDLE,
|
||||||
"watch=%d",
|
"watch=%d",
|
||||||
@ -296,7 +299,8 @@ void virEventPollUpdateTimeout(int timer, int frequency)
|
|||||||
* For this reason we only ever set a flag in the existing list.
|
* For this reason we only ever set a flag in the existing list.
|
||||||
* Actual deletion will be done out-of-band
|
* Actual deletion will be done out-of-band
|
||||||
*/
|
*/
|
||||||
int virEventPollRemoveTimeout(int timer) {
|
int virEventPollRemoveTimeout(int timer)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
PROBE(EVENT_POLL_REMOVE_TIMEOUT,
|
PROBE(EVENT_POLL_REMOVE_TIMEOUT,
|
||||||
"timer=%d",
|
"timer=%d",
|
||||||
@ -329,7 +333,8 @@ int virEventPollRemoveTimeout(int timer) {
|
|||||||
* no timeout is pending
|
* no timeout is pending
|
||||||
* returns: 0 on success, -1 on error
|
* returns: 0 on success, -1 on error
|
||||||
*/
|
*/
|
||||||
static int virEventPollCalculateTimeout(int *timeout) {
|
static int virEventPollCalculateTimeout(int *timeout)
|
||||||
|
{
|
||||||
unsigned long long then = 0;
|
unsigned long long then = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
|
EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
|
||||||
@ -469,7 +474,8 @@ static int virEventPollDispatchTimeouts(void)
|
|||||||
*
|
*
|
||||||
* Returns 0 upon success, -1 if an error occurred
|
* Returns 0 upon success, -1 if an error occurred
|
||||||
*/
|
*/
|
||||||
static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
|
static int virEventPollDispatchHandles(int nfds, struct pollfd *fds)
|
||||||
|
{
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
VIR_DEBUG("Dispatch %d", nfds);
|
VIR_DEBUG("Dispatch %d", nfds);
|
||||||
|
|
||||||
@ -514,7 +520,8 @@ static int virEventPollDispatchHandles(int nfds, struct pollfd *fds) {
|
|||||||
* were previously marked as deleted. This asynchronous
|
* were previously marked as deleted. This asynchronous
|
||||||
* cleanup is needed to make dispatch re-entrant safe.
|
* cleanup is needed to make dispatch re-entrant safe.
|
||||||
*/
|
*/
|
||||||
static void virEventPollCleanupTimeouts(void) {
|
static void virEventPollCleanupTimeouts(void)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t gap;
|
size_t gap;
|
||||||
VIR_DEBUG("Cleanup %zu", eventLoop.timeoutsCount);
|
VIR_DEBUG("Cleanup %zu", eventLoop.timeoutsCount);
|
||||||
@ -562,7 +569,8 @@ static void virEventPollCleanupTimeouts(void) {
|
|||||||
* were previously marked as deleted. This asynchronous
|
* were previously marked as deleted. This asynchronous
|
||||||
* cleanup is needed to make dispatch re-entrant safe.
|
* cleanup is needed to make dispatch re-entrant safe.
|
||||||
*/
|
*/
|
||||||
static void virEventPollCleanupHandles(void) {
|
static void virEventPollCleanupHandles(void)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t gap;
|
size_t gap;
|
||||||
VIR_DEBUG("Cleanup %zu", eventLoop.handlesCount);
|
VIR_DEBUG("Cleanup %zu", eventLoop.handlesCount);
|
||||||
@ -610,7 +618,8 @@ static void virEventPollCleanupHandles(void) {
|
|||||||
* Run a single iteration of the event loop, blocking until
|
* Run a single iteration of the event loop, blocking until
|
||||||
* at least one file handle has an event, or a timer expires
|
* at least one file handle has an event, or a timer expires
|
||||||
*/
|
*/
|
||||||
int virEventPollRunOnce(void) {
|
int virEventPollRunOnce(void)
|
||||||
|
{
|
||||||
struct pollfd *fds = NULL;
|
struct pollfd *fds = NULL;
|
||||||
int ret, timeout, nfds;
|
int ret, timeout, nfds;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virhook.c: implementation of the synchronous hooks support
|
* virhook.c: implementation of the synchronous hooks support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2013 Red Hat, Inc.
|
* Copyright (C) 2010-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2010 Daniel Veillard
|
* Copyright (C) 2010 Daniel Veillard
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -107,7 +107,8 @@ static int virHooksFound = -1;
|
|||||||
* Returns 1 if found, 0 if not found, and -1 in case of error
|
* Returns 1 if found, 0 if not found, and -1 in case of error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virHookCheck(int no, const char *driver) {
|
virHookCheck(int no, const char *driver)
|
||||||
|
{
|
||||||
char *path;
|
char *path;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -149,7 +150,8 @@ virHookCheck(int no, const char *driver) {
|
|||||||
* Returns the number of hooks found or -1 in case of failure
|
* Returns the number of hooks found or -1 in case of failure
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virHookInitialize(void) {
|
virHookInitialize(void)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int res, ret = 0;
|
int res, ret = 0;
|
||||||
|
|
||||||
@ -177,7 +179,8 @@ virHookInitialize(void) {
|
|||||||
* Returns 1 if present, 0 otherwise
|
* Returns 1 if present, 0 otherwise
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virHookPresent(int driver) {
|
virHookPresent(int driver)
|
||||||
|
{
|
||||||
if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
|
if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
|
||||||
(driver >= VIR_HOOK_DRIVER_LAST))
|
(driver >= VIR_HOOK_DRIVER_LAST))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2013 Red Hat, Inc.
|
* Copyright (C) 2009-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -449,7 +449,8 @@ static struct nla_policy ifla_port_policy[IFLA_PORT_MAX + 1] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
virNetDevVPortProfileGetLldpadPid(void) {
|
virNetDevVPortProfileGetLldpadPid(void)
|
||||||
|
{
|
||||||
int fd;
|
int fd;
|
||||||
uint32_t pid = 0;
|
uint32_t pid = 0;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2013 Red Hat, Inc.
|
* Copyright (C) 2012-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -165,7 +165,8 @@ uint32_t virRandomInt(uint32_t max)
|
|||||||
|
|
||||||
int
|
int
|
||||||
virRandomGenerateWWN(char **wwn,
|
virRandomGenerateWWN(char **wwn,
|
||||||
const char *virt_type) {
|
const char *virt_type)
|
||||||
|
{
|
||||||
const char *oui = NULL;
|
const char *oui = NULL;
|
||||||
|
|
||||||
if (!virt_type) {
|
if (!virt_type) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2013 Red Hat, Inc.
|
* Copyright (C) 2009-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -116,7 +116,8 @@ virSocketAddrParseInternal(struct addrinfo **res,
|
|||||||
*
|
*
|
||||||
* Returns the length of the network address or -1 in case of error.
|
* Returns the length of the network address or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family) {
|
int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family)
|
||||||
|
{
|
||||||
int len;
|
int len;
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
|
|
||||||
@ -150,7 +151,8 @@ int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family) {
|
|||||||
* Returns the length of the network address or -1 in case of error.
|
* Returns the length of the network address or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val) {
|
virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val)
|
||||||
|
{
|
||||||
return virSocketAddrParse(addr, val, AF_INET);
|
return virSocketAddrParse(addr, val, AF_INET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +166,8 @@ virSocketAddrParseIPv4(virSocketAddrPtr addr, const char *val) {
|
|||||||
* Returns the length of the network address or -1 in case of error.
|
* Returns the length of the network address or -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virSocketAddrParseIPv6(virSocketAddrPtr addr, const char *val) {
|
virSocketAddrParseIPv6(virSocketAddrPtr addr, const char *val)
|
||||||
|
{
|
||||||
return virSocketAddrParse(addr, val, AF_INET6);
|
return virSocketAddrParse(addr, val, AF_INET6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +358,8 @@ error:
|
|||||||
* Returns 0 on success, -1 on failure
|
* Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
|
virSocketAddrSetPort(virSocketAddrPtr addr, int port)
|
||||||
|
{
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -380,7 +384,8 @@ virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
|
|||||||
* Returns -1 if @addr is invalid
|
* Returns -1 if @addr is invalid
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virSocketAddrGetPort(virSocketAddrPtr addr) {
|
virSocketAddrGetPort(virSocketAddrPtr addr)
|
||||||
|
{
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -401,7 +406,8 @@ virSocketAddrGetPort(virSocketAddrPtr addr) {
|
|||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
*/
|
*/
|
||||||
int virSocketAddrIsNetmask(virSocketAddrPtr netmask) {
|
int virSocketAddrIsNetmask(virSocketAddrPtr netmask)
|
||||||
|
{
|
||||||
int n = virSocketAddrGetNumNetmaskBits(netmask);
|
int n = virSocketAddrGetNumNetmaskBits(netmask);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -550,7 +556,8 @@ virSocketAddrBroadcastByPrefix(const virSocketAddr *addr,
|
|||||||
* -1 in case of error
|
* -1 in case of error
|
||||||
*/
|
*/
|
||||||
int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
|
int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
|
||||||
virSocketAddrPtr netmask) {
|
virSocketAddrPtr netmask)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if ((addr1 == NULL) || (addr2 == NULL) || (netmask == NULL))
|
if ((addr1 == NULL) || (addr2 == NULL) || (netmask == NULL))
|
||||||
@ -606,7 +613,8 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
|
|||||||
*
|
*
|
||||||
* Returns the size of the range or -1 in case of failure
|
* Returns the size of the range or -1 in case of failure
|
||||||
*/
|
*/
|
||||||
int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end) {
|
int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end)
|
||||||
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -215,7 +215,8 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
|
|||||||
/* virSysinfoRead for PowerPC
|
/* virSysinfoRead for PowerPC
|
||||||
* Gathers sysinfo data from /proc/cpuinfo */
|
* Gathers sysinfo data from /proc/cpuinfo */
|
||||||
virSysinfoDefPtr
|
virSysinfoDefPtr
|
||||||
virSysinfoRead(void) {
|
virSysinfoRead(void)
|
||||||
|
{
|
||||||
virSysinfoDefPtr ret = NULL;
|
virSysinfoDefPtr ret = NULL;
|
||||||
char *outbuf = NULL;
|
char *outbuf = NULL;
|
||||||
|
|
||||||
@ -332,7 +333,8 @@ error:
|
|||||||
/* virSysinfoRead for ARMv7
|
/* virSysinfoRead for ARMv7
|
||||||
* Gathers sysinfo data from /proc/cpuinfo */
|
* Gathers sysinfo data from /proc/cpuinfo */
|
||||||
virSysinfoDefPtr
|
virSysinfoDefPtr
|
||||||
virSysinfoRead(void) {
|
virSysinfoRead(void)
|
||||||
|
{
|
||||||
virSysinfoDefPtr ret = NULL;
|
virSysinfoDefPtr ret = NULL;
|
||||||
char *outbuf = NULL;
|
char *outbuf = NULL;
|
||||||
|
|
||||||
@ -459,7 +461,8 @@ cleanup:
|
|||||||
/* virSysinfoRead for s390x
|
/* virSysinfoRead for s390x
|
||||||
* Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */
|
* Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */
|
||||||
virSysinfoDefPtr
|
virSysinfoDefPtr
|
||||||
virSysinfoRead(void) {
|
virSysinfoRead(void)
|
||||||
|
{
|
||||||
virSysinfoDefPtr ret = NULL;
|
virSysinfoDefPtr ret = NULL;
|
||||||
char *outbuf = NULL;
|
char *outbuf = NULL;
|
||||||
|
|
||||||
@ -507,7 +510,8 @@ no_memory:
|
|||||||
defined(__aarch64__) || \
|
defined(__aarch64__) || \
|
||||||
defined(__powerpc__))
|
defined(__powerpc__))
|
||||||
virSysinfoDefPtr
|
virSysinfoDefPtr
|
||||||
virSysinfoRead(void) {
|
virSysinfoRead(void)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* this can probably be extracted from Windows using API or registry
|
* this can probably be extracted from Windows using API or registry
|
||||||
* http://www.microsoft.com/whdc/system/platform/firmware/SMBIOS.mspx
|
* http://www.microsoft.com/whdc/system/platform/firmware/SMBIOS.mspx
|
||||||
@ -818,7 +822,8 @@ virSysinfoParseMemory(const char *base, virSysinfoDefPtr ret)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virSysinfoDefPtr
|
virSysinfoDefPtr
|
||||||
virSysinfoRead(void) {
|
virSysinfoRead(void)
|
||||||
|
{
|
||||||
char *path;
|
char *path;
|
||||||
virSysinfoDefPtr ret = NULL;
|
virSysinfoDefPtr ret = NULL;
|
||||||
char *outbuf = NULL;
|
char *outbuf = NULL;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virthread.c: basic thread synchronization primitives
|
* virthread.c: basic thread synchronization primitives
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2010 Red Hat, Inc.
|
* Copyright (C) 2009-2010, 2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -83,7 +83,8 @@ void virMutexDestroy(virMutexPtr m)
|
|||||||
pthread_mutex_destroy(&m->lock);
|
pthread_mutex_destroy(&m->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void virMutexLock(virMutexPtr m){
|
void virMutexLock(virMutexPtr m)
|
||||||
|
{
|
||||||
pthread_mutex_lock(&m->lock);
|
pthread_mutex_lock(&m->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virutil.c: common, generic utility functions
|
* virutil.c: common, generic utility functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 Daniel P. Berrange
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
* Copyright (C) 2006, 2007 Binary Karma
|
* Copyright (C) 2006, 2007 Binary Karma
|
||||||
* Copyright (C) 2006 Shuveb Hussain
|
* Copyright (C) 2006 Shuveb Hussain
|
||||||
@ -94,7 +94,8 @@ VIR_LOG_INIT("util.util");
|
|||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
int virSetInherit(int fd, bool inherit) {
|
int virSetInherit(int fd, bool inherit)
|
||||||
|
{
|
||||||
int fflags;
|
int fflags;
|
||||||
if ((fflags = fcntl(fd, F_GETFD)) < 0)
|
if ((fflags = fcntl(fd, F_GETFD)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -120,11 +121,13 @@ int virSetInherit(int fd ATTRIBUTE_UNUSED, bool inherit ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
int virSetBlocking(int fd, bool blocking) {
|
int virSetBlocking(int fd, bool blocking)
|
||||||
|
{
|
||||||
return set_nonblocking_flag(fd, !blocking);
|
return set_nonblocking_flag(fd, !blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
int virSetNonBlock(int fd) {
|
int virSetNonBlock(int fd)
|
||||||
|
{
|
||||||
return virSetBlocking(fd, false);
|
return virSetBlocking(fd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,7 +505,8 @@ const char *virEnumToString(const char *const*types,
|
|||||||
* @param name The name of the device
|
* @param name The name of the device
|
||||||
* @return name's index, or -1 on failure
|
* @return name's index, or -1 on failure
|
||||||
*/
|
*/
|
||||||
int virDiskNameToIndex(const char *name) {
|
int virDiskNameToIndex(const char *name)
|
||||||
|
{
|
||||||
const char *ptr = NULL;
|
const char *ptr = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
static char const* const drive_prefix[] = {"fd", "hd", "vd", "sd", "xvd", "ubd"};
|
static char const* const drive_prefix[] = {"fd", "hd", "vd", "sd", "xvd", "ubd"};
|
||||||
@ -1465,7 +1469,8 @@ void virFileWaitForDevices(void)
|
|||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void virFileWaitForDevices(void) {}
|
void virFileWaitForDevices(void)
|
||||||
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_LIBDEVMAPPER_H
|
#if HAVE_LIBDEVMAPPER_H
|
||||||
@ -1489,7 +1494,8 @@ bool virIsDevMapperDevice(const char *dev_name ATTRIBUTE_UNUSED)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virValidateWWN(const char *wwn) {
|
virValidateWWN(const char *wwn)
|
||||||
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *p = wwn;
|
const char *p = wwn;
|
||||||
|
|
||||||
|
@ -98,19 +98,23 @@ const char *virEnumToString(const char *const*types,
|
|||||||
|
|
||||||
/* No-op workarounds for functionality missing in mingw. */
|
/* No-op workarounds for functionality missing in mingw. */
|
||||||
# ifndef HAVE_GETUID
|
# ifndef HAVE_GETUID
|
||||||
static inline int getuid(void) { return 0; }
|
static inline int getuid(void)
|
||||||
|
{ return 0; }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef HAVE_GETEUID
|
# ifndef HAVE_GETEUID
|
||||||
static inline int geteuid(void) { return 0; }
|
static inline int geteuid(void)
|
||||||
|
{ return 0; }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef HAVE_GETGID
|
# ifndef HAVE_GETGID
|
||||||
static inline int getgid(void) { return 0; }
|
static inline int getgid(void)
|
||||||
|
{ return 0; }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef HAVE_GETEGID
|
# ifndef HAVE_GETEGID
|
||||||
static inline int getegid(void) { return 0; }
|
static inline int getegid(void)
|
||||||
|
{ return 0; }
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FUNC_PTHREAD_SIGMASK_BROKEN
|
# ifdef FUNC_PTHREAD_SIGMASK_BROKEN
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* viruuid.c: helper APIs for dealing with UUIDs
|
* viruuid.c: helper APIs for dealing with UUIDs
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2013 Red Hat, Inc.
|
* Copyright (C) 2007-2014 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -149,7 +149,8 @@ virUUIDGenerate(unsigned char *uuid)
|
|||||||
* Returns 0 in case of success and -1 in case of error.
|
* Returns 0 in case of success and -1 in case of error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virUUIDParse(const char *uuidstr, unsigned char *uuid) {
|
virUUIDParse(const char *uuidstr, unsigned char *uuid)
|
||||||
|
{
|
||||||
const char *cur;
|
const char *cur;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user