lib: Drop internal virXXXPtr typedefs

Historically, we declared pointer type to our types:

  typedef struct _virXXX virXXX;
  typedef virXXX *virXXXPtr;

But usefulness of such declaration is questionable, at best.
Unfortunately, we can't drop every such declaration - we have to
carry some over, because they are part of public API (e.g.
virDomainPtr). But for internal types - we can do drop them and
use what every other C project uses 'virXXX *'.

This change was generated by a very ugly shell script that
generated sed script which was then called over each file in the
repository. For the shell script refer to the cover letter:

https://listman.redhat.com/archives/libvir-list/2021-March/msg00537.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2021-03-11 08:16:13 +01:00
parent c21f066d61
commit c8238579fb
734 changed files with 29338 additions and 30231 deletions

View File

@ -105,7 +105,7 @@ of leak:
==5414== by 0x34D9021734: (below main) (in /usr/lib64/libc-2.15.so) ==5414== by 0x34D9021734: (below main) (in /usr/lib64/libc-2.15.so)
In this example, the ``virDomainDefParseXML()`` had an error In this example, the ``virDomainDefParseXML()`` had an error
path where the ``virDomainVideoDefPtr video`` pointer was not path where the ``virDomainVideoDef *video`` pointer was not
properly disposed. By simply adding a properly disposed. By simply adding a
``virDomainVideoDefFree(video);`` in the error path, the issue ``virDomainVideoDefFree(video);`` in the error path, the issue
was resolved. was resolved.

View File

@ -263,7 +263,7 @@ Implement common handling
If the new API is applicable to more than one driver, it may make sense If the new API is applicable to more than one driver, it may make sense
to provide some utility routines, or to factor some of the work into the to provide some utility routines, or to factor some of the work into the
dispatcher, to avoid reimplementing the same code in every driver. In dispatcher, to avoid reimplementing the same code in every driver. In
the example code, this involved adding a member to the virDomainDefPtr the example code, this involved adding a member to the virDomainDef
struct for mapping between the XML API addition and the in-memory struct for mapping between the XML API addition and the in-memory
representation of a domain, along with updating all clients to use the representation of a domain, along with updating all clients to use the
new member. Up to this point, there have been no changes to existing new member. Up to this point, there have been no changes to existing

View File

@ -836,7 +836,7 @@ vircommand.h:
:: ::
void virCommandAddEnvFormat(virCommandPtr cmd, const char *format, ...) void virCommandAddEnvFormat(virCommand *cmd, const char *format, ...)
G_GNUC_PRINTF(2, 3); G_GNUC_PRINTF(2, 3);
This makes it so gcc's -Wformat and -Wformat-security options can This makes it so gcc's -Wformat and -Wformat-security options can

View File

@ -83,7 +83,7 @@
</p> </p>
<pre> <pre>
virCommandPtr cmd = virCommandNew("/usr/bin/dnsmasq"); virCommand *cmd = virCommandNew("/usr/bin/dnsmasq");
</pre> </pre>
<p> <p>
@ -136,7 +136,7 @@ virCommandAddArgList(cmd, "--domain", "localdomain", NULL);
<p> <p>
This can also be done at the time of initial construction of This can also be done at the time of initial construction of
the <code>virCommandPtr</code> object: the <code>virCommand *</code> object:
</p> </p>
<pre> <pre>
@ -145,8 +145,8 @@ const char *const args[] = {
"--strict-order", "--except-interface", "--strict-order", "--except-interface",
"lo", "--domain", "localdomain", NULL "lo", "--domain", "localdomain", NULL
}; };
virCommandPtr cmd1 = virCommandNewArgs(cmd, args); virCommand *cmd1 = virCommandNewArgs(cmd, args);
virCommandPtr cmd2 = virCommandNewArgList("/usr/bin/dnsmasq", virCommand *cmd2 = virCommandNewArgList("/usr/bin/dnsmasq",
"--domain", "localdomain", NULL); "--domain", "localdomain", NULL);
</pre> </pre>
@ -537,7 +537,7 @@ if (WEXITSTATUS(status)...) {
<p> <p>
Once the command has been executed, or if execution Once the command has been executed, or if execution
has been abandoned, it is necessary to release has been abandoned, it is necessary to release
resources associated with the <code>virCommandPtr</code> resources associated with the <code>virCommand *</code>
object. This is done with: object. This is done with:
</p> </p>
@ -566,7 +566,7 @@ int runhook(const char *drvstr, const char *id,
{ {
int ret; int ret;
char *path; char *path;
virCommandPtr cmd; virCommand *cmd;
virBuildPath(&amp;path, LIBVIRT_HOOK_DIR, drvstr); virBuildPath(&amp;path, LIBVIRT_HOOK_DIR, drvstr);

View File

@ -444,21 +444,21 @@ C &lt;-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | &lt;-- S (reply)
</p> </p>
<dl> <dl>
<dt><code>virNetSASLContextPtr</code> (virnetsaslcontext.h)</dt> <dt><code>virNetSASLContext *</code> (virnetsaslcontext.h)</dt>
<dd>The virNetSASLContext APIs maintain SASL state for a network <dd>The virNetSASLContext APIs maintain SASL state for a network
service (server or client). This is primarily used on the server service (server or client). This is primarily used on the server
to provide an access control list of SASL usernames permitted as to provide an access control list of SASL usernames permitted as
clients. clients.
</dd> </dd>
<dt><code>virNetSASLSessionPtr</code> (virnetsaslcontext.h)</dt> <dt><code>virNetSASLSession *</code> (virnetsaslcontext.h)</dt>
<dd>The virNetSASLSession APIs maintain SASL state for a single <dd>The virNetSASLSession APIs maintain SASL state for a single
network connection (socket). This is used to perform the multi-step network connection (socket). This is used to perform the multi-step
SASL handshake and perform encryption/decryption of data once SASL handshake and perform encryption/decryption of data once
authenticated, via integration with virNetSocket. authenticated, via integration with virNetSocket.
</dd> </dd>
<dt><code>virNetTLSContextPtr</code> (virnettlscontext.h)</dt> <dt><code>virNetTLSContext *</code> (virnettlscontext.h)</dt>
<dd>The virNetTLSContext APIs maintain TLS state for a network <dd>The virNetTLSContext APIs maintain TLS state for a network
service (server or client). This is primarily used on the server service (server or client). This is primarily used on the server
to provide an access control list of x509 distinguished names, as to provide an access control list of x509 distinguished names, as
@ -467,29 +467,29 @@ C &lt;-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | &lt;-- S (reply)
to improve detection of configuration errors. to improve detection of configuration errors.
</dd> </dd>
<dt><code>virNetTLSSessionPtr</code> (virnettlscontext.h)</dt> <dt><code>virNetTLSSession *</code> (virnettlscontext.h)</dt>
<dd>The virNetTLSSession APIs maintain TLS state for a single <dd>The virNetTLSSession APIs maintain TLS state for a single
network connection (socket). This is used to perform the multi-step network connection (socket). This is used to perform the multi-step
TLS handshake and perform encryption/decryption of data once TLS handshake and perform encryption/decryption of data once
authenticated, via integration with virNetSocket. authenticated, via integration with virNetSocket.
</dd> </dd>
<dt><code>virNetSocketPtr</code> (virnetsocket.h)</dt> <dt><code>virNetSocket *</code> (virnetsocket.h)</dt>
<dd>The virNetSocket APIs provide a higher level wrapper around <dd>The virNetSocket APIs provide a higher level wrapper around
the raw BSD sockets and getaddrinfo APIs. They allow for creation the raw BSD sockets and getaddrinfo APIs. They allow for creation
of both server and client sockets. Data transports supported are of both server and client sockets. Data transports supported are
TCP, UNIX, SSH tunnel or external command tunnel. Internally the TCP, UNIX, SSH tunnel or external command tunnel. Internally the
TCP socket impl uses the getaddrinfo info APIs to ensure correct TCP socket impl uses the getaddrinfo info APIs to ensure correct
protocol-independent behaviour, thus supporting both IPv4 and IPv6. protocol-independent behaviour, thus supporting both IPv4 and IPv6.
The socket APIs can be associated with a virNetSASLSessionPtr or The socket APIs can be associated with a virNetSASLSession *or
virNetTLSSessionPtr object to allow seamless encryption/decryption virNetTLSSession *object to allow seamless encryption/decryption
of all writes and reads. For UNIX sockets it is possible to obtain of all writes and reads. For UNIX sockets it is possible to obtain
the remote client user ID and process ID. Integration with the the remote client user ID and process ID. Integration with the
libvirt event loop also allows use of callbacks for notification libvirt event loop also allows use of callbacks for notification
of various I/O conditions of various I/O conditions
</dd> </dd>
<dt><code>virNetMessagePtr</code> (virnetmessage.h)</dt> <dt><code>virNetMessage *</code> (virnetmessage.h)</dt>
<dd>The virNetMessage APIs provide a wrapper around the libxdr <dd>The virNetMessage APIs provide a wrapper around the libxdr
API calls, to facilitate processing and creation of RPC API calls, to facilitate processing and creation of RPC
packets. There are convenience APIs for encoding/encoding the packets. There are convenience APIs for encoding/encoding the
@ -498,7 +498,7 @@ C &lt;-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | &lt;-- S (reply)
encoding a virErrorPtr object. There is also a means to encoding a virErrorPtr object. There is also a means to
add to/serve from a linked-list queue of messages.</dd> add to/serve from a linked-list queue of messages.</dd>
<dt><code>virNetClientPtr</code> (virnetclient.h)</dt> <dt><code>virNetClient *</code> (virnetclient.h)</dt>
<dd>The virNetClient APIs provide a way to connect to a <dd>The virNetClient APIs provide a way to connect to a
remote server and run one or more RPC protocols over remote server and run one or more RPC protocols over
the connection. Connections can be made over TCP, UNIX the connection. Connections can be made over TCP, UNIX
@ -510,7 +510,7 @@ C &lt;-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | &lt;-- S (reply)
being interleaved on the wire as required. being interleaved on the wire as required.
</dd> </dd>
<dt><code>virNetClientProgramPtr</code> (virnetclientprogram.h)</dt> <dt><code>virNetClientProgram *</code> (virnetclientprogram.h)</dt>
<dd>The virNetClientProgram APIs are used to register a <dd>The virNetClientProgram APIs are used to register a
program+version with the connection. This then enables program+version with the connection. This then enables
invocation of method calls, receipt of asynchronous invocation of method calls, receipt of asynchronous
@ -519,42 +519,42 @@ C &lt;-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | &lt;-- S (reply)
care of dispatching any incoming asynchronous events. care of dispatching any incoming asynchronous events.
</dd> </dd>
<dt><code>virNetClientStreamPtr</code> (virnetclientstream.h)</dt> <dt><code>virNetClientStream *</code> (virnetclientstream.h)</dt>
<dd>The virNetClientStream APIs are used to control transmission and <dd>The virNetClientStream APIs are used to control transmission and
receipt of data over a stream active on a client. Streams provide receipt of data over a stream active on a client. Streams provide
a low latency, unlimited length, bi-directional raw data exchange a low latency, unlimited length, bi-directional raw data exchange
mechanism layered over the RPC connection mechanism layered over the RPC connection
</dd> </dd>
<dt><code>virNetServerPtr</code> (virnetserver.h)</dt> <dt><code>virNetServer *</code> (virnetserver.h)</dt>
<dd>The virNetServer APIs are used to manage a network server. A <dd>The virNetServer APIs are used to manage a network server. A
server exposed one or more programs, over one or more services. server exposed one or more programs, over one or more services.
It manages multiple client connections invoking multiple RPC It manages multiple client connections invoking multiple RPC
calls in parallel, with dispatch across multiple worker threads. calls in parallel, with dispatch across multiple worker threads.
</dd> </dd>
<dt><code>virNetDaemonPtr</code> (virnetdaemon.h)</dt> <dt><code>virNetDaemon *</code> (virnetdaemon.h)</dt>
<dd>The virNetDaemon APIs are used to manage a daemon process. A <dd>The virNetDaemon APIs are used to manage a daemon process. A
daemon is a process that might expose one or more servers. It daemon is a process that might expose one or more servers. It
handles most process-related details, network-related should handles most process-related details, network-related should
be part of the underlying server. be part of the underlying server.
</dd> </dd>
<dt><code>virNetServerClientPtr</code> (virnetserverclient.h)</dt> <dt><code>virNetServerClient *</code> (virnetserverclient.h)</dt>
<dd>The virNetServerClient APIs are used to manage I/O related <dd>The virNetServerClient APIs are used to manage I/O related
to a single client network connection. It handles initial to a single client network connection. It handles initial
validation and routing of incoming RPC packets, and transmission validation and routing of incoming RPC packets, and transmission
of outgoing packets. of outgoing packets.
</dd> </dd>
<dt><code>virNetServerProgramPtr</code> (virnetserverprogram.h)</dt> <dt><code>virNetServerProgram *</code> (virnetserverprogram.h)</dt>
<dd>The virNetServerProgram APIs are used to provide the implementation <dd>The virNetServerProgram APIs are used to provide the implementation
of a single program/version set. Primarily this includes a set of of a single program/version set. Primarily this includes a set of
callbacks used to actually invoke the APIs corresponding to callbacks used to actually invoke the APIs corresponding to
program procedure numbers. It is responsible for all the serialization program procedure numbers. It is responsible for all the serialization
of payloads to/from XDR.</dd> of payloads to/from XDR.</dd>
<dt><code>virNetServerServicePtr</code> (virnetserverservice.h)</dt> <dt><code>virNetServerService *</code> (virnetserverservice.h)</dt>
<dd>The virNetServerService APIs are used to connect the server to <dd>The virNetServerService APIs are used to connect the server to
one or more network protocols. A single service may involve multiple one or more network protocols. A single service may involve multiple
sockets (ie both IPv4 and IPv6). A service also has an associated sockets (ie both IPv4 and IPv6). A service also has an associated

View File

@ -690,14 +690,14 @@ class Object(GenericObject):
header += (( header += ((
"int esxVI_%s_Serialize(esxVI_%s *item, " "int esxVI_%s_Serialize(esxVI_%s *item, "
" const char *element, " " const char *element, "
" virBufferPtr output);\n") % " virBuffer *output);\n") %
(self.name, self.name)) (self.name, self.name))
if self.features & Object.FEATURE__LIST: if self.features & Object.FEATURE__LIST:
header += (( header += ((
"int esxVI_%s_SerializeList(esxVI_%s *list, " "int esxVI_%s_SerializeList(esxVI_%s *list, "
" const char *element, " " const char *element, "
" virBufferPtr output);\n") % " virBuffer *output);\n") %
(self.name, self.name)) (self.name, self.name))
if self.features & Object.FEATURE__DESERIALIZE: if self.features & Object.FEATURE__DESERIALIZE:
@ -1083,7 +1083,7 @@ class Enum(Type):
if self.features & Enum.FEATURE__SERIALIZE: if self.features & Enum.FEATURE__SERIALIZE:
header += ("int esxVI_%s_Serialize(esxVI_%s item, const char *element, " header += ("int esxVI_%s_Serialize(esxVI_%s item, const char *element, "
" virBufferPtr output);\n") \ " virBuffer *output);\n") \
% (self.name, self.name) % (self.name, self.name)
if self.features & Enum.FEATURE__DESERIALIZE: if self.features & Enum.FEATURE__DESERIALIZE:

View File

@ -54,7 +54,7 @@ class WmiClass:
header += "#define %s_WQL_SELECT \\\n" % name_upper header += "#define %s_WQL_SELECT \\\n" % name_upper
header += " \"SELECT * FROM %s \"\n" % self.name header += " \"SELECT * FROM %s \"\n" % self.name
header += "\n" header += "\n"
header += "extern hypervWmiClassInfoPtr %s_WmiInfo;\n\n" % self.name header += "extern hypervWmiClassInfo *%s_WmiInfo;\n\n" % self.name
header += self._declare_data_structs() header += self._declare_data_structs()
header += self._declare_hypervObject_struct() header += self._declare_hypervObject_struct()
@ -128,7 +128,7 @@ class WmiClass:
header = "\n/* must match hypervObject */\n" header = "\n/* must match hypervObject */\n"
header += "struct _%s {\n" % self.name header += "struct _%s {\n" % self.name
header += " %s_Data *data;\n" % self.name header += " %s_Data *data;\n" % self.name
header += " hypervWmiClassInfoPtr info;\n" header += " hypervWmiClassInfo *info;\n"
header += " %s *next;\n" % self.name header += " %s *next;\n" % self.name
header += "};\n" header += "};\n"
@ -142,7 +142,7 @@ class WmiClass:
This struct holds info with meta-data needed to make wsman requests for the WMI class. This struct holds info with meta-data needed to make wsman requests for the WMI class.
""" """
source = "hypervWmiClassInfoPtr %s_WmiInfo = &(hypervWmiClassInfo) {\n" % self.name source = "hypervWmiClassInfo *%s_WmiInfo = &(hypervWmiClassInfo) {\n" % self.name
source += " .name = \"%s\",\n" % self.name source += " .name = \"%s\",\n" % self.name
source += " .rootUri = %s,\n" % self.uri_info.rootUri source += " .rootUri = %s,\n" % self.uri_info.rootUri
source += " .resourceUri = %s_RESOURCE_URI,\n" % self.name.upper() source += " .resourceUri = %s_RESOURCE_URI,\n" % self.name.upper()

View File

@ -23,58 +23,56 @@
#include "conf/domain_conf.h" #include "conf/domain_conf.h"
#include "access/viraccessmanager.h" #include "access/viraccessmanager.h"
typedef int (*virAccessDriverCheckConnectDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckConnectDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virAccessPermConnect av); virAccessPermConnect av);
typedef int (*virAccessDriverCheckDomainDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckDomainDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virDomainDefPtr domain, virDomainDef *domain,
virAccessPermDomain av); virAccessPermDomain av);
typedef int (*virAccessDriverCheckInterfaceDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckInterfaceDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virInterfaceDefPtr iface, virInterfaceDef *iface,
virAccessPermInterface av); virAccessPermInterface av);
typedef int (*virAccessDriverCheckNetworkDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckNetworkDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virAccessPermNetwork av); virAccessPermNetwork av);
typedef int (*virAccessDriverCheckNetworkPortDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckNetworkPortDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virNetworkPortDefPtr port, virNetworkPortDef *port,
virAccessPermNetworkPort av); virAccessPermNetworkPort av);
typedef int (*virAccessDriverCheckNodeDeviceDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckNodeDeviceDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virNodeDeviceDefPtr nodedev, virNodeDeviceDef *nodedev,
virAccessPermNodeDevice av); virAccessPermNodeDevice av);
typedef int (*virAccessDriverCheckNWFilterDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckNWFilterDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterDefPtr nwfilter, virNWFilterDef *nwfilter,
virAccessPermNWFilter av); virAccessPermNWFilter av);
typedef int (*virAccessDriverCheckNWFilterBindingDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckNWFilterBindingDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterBindingDefPtr binding, virNWFilterBindingDef *binding,
virAccessPermNWFilterBinding av); virAccessPermNWFilterBinding av);
typedef int (*virAccessDriverCheckSecretDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckSecretDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virSecretDefPtr secret, virSecretDef *secret,
virAccessPermSecret av); virAccessPermSecret av);
typedef int (*virAccessDriverCheckStoragePoolDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckStoragePoolDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virAccessPermStoragePool av); virAccessPermStoragePool av);
typedef int (*virAccessDriverCheckStorageVolDrv)(virAccessManagerPtr manager, typedef int (*virAccessDriverCheckStorageVolDrv)(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virStorageVolDefPtr vol, virStorageVolDef *vol,
virAccessPermStorageVol av); virAccessPermStorageVol av);
typedef int (*virAccessDriverSetupDrv)(virAccessManagerPtr manager); typedef int (*virAccessDriverSetupDrv)(virAccessManager *manager);
typedef void (*virAccessDriverCleanupDrv)(virAccessManagerPtr manager); typedef void (*virAccessDriverCleanupDrv)(virAccessManager *manager);
typedef struct _virAccessDriver virAccessDriver; typedef struct _virAccessDriver virAccessDriver;
typedef virAccessDriver *virAccessDriverPtr;
struct _virAccessDriver { struct _virAccessDriver {
size_t privateDataLen; size_t privateDataLen;
const char *name; const char *name;

View File

@ -23,7 +23,7 @@
#include "access/viraccessdrivernop.h" #include "access/viraccessdrivernop.h"
static int static int
virAccessDriverNopCheckConnect(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckConnect(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virAccessPermConnect perm G_GNUC_UNUSED) virAccessPermConnect perm G_GNUC_UNUSED)
{ {
@ -31,92 +31,92 @@ virAccessDriverNopCheckConnect(virAccessManagerPtr manager G_GNUC_UNUSED,
} }
static int static int
virAccessDriverNopCheckDomain(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckDomain(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virDomainDefPtr domain G_GNUC_UNUSED, virDomainDef *domain G_GNUC_UNUSED,
virAccessPermDomain perm G_GNUC_UNUSED) virAccessPermDomain perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckInterface(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckInterface(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virInterfaceDefPtr iface G_GNUC_UNUSED, virInterfaceDef *iface G_GNUC_UNUSED,
virAccessPermInterface perm G_GNUC_UNUSED) virAccessPermInterface perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckNetwork(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckNetwork(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virNetworkDefPtr network G_GNUC_UNUSED, virNetworkDef *network G_GNUC_UNUSED,
virAccessPermNetwork perm G_GNUC_UNUSED) virAccessPermNetwork perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckNetworkPort(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckNetworkPort(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virNetworkDefPtr network G_GNUC_UNUSED, virNetworkDef *network G_GNUC_UNUSED,
virNetworkPortDefPtr port G_GNUC_UNUSED, virNetworkPortDef *port G_GNUC_UNUSED,
virAccessPermNetworkPort perm G_GNUC_UNUSED) virAccessPermNetworkPort perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckNodeDevice(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckNodeDevice(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virNodeDeviceDefPtr nodedev G_GNUC_UNUSED, virNodeDeviceDef *nodedev G_GNUC_UNUSED,
virAccessPermNodeDevice perm G_GNUC_UNUSED) virAccessPermNodeDevice perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckNWFilter(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckNWFilter(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virNWFilterDefPtr nwfilter G_GNUC_UNUSED, virNWFilterDef *nwfilter G_GNUC_UNUSED,
virAccessPermNWFilter perm G_GNUC_UNUSED) virAccessPermNWFilter perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckNWFilterBinding(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckNWFilterBinding(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virNWFilterBindingDefPtr binding G_GNUC_UNUSED, virNWFilterBindingDef *binding G_GNUC_UNUSED,
virAccessPermNWFilterBinding perm G_GNUC_UNUSED) virAccessPermNWFilterBinding perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckSecret(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckSecret(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virSecretDefPtr secret G_GNUC_UNUSED, virSecretDef *secret G_GNUC_UNUSED,
virAccessPermSecret perm G_GNUC_UNUSED) virAccessPermSecret perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckStoragePool(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckStoragePool(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virStoragePoolDefPtr pool G_GNUC_UNUSED, virStoragePoolDef *pool G_GNUC_UNUSED,
virAccessPermStoragePool perm G_GNUC_UNUSED) virAccessPermStoragePool perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */
} }
static int static int
virAccessDriverNopCheckStorageVol(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverNopCheckStorageVol(virAccessManager *manager G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED, const char *driverName G_GNUC_UNUSED,
virStoragePoolDefPtr pool G_GNUC_UNUSED, virStoragePoolDef *pool G_GNUC_UNUSED,
virStorageVolDefPtr vol G_GNUC_UNUSED, virStorageVolDef *vol G_GNUC_UNUSED,
virAccessPermStorageVol perm G_GNUC_UNUSED) virAccessPermStorageVol perm G_GNUC_UNUSED)
{ {
return 1; /* Allow */ return 1; /* Allow */

View File

@ -40,14 +40,12 @@ VIR_LOG_INIT("access.accessdriverpolkit");
#define VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX "org.libvirt.api" #define VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX "org.libvirt.api"
typedef struct _virAccessDriverPolkitPrivate virAccessDriverPolkitPrivate; typedef struct _virAccessDriverPolkitPrivate virAccessDriverPolkitPrivate;
typedef virAccessDriverPolkitPrivate *virAccessDriverPolkitPrivatePtr;
struct _virAccessDriverPolkitPrivate { struct _virAccessDriverPolkitPrivate {
bool ignore; bool ignore;
}; };
static void virAccessDriverPolkitCleanup(virAccessManagerPtr manager G_GNUC_UNUSED) static void virAccessDriverPolkitCleanup(virAccessManager *manager G_GNUC_UNUSED)
{ {
} }
@ -118,7 +116,7 @@ virAccessDriverPolkitGetCaller(const char *actionid,
static int static int
virAccessDriverPolkitCheck(virAccessManagerPtr manager G_GNUC_UNUSED, virAccessDriverPolkitCheck(virAccessManager *manager G_GNUC_UNUSED,
const char *typename, const char *typename,
const char *permname, const char *permname,
const char **attrs) const char **attrs)
@ -161,7 +159,7 @@ virAccessDriverPolkitCheck(virAccessManagerPtr manager G_GNUC_UNUSED,
static int static int
virAccessDriverPolkitCheckConnect(virAccessManagerPtr manager, virAccessDriverPolkitCheckConnect(virAccessManager *manager,
const char *driverName, const char *driverName,
virAccessPermConnect perm) virAccessPermConnect perm)
{ {
@ -177,9 +175,9 @@ virAccessDriverPolkitCheckConnect(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckDomain(virAccessManagerPtr manager, virAccessDriverPolkitCheckDomain(virAccessManager *manager,
const char *driverName, const char *driverName,
virDomainDefPtr domain, virDomainDef *domain,
virAccessPermDomain perm) virAccessPermDomain perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -198,9 +196,9 @@ virAccessDriverPolkitCheckDomain(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckInterface(virAccessManagerPtr manager, virAccessDriverPolkitCheckInterface(virAccessManager *manager,
const char *driverName, const char *driverName,
virInterfaceDefPtr iface, virInterfaceDef *iface,
virAccessPermInterface perm) virAccessPermInterface perm)
{ {
const char *attrs[] = { const char *attrs[] = {
@ -217,9 +215,9 @@ virAccessDriverPolkitCheckInterface(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckNetwork(virAccessManagerPtr manager, virAccessDriverPolkitCheckNetwork(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virAccessPermNetwork perm) virAccessPermNetwork perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -238,10 +236,10 @@ virAccessDriverPolkitCheckNetwork(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckNetworkPort(virAccessManagerPtr manager, virAccessDriverPolkitCheckNetworkPort(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virNetworkPortDefPtr port, virNetworkPortDef *port,
virAccessPermNetworkPort perm) virAccessPermNetworkPort perm)
{ {
char uuidstr1[VIR_UUID_STRING_BUFLEN]; char uuidstr1[VIR_UUID_STRING_BUFLEN];
@ -263,9 +261,9 @@ virAccessDriverPolkitCheckNetworkPort(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckNodeDevice(virAccessManagerPtr manager, virAccessDriverPolkitCheckNodeDevice(virAccessManager *manager,
const char *driverName, const char *driverName,
virNodeDeviceDefPtr nodedev, virNodeDeviceDef *nodedev,
virAccessPermNodeDevice perm) virAccessPermNodeDevice perm)
{ {
const char *attrs[] = { const char *attrs[] = {
@ -281,9 +279,9 @@ virAccessDriverPolkitCheckNodeDevice(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckNWFilter(virAccessManagerPtr manager, virAccessDriverPolkitCheckNWFilter(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterDefPtr nwfilter, virNWFilterDef *nwfilter,
virAccessPermNWFilter perm) virAccessPermNWFilter perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -302,9 +300,9 @@ virAccessDriverPolkitCheckNWFilter(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckNWFilterBinding(virAccessManagerPtr manager, virAccessDriverPolkitCheckNWFilterBinding(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterBindingDefPtr binding, virNWFilterBindingDef *binding,
virAccessPermNWFilterBinding perm) virAccessPermNWFilterBinding perm)
{ {
const char *attrs[] = { const char *attrs[] = {
@ -322,9 +320,9 @@ virAccessDriverPolkitCheckNWFilterBinding(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckSecret(virAccessManagerPtr manager, virAccessDriverPolkitCheckSecret(virAccessManager *manager,
const char *driverName, const char *driverName,
virSecretDefPtr secret, virSecretDef *secret,
virAccessPermSecret perm) virAccessPermSecret perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -400,9 +398,9 @@ virAccessDriverPolkitCheckSecret(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckStoragePool(virAccessManagerPtr manager, virAccessDriverPolkitCheckStoragePool(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virAccessPermStoragePool perm) virAccessPermStoragePool perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -421,10 +419,10 @@ virAccessDriverPolkitCheckStoragePool(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverPolkitCheckStorageVol(virAccessManagerPtr manager, virAccessDriverPolkitCheckStorageVol(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virStorageVolDefPtr vol, virStorageVolDef *vol,
virAccessPermStorageVol perm) virAccessPermStorageVol perm)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];

View File

@ -27,18 +27,16 @@
#define VIR_FROM_THIS VIR_FROM_ACCESS #define VIR_FROM_THIS VIR_FROM_ACCESS
typedef struct _virAccessDriverStackPrivate virAccessDriverStackPrivate; typedef struct _virAccessDriverStackPrivate virAccessDriverStackPrivate;
typedef virAccessDriverStackPrivate *virAccessDriverStackPrivatePtr;
struct _virAccessDriverStackPrivate { struct _virAccessDriverStackPrivate {
virAccessManagerPtr *managers; virAccessManager **managers;
size_t managersLen; size_t managersLen;
}; };
int virAccessDriverStackAppend(virAccessManagerPtr manager, int virAccessDriverStackAppend(virAccessManager *manager,
virAccessManagerPtr child) virAccessManager *child)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
VIR_EXPAND_N(priv->managers, priv->managersLen, 1); VIR_EXPAND_N(priv->managers, priv->managersLen, 1);
@ -48,9 +46,9 @@ int virAccessDriverStackAppend(virAccessManagerPtr manager,
} }
static void virAccessDriverStackCleanup(virAccessManagerPtr manager) static void virAccessDriverStackCleanup(virAccessManager *manager)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
size_t i; size_t i;
for (i = 0; i < priv->managersLen; i++) for (i = 0; i < priv->managersLen; i++)
@ -60,11 +58,11 @@ static void virAccessDriverStackCleanup(virAccessManagerPtr manager)
static int static int
virAccessDriverStackCheckConnect(virAccessManagerPtr manager, virAccessDriverStackCheckConnect(virAccessManager *manager,
const char *driverName, const char *driverName,
virAccessPermConnect perm) virAccessPermConnect perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -82,12 +80,12 @@ virAccessDriverStackCheckConnect(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckDomain(virAccessManagerPtr manager, virAccessDriverStackCheckDomain(virAccessManager *manager,
const char *driverName, const char *driverName,
virDomainDefPtr domain, virDomainDef *domain,
virAccessPermDomain perm) virAccessPermDomain perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -105,12 +103,12 @@ virAccessDriverStackCheckDomain(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckInterface(virAccessManagerPtr manager, virAccessDriverStackCheckInterface(virAccessManager *manager,
const char *driverName, const char *driverName,
virInterfaceDefPtr iface, virInterfaceDef *iface,
virAccessPermInterface perm) virAccessPermInterface perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -128,12 +126,12 @@ virAccessDriverStackCheckInterface(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckNetwork(virAccessManagerPtr manager, virAccessDriverStackCheckNetwork(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virAccessPermNetwork perm) virAccessPermNetwork perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -151,13 +149,13 @@ virAccessDriverStackCheckNetwork(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckNetworkPort(virAccessManagerPtr manager, virAccessDriverStackCheckNetworkPort(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virNetworkPortDefPtr port, virNetworkPortDef *port,
virAccessPermNetworkPort perm) virAccessPermNetworkPort perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -175,12 +173,12 @@ virAccessDriverStackCheckNetworkPort(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckNodeDevice(virAccessManagerPtr manager, virAccessDriverStackCheckNodeDevice(virAccessManager *manager,
const char *driverName, const char *driverName,
virNodeDeviceDefPtr nodedev, virNodeDeviceDef *nodedev,
virAccessPermNodeDevice perm) virAccessPermNodeDevice perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -198,12 +196,12 @@ virAccessDriverStackCheckNodeDevice(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckNWFilter(virAccessManagerPtr manager, virAccessDriverStackCheckNWFilter(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterDefPtr nwfilter, virNWFilterDef *nwfilter,
virAccessPermNWFilter perm) virAccessPermNWFilter perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -221,12 +219,12 @@ virAccessDriverStackCheckNWFilter(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckNWFilterBinding(virAccessManagerPtr manager, virAccessDriverStackCheckNWFilterBinding(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterBindingDefPtr binding, virNWFilterBindingDef *binding,
virAccessPermNWFilterBinding perm) virAccessPermNWFilterBinding perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -244,12 +242,12 @@ virAccessDriverStackCheckNWFilterBinding(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckSecret(virAccessManagerPtr manager, virAccessDriverStackCheckSecret(virAccessManager *manager,
const char *driverName, const char *driverName,
virSecretDefPtr secret, virSecretDef *secret,
virAccessPermSecret perm) virAccessPermSecret perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -267,12 +265,12 @@ virAccessDriverStackCheckSecret(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckStoragePool(virAccessManagerPtr manager, virAccessDriverStackCheckStoragePool(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virAccessPermStoragePool perm) virAccessPermStoragePool perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;
@ -290,13 +288,13 @@ virAccessDriverStackCheckStoragePool(virAccessManagerPtr manager,
} }
static int static int
virAccessDriverStackCheckStorageVol(virAccessManagerPtr manager, virAccessDriverStackCheckStorageVol(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virStorageVolDefPtr vol, virStorageVolDef *vol,
virAccessPermStorageVol perm) virAccessPermStorageVol perm)
{ {
virAccessDriverStackPrivatePtr priv = virAccessManagerGetPrivateData(manager); virAccessDriverStackPrivate *priv = virAccessManagerGetPrivateData(manager);
int ret = 1; int ret = 1;
size_t i; size_t i;

View File

@ -23,7 +23,7 @@
#include "access/viraccessdriver.h" #include "access/viraccessdriver.h"
int virAccessDriverStackAppend(virAccessManagerPtr manager, int virAccessDriverStackAppend(virAccessManager *manager,
virAccessManagerPtr child); virAccessManager *child);
extern virAccessDriver accessDriverStack; extern virAccessDriver accessDriverStack;

View File

@ -43,12 +43,12 @@ VIR_LOG_INIT("access.accessmanager");
struct _virAccessManager { struct _virAccessManager {
virObjectLockable parent; virObjectLockable parent;
virAccessDriverPtr drv; virAccessDriver *drv;
void *privateData; void *privateData;
}; };
static virClassPtr virAccessManagerClass; static virClass *virAccessManagerClass;
static virAccessManagerPtr virAccessManagerDefault; static virAccessManager *virAccessManagerDefault;
static void virAccessManagerDispose(void *obj); static void virAccessManagerDispose(void *obj);
@ -63,7 +63,7 @@ static int virAccessManagerOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virAccessManager); VIR_ONCE_GLOBAL_INIT(virAccessManager);
virAccessManagerPtr virAccessManagerGetDefault(void) virAccessManager *virAccessManagerGetDefault(void)
{ {
if (virAccessManagerDefault == NULL) { if (virAccessManagerDefault == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -75,7 +75,7 @@ virAccessManagerPtr virAccessManagerGetDefault(void)
} }
void virAccessManagerSetDefault(virAccessManagerPtr mgr) void virAccessManagerSetDefault(virAccessManager *mgr)
{ {
virObjectUnref(virAccessManagerDefault); virObjectUnref(virAccessManagerDefault);
@ -83,9 +83,9 @@ void virAccessManagerSetDefault(virAccessManagerPtr mgr)
} }
static virAccessManagerPtr virAccessManagerNewDriver(virAccessDriverPtr drv) static virAccessManager *virAccessManagerNewDriver(virAccessDriver *drv)
{ {
virAccessManagerPtr mgr; virAccessManager *mgr;
char *privateData; char *privateData;
if (virAccessManagerInitialize() < 0) if (virAccessManagerInitialize() < 0)
@ -112,7 +112,7 @@ static virAccessManagerPtr virAccessManagerNewDriver(virAccessDriverPtr drv)
} }
static virAccessDriverPtr accessDrivers[] = { static virAccessDriver *accessDrivers[] = {
&accessDriverNop, &accessDriverNop,
#if WITH_POLKIT #if WITH_POLKIT
&accessDriverPolkit, &accessDriverPolkit,
@ -120,7 +120,7 @@ static virAccessDriverPtr accessDrivers[] = {
}; };
static virAccessDriverPtr virAccessManagerFindDriver(const char *name) static virAccessDriver *virAccessManagerFindDriver(const char *name)
{ {
size_t i; size_t i;
for (i = 0; i < G_N_ELEMENTS(accessDrivers); i++) { for (i = 0; i < G_N_ELEMENTS(accessDrivers); i++) {
@ -132,9 +132,9 @@ static virAccessDriverPtr virAccessManagerFindDriver(const char *name)
} }
virAccessManagerPtr virAccessManagerNew(const char *name) virAccessManager *virAccessManagerNew(const char *name)
{ {
virAccessDriverPtr drv; virAccessDriver *drv;
if (virAccessManagerInitialize() < 0) if (virAccessManagerInitialize() < 0)
return NULL; return NULL;
@ -150,16 +150,16 @@ virAccessManagerPtr virAccessManagerNew(const char *name)
} }
virAccessManagerPtr virAccessManagerNewStack(const char **names) virAccessManager *virAccessManagerNewStack(const char **names)
{ {
virAccessManagerPtr manager = virAccessManagerNewDriver(&accessDriverStack); virAccessManager *manager = virAccessManagerNewDriver(&accessDriverStack);
size_t i; size_t i;
if (!manager) if (!manager)
return NULL; return NULL;
for (i = 0; names[i] != NULL; i++) { for (i = 0; names[i] != NULL; i++) {
virAccessManagerPtr child = virAccessManagerNew(names[i]); virAccessManager *child = virAccessManagerNew(names[i]);
if (!child) if (!child)
goto error; goto error;
@ -178,7 +178,7 @@ virAccessManagerPtr virAccessManagerNewStack(const char **names)
} }
void *virAccessManagerGetPrivateData(virAccessManagerPtr mgr) void *virAccessManagerGetPrivateData(virAccessManager *mgr)
{ {
return mgr->privateData; return mgr->privateData;
} }
@ -186,7 +186,7 @@ void *virAccessManagerGetPrivateData(virAccessManagerPtr mgr)
static void virAccessManagerDispose(void *object) static void virAccessManagerDispose(void *object)
{ {
virAccessManagerPtr mgr = object; virAccessManager *mgr = object;
if (mgr->drv->cleanup) if (mgr->drv->cleanup)
mgr->drv->cleanup(mgr); mgr->drv->cleanup(mgr);
@ -213,7 +213,7 @@ virAccessManagerSanitizeError(int ret,
return ret; return ret;
} }
int virAccessManagerCheckConnect(virAccessManagerPtr manager, int virAccessManagerCheckConnect(virAccessManager *manager,
const char *driverName, const char *driverName,
virAccessPermConnect perm) virAccessPermConnect perm)
{ {
@ -228,9 +228,9 @@ int virAccessManagerCheckConnect(virAccessManagerPtr manager,
} }
int virAccessManagerCheckDomain(virAccessManagerPtr manager, int virAccessManagerCheckDomain(virAccessManager *manager,
const char *driverName, const char *driverName,
virDomainDefPtr domain, virDomainDef *domain,
virAccessPermDomain perm) virAccessPermDomain perm)
{ {
int ret = 0; int ret = 0;
@ -243,9 +243,9 @@ int virAccessManagerCheckDomain(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckInterface(virAccessManagerPtr manager, int virAccessManagerCheckInterface(virAccessManager *manager,
const char *driverName, const char *driverName,
virInterfaceDefPtr iface, virInterfaceDef *iface,
virAccessPermInterface perm) virAccessPermInterface perm)
{ {
int ret = 0; int ret = 0;
@ -258,9 +258,9 @@ int virAccessManagerCheckInterface(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckNetwork(virAccessManagerPtr manager, int virAccessManagerCheckNetwork(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virAccessPermNetwork perm) virAccessPermNetwork perm)
{ {
int ret = 0; int ret = 0;
@ -273,10 +273,10 @@ int virAccessManagerCheckNetwork(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckNetworkPort(virAccessManagerPtr manager, int virAccessManagerCheckNetworkPort(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virNetworkPortDefPtr port, virNetworkPortDef *port,
virAccessPermNetworkPort perm) virAccessPermNetworkPort perm)
{ {
int ret = 0; int ret = 0;
@ -289,9 +289,9 @@ int virAccessManagerCheckNetworkPort(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager, int virAccessManagerCheckNodeDevice(virAccessManager *manager,
const char *driverName, const char *driverName,
virNodeDeviceDefPtr nodedev, virNodeDeviceDef *nodedev,
virAccessPermNodeDevice perm) virAccessPermNodeDevice perm)
{ {
int ret = 0; int ret = 0;
@ -304,9 +304,9 @@ int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckNWFilter(virAccessManagerPtr manager, int virAccessManagerCheckNWFilter(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterDefPtr nwfilter, virNWFilterDef *nwfilter,
virAccessPermNWFilter perm) virAccessPermNWFilter perm)
{ {
int ret = 0; int ret = 0;
@ -319,9 +319,9 @@ int virAccessManagerCheckNWFilter(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager, int virAccessManagerCheckNWFilterBinding(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterBindingDefPtr binding, virNWFilterBindingDef *binding,
virAccessPermNWFilterBinding perm) virAccessPermNWFilterBinding perm)
{ {
int ret = 0; int ret = 0;
@ -334,9 +334,9 @@ int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckSecret(virAccessManagerPtr manager, int virAccessManagerCheckSecret(virAccessManager *manager,
const char *driverName, const char *driverName,
virSecretDefPtr secret, virSecretDef *secret,
virAccessPermSecret perm) virAccessPermSecret perm)
{ {
int ret = 0; int ret = 0;
@ -349,9 +349,9 @@ int virAccessManagerCheckSecret(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckStoragePool(virAccessManagerPtr manager, int virAccessManagerCheckStoragePool(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virAccessPermStoragePool perm) virAccessPermStoragePool perm)
{ {
int ret = 0; int ret = 0;
@ -364,10 +364,10 @@ int virAccessManagerCheckStoragePool(virAccessManagerPtr manager,
return virAccessManagerSanitizeError(ret, driverName); return virAccessManagerSanitizeError(ret, driverName);
} }
int virAccessManagerCheckStorageVol(virAccessManagerPtr manager, int virAccessManagerCheckStorageVol(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virStorageVolDefPtr vol, virStorageVolDef *vol,
virAccessPermStorageVol perm) virAccessPermStorageVol perm)
{ {
int ret = 0; int ret = 0;

View File

@ -33,16 +33,15 @@
#include "access/viraccessperm.h" #include "access/viraccessperm.h"
typedef struct _virAccessManager virAccessManager; typedef struct _virAccessManager virAccessManager;
typedef virAccessManager *virAccessManagerPtr;
virAccessManagerPtr virAccessManagerGetDefault(void); virAccessManager *virAccessManagerGetDefault(void);
void virAccessManagerSetDefault(virAccessManagerPtr manager); void virAccessManagerSetDefault(virAccessManager *manager);
virAccessManagerPtr virAccessManagerNew(const char *name); virAccessManager *virAccessManagerNew(const char *name);
virAccessManagerPtr virAccessManagerNewStack(const char **names); virAccessManager *virAccessManagerNewStack(const char **names);
void *virAccessManagerGetPrivateData(virAccessManagerPtr manager); void *virAccessManagerGetPrivateData(virAccessManager *manager);
/* /*
@ -51,48 +50,48 @@ void *virAccessManagerGetPrivateData(virAccessManagerPtr manager);
* Return 0 on auth deny * Return 0 on auth deny
* Return 1 on auth allow * Return 1 on auth allow
*/ */
int virAccessManagerCheckConnect(virAccessManagerPtr manager, int virAccessManagerCheckConnect(virAccessManager *manager,
const char *driverName, const char *driverName,
virAccessPermConnect perm); virAccessPermConnect perm);
int virAccessManagerCheckDomain(virAccessManagerPtr manager, int virAccessManagerCheckDomain(virAccessManager *manager,
const char *driverName, const char *driverName,
virDomainDefPtr domain, virDomainDef *domain,
virAccessPermDomain perm); virAccessPermDomain perm);
int virAccessManagerCheckInterface(virAccessManagerPtr manager, int virAccessManagerCheckInterface(virAccessManager *manager,
const char *driverName, const char *driverName,
virInterfaceDefPtr iface, virInterfaceDef *iface,
virAccessPermInterface perm); virAccessPermInterface perm);
int virAccessManagerCheckNetwork(virAccessManagerPtr manager, int virAccessManagerCheckNetwork(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virAccessPermNetwork perm); virAccessPermNetwork perm);
int virAccessManagerCheckNetworkPort(virAccessManagerPtr manager, int virAccessManagerCheckNetworkPort(virAccessManager *manager,
const char *driverName, const char *driverName,
virNetworkDefPtr network, virNetworkDef *network,
virNetworkPortDefPtr port, virNetworkPortDef *port,
virAccessPermNetworkPort perm); virAccessPermNetworkPort perm);
int virAccessManagerCheckNodeDevice(virAccessManagerPtr manager, int virAccessManagerCheckNodeDevice(virAccessManager *manager,
const char *driverName, const char *driverName,
virNodeDeviceDefPtr nodedev, virNodeDeviceDef *nodedev,
virAccessPermNodeDevice perm); virAccessPermNodeDevice perm);
int virAccessManagerCheckNWFilter(virAccessManagerPtr manager, int virAccessManagerCheckNWFilter(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterDefPtr nwfilter, virNWFilterDef *nwfilter,
virAccessPermNWFilter perm); virAccessPermNWFilter perm);
int virAccessManagerCheckNWFilterBinding(virAccessManagerPtr manager, int virAccessManagerCheckNWFilterBinding(virAccessManager *manager,
const char *driverName, const char *driverName,
virNWFilterBindingDefPtr binding, virNWFilterBindingDef *binding,
virAccessPermNWFilterBinding perm); virAccessPermNWFilterBinding perm);
int virAccessManagerCheckSecret(virAccessManagerPtr manager, int virAccessManagerCheckSecret(virAccessManager *manager,
const char *driverName, const char *driverName,
virSecretDefPtr secret, virSecretDef *secret,
virAccessPermSecret perm); virAccessPermSecret perm);
int virAccessManagerCheckStoragePool(virAccessManagerPtr manager, int virAccessManagerCheckStoragePool(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virAccessPermStoragePool perm); virAccessPermStoragePool perm);
int virAccessManagerCheckStorageVol(virAccessManagerPtr manager, int virAccessManagerCheckStorageVol(virAccessManager *manager,
const char *driverName, const char *driverName,
virStoragePoolDefPtr pool, virStoragePoolDef *pool,
virStorageVolDefPtr vol, virStorageVolDef *vol,
virAccessPermStorageVol perm); virAccessPermStorageVol perm);

View File

@ -24,22 +24,20 @@
#include "admin_protocol.h" #include "admin_protocol.h"
typedef struct _remoteAdminPriv remoteAdminPriv; typedef struct _remoteAdminPriv remoteAdminPriv;
typedef remoteAdminPriv *remoteAdminPrivPtr;
struct _remoteAdminPriv { struct _remoteAdminPriv {
virObjectLockable parent; virObjectLockable parent;
int counter; int counter;
virNetClientPtr client; virNetClient *client;
virNetClientProgramPtr program; virNetClientProgram *program;
}; };
static virClassPtr remoteAdminPrivClass; static virClass *remoteAdminPrivClass;
static void static void
remoteAdminPrivDispose(void *opaque) remoteAdminPrivDispose(void *opaque)
{ {
remoteAdminPrivPtr priv = opaque; remoteAdminPriv *priv = opaque;
virObjectUnref(priv->program); virObjectUnref(priv->program);
virObjectUnref(priv->client); virObjectUnref(priv->client);
@ -77,7 +75,7 @@ make_nonnull_client(admin_nonnull_client *client_dst,
static int static int
callFull(virAdmConnectPtr conn G_GNUC_UNUSED, callFull(virAdmConnectPtr conn G_GNUC_UNUSED,
remoteAdminPrivPtr priv, remoteAdminPriv *priv,
int *fdin, int *fdin,
size_t fdinlen, size_t fdinlen,
int **fdout, int **fdout,
@ -87,9 +85,9 @@ callFull(virAdmConnectPtr conn G_GNUC_UNUSED,
xdrproc_t ret_filter, char *ret) xdrproc_t ret_filter, char *ret)
{ {
int rv; int rv;
virNetClientProgramPtr prog = priv->program; virNetClientProgram *prog = priv->program;
int counter = priv->counter++; int counter = priv->counter++;
virNetClientPtr client = priv->client; virNetClient *client = priv->client;
/* Unlock, so that if we get any async events/stream data /* Unlock, so that if we get any async events/stream data
* while processing the RPC, we don't deadlock when our * while processing the RPC, we don't deadlock when our
@ -130,11 +128,11 @@ call(virAdmConnectPtr conn,
#include "admin_client.h" #include "admin_client.h"
static void static void
remoteAdminClientCloseFunc(virNetClientPtr client G_GNUC_UNUSED, remoteAdminClientCloseFunc(virNetClient *client G_GNUC_UNUSED,
int reason, int reason,
void *opaque) void *opaque)
{ {
virAdmConnectCloseCallbackDataPtr cbdata = opaque; virAdmConnectCloseCallbackData *cbdata = opaque;
virObjectLock(cbdata); virObjectLock(cbdata);
@ -151,7 +149,7 @@ static int
remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags) remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = conn->privateData; remoteAdminPriv *priv = conn->privateData;
admin_connect_open_args args; admin_connect_open_args args;
virObjectLock(priv); virObjectLock(priv);
@ -186,7 +184,7 @@ static int
remoteAdminConnectClose(virAdmConnectPtr conn) remoteAdminConnectClose(virAdmConnectPtr conn)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = conn->privateData; remoteAdminPriv *priv = conn->privateData;
virObjectLock(priv); virObjectLock(priv);
@ -216,10 +214,10 @@ remoteAdminPrivFree(void *opaque)
virObjectUnref(conn->privateData); virObjectUnref(conn->privateData);
} }
static remoteAdminPrivPtr static remoteAdminPriv *
remoteAdminPrivNew(const char *sock_path) remoteAdminPrivNew(const char *sock_path)
{ {
remoteAdminPrivPtr priv = NULL; remoteAdminPriv *priv = NULL;
if (!(priv = virObjectLockableNew(remoteAdminPrivClass))) if (!(priv = virObjectLockableNew(remoteAdminPrivClass)))
goto error; goto error;
@ -248,7 +246,7 @@ remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv,
unsigned int flags) unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = srv->conn->privateData; remoteAdminPriv *priv = srv->conn->privateData;
admin_server_get_threadpool_parameters_args args; admin_server_get_threadpool_parameters_args args;
admin_server_get_threadpool_parameters_ret ret; admin_server_get_threadpool_parameters_ret ret;
@ -263,7 +261,7 @@ remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv,
(xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret) == -1) (xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret) == -1)
goto cleanup; goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) ret.params.params_val,
ret.params.params_len, ret.params.params_len,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX, ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
params, params,
@ -285,7 +283,7 @@ remoteAdminServerSetThreadPoolParameters(virAdmServerPtr srv,
unsigned int flags) unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = srv->conn->privateData; remoteAdminPriv *priv = srv->conn->privateData;
admin_server_set_threadpool_parameters_args args; admin_server_set_threadpool_parameters_args args;
args.flags = flags; args.flags = flags;
@ -295,7 +293,7 @@ remoteAdminServerSetThreadPoolParameters(virAdmServerPtr srv,
if (virTypedParamsSerialize(params, nparams, if (virTypedParamsSerialize(params, nparams,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX, ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
(virTypedParameterRemotePtr *) &args.params.params_val, (struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len, &args.params.params_len,
0) < 0) 0) < 0)
goto cleanup; goto cleanup;
@ -308,7 +306,7 @@ remoteAdminServerSetThreadPoolParameters(virAdmServerPtr srv,
rv = 0; rv = 0;
cleanup: cleanup:
virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, virTypedParamsRemoteFree((struct _virTypedParameterRemote *) args.params.params_val,
args.params.params_len); args.params.params_len);
virObjectUnlock(priv); virObjectUnlock(priv);
return rv; return rv;
@ -321,7 +319,7 @@ remoteAdminClientGetInfo(virAdmClientPtr client,
unsigned int flags) unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = client->srv->conn->privateData; remoteAdminPriv *priv = client->srv->conn->privateData;
admin_client_get_info_args args; admin_client_get_info_args args;
admin_client_get_info_ret ret; admin_client_get_info_ret ret;
@ -336,7 +334,7 @@ remoteAdminClientGetInfo(virAdmClientPtr client,
(xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret) == -1) (xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret) == -1)
goto cleanup; goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) ret.params.params_val,
ret.params.params_len, ret.params.params_len,
ADMIN_CLIENT_INFO_PARAMETERS_MAX, ADMIN_CLIENT_INFO_PARAMETERS_MAX,
params, params,
@ -360,7 +358,7 @@ remoteAdminServerGetClientLimits(virAdmServerPtr srv,
int rv = -1; int rv = -1;
admin_server_get_client_limits_args args; admin_server_get_client_limits_args args;
admin_server_get_client_limits_ret ret; admin_server_get_client_limits_ret ret;
remoteAdminPrivPtr priv = srv->conn->privateData; remoteAdminPriv *priv = srv->conn->privateData;
args.flags = flags; args.flags = flags;
make_nonnull_server(&args.srv, srv); make_nonnull_server(&args.srv, srv);
@ -374,7 +372,7 @@ remoteAdminServerGetClientLimits(virAdmServerPtr srv,
(char *) &ret) == -1) (char *) &ret) == -1)
goto cleanup; goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.params_val, if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) ret.params.params_val,
ret.params.params_len, ret.params.params_len,
ADMIN_SERVER_CLIENT_LIMITS_MAX, ADMIN_SERVER_CLIENT_LIMITS_MAX,
params, params,
@ -398,7 +396,7 @@ remoteAdminServerSetClientLimits(virAdmServerPtr srv,
{ {
int rv = -1; int rv = -1;
admin_server_set_client_limits_args args; admin_server_set_client_limits_args args;
remoteAdminPrivPtr priv = srv->conn->privateData; remoteAdminPriv *priv = srv->conn->privateData;
args.flags = flags; args.flags = flags;
make_nonnull_server(&args.srv, srv); make_nonnull_server(&args.srv, srv);
@ -407,7 +405,7 @@ remoteAdminServerSetClientLimits(virAdmServerPtr srv,
if (virTypedParamsSerialize(params, nparams, if (virTypedParamsSerialize(params, nparams,
ADMIN_SERVER_CLIENT_LIMITS_MAX, ADMIN_SERVER_CLIENT_LIMITS_MAX,
(virTypedParameterRemotePtr *) &args.params.params_val, (struct _virTypedParameterRemote **) &args.params.params_val,
&args.params.params_len, &args.params.params_len,
0) < 0) 0) < 0)
goto cleanup; goto cleanup;
@ -420,7 +418,7 @@ remoteAdminServerSetClientLimits(virAdmServerPtr srv,
rv = 0; rv = 0;
cleanup: cleanup:
virTypedParamsRemoteFree((virTypedParameterRemotePtr) args.params.params_val, virTypedParamsRemoteFree((struct _virTypedParameterRemote *) args.params.params_val,
args.params.params_len); args.params.params_len);
virObjectUnlock(priv); virObjectUnlock(priv);
return rv; return rv;
@ -432,7 +430,7 @@ remoteAdminConnectGetLoggingOutputs(virAdmConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = conn->privateData; remoteAdminPriv *priv = conn->privateData;
admin_connect_get_logging_outputs_args args; admin_connect_get_logging_outputs_args args;
admin_connect_get_logging_outputs_ret ret; admin_connect_get_logging_outputs_ret ret;
@ -467,7 +465,7 @@ remoteAdminConnectGetLoggingFilters(virAdmConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
int rv = -1; int rv = -1;
remoteAdminPrivPtr priv = conn->privateData; remoteAdminPriv *priv = conn->privateData;
admin_connect_get_logging_filters_args args; admin_connect_get_logging_filters_args args;
admin_connect_get_logging_filters_ret ret; admin_connect_get_logging_filters_ret ret;

View File

@ -37,12 +37,12 @@
VIR_LOG_INIT("daemon.admin_server"); VIR_LOG_INIT("daemon.admin_server");
int int
adminConnectListServers(virNetDaemonPtr dmn, adminConnectListServers(virNetDaemon *dmn,
virNetServerPtr **servers, virNetServer ***servers,
unsigned int flags) unsigned int flags)
{ {
int ret = -1; int ret = -1;
virNetServerPtr *srvs = NULL; virNetServer **srvs = NULL;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -58,8 +58,8 @@ adminConnectListServers(virNetDaemonPtr dmn,
return ret; return ret;
} }
virNetServerPtr virNetServer *
adminConnectLookupServer(virNetDaemonPtr dmn, adminConnectLookupServer(virNetDaemon *dmn,
const char *name, const char *name,
unsigned int flags) unsigned int flags)
{ {
@ -69,7 +69,7 @@ adminConnectLookupServer(virNetDaemonPtr dmn,
} }
int int
adminServerGetThreadPoolParameters(virNetServerPtr srv, adminServerGetThreadPoolParameters(virNetServer *srv,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags) unsigned int flags)
@ -123,7 +123,7 @@ adminServerGetThreadPoolParameters(virNetServerPtr srv,
} }
int int
adminServerSetThreadPoolParameters(virNetServerPtr srv, adminServerSetThreadPoolParameters(virNetServer *srv,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams, int nparams,
unsigned int flags) unsigned int flags)
@ -165,12 +165,12 @@ adminServerSetThreadPoolParameters(virNetServerPtr srv,
} }
int int
adminServerListClients(virNetServerPtr srv, adminServerListClients(virNetServer *srv,
virNetServerClientPtr **clients, virNetServerClient ***clients,
unsigned int flags) unsigned int flags)
{ {
int ret = -1; int ret = -1;
virNetServerClientPtr *clts; virNetServerClient **clts;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -185,8 +185,8 @@ adminServerListClients(virNetServerPtr srv,
return ret; return ret;
} }
virNetServerClientPtr virNetServerClient *
adminServerLookupClient(virNetServerPtr srv, adminServerLookupClient(virNetServer *srv,
unsigned long long id, unsigned long long id,
unsigned int flags) unsigned int flags)
{ {
@ -196,7 +196,7 @@ adminServerLookupClient(virNetServerPtr srv,
} }
int int
adminClientGetInfo(virNetServerClientPtr client, adminClientGetInfo(virNetServerClient *client,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags) unsigned int flags)
@ -287,7 +287,7 @@ adminClientGetInfo(virNetServerClientPtr client,
return 0; return 0;
} }
int adminClientClose(virNetServerClientPtr client, int adminClientClose(virNetServerClient *client,
unsigned int flags) unsigned int flags)
{ {
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -297,7 +297,7 @@ int adminClientClose(virNetServerClientPtr client,
} }
int int
adminServerGetClientLimits(virNetServerPtr srv, adminServerGetClientLimits(virNetServer *srv,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags) unsigned int flags)
@ -332,7 +332,7 @@ adminServerGetClientLimits(virNetServerPtr srv,
} }
int int
adminServerSetClientLimits(virNetServerPtr srv, adminServerSetClientLimits(virNetServer *srv,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams, int nparams,
unsigned int flags) unsigned int flags)
@ -367,7 +367,7 @@ adminServerSetClientLimits(virNetServerPtr srv,
} }
int int
adminServerUpdateTlsFiles(virNetServerPtr srv, adminServerUpdateTlsFiles(virNetServer *srv,
unsigned int flags) unsigned int flags)
{ {
virCheckFlags(0, -1); virCheckFlags(0, -1);

View File

@ -23,50 +23,50 @@
#include "rpc/virnetdaemon.h" #include "rpc/virnetdaemon.h"
#include "rpc/virnetserver.h" #include "rpc/virnetserver.h"
int adminConnectListServers(virNetDaemonPtr dmn, int adminConnectListServers(virNetDaemon *dmn,
virNetServerPtr **servers, virNetServer ***servers,
unsigned int flags); unsigned int flags);
virNetServerPtr adminConnectLookupServer(virNetDaemonPtr dmn, virNetServer *adminConnectLookupServer(virNetDaemon *dmn,
const char *name, const char *name,
unsigned int flags); unsigned int flags);
int int
adminServerGetThreadPoolParameters(virNetServerPtr srv, adminServerGetThreadPoolParameters(virNetServer *srv,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags); unsigned int flags);
int int
adminServerSetThreadPoolParameters(virNetServerPtr srv, adminServerSetThreadPoolParameters(virNetServer *srv,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams, int nparams,
unsigned int flags); unsigned int flags);
int adminServerListClients(virNetServerPtr srv, int adminServerListClients(virNetServer *srv,
virNetServerClientPtr **clients, virNetServerClient ***clients,
unsigned int flags); unsigned int flags);
virNetServerClientPtr adminServerLookupClient(virNetServerPtr srv, virNetServerClient *adminServerLookupClient(virNetServer *srv,
unsigned long long id, unsigned long long id,
unsigned int flags); unsigned int flags);
int adminClientGetInfo(virNetServerClientPtr client, int adminClientGetInfo(virNetServerClient *client,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags); unsigned int flags);
int adminClientClose(virNetServerClientPtr client, int adminClientClose(virNetServerClient *client,
unsigned int flags); unsigned int flags);
int adminServerGetClientLimits(virNetServerPtr srv, int adminServerGetClientLimits(virNetServer *srv,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
unsigned int flags); unsigned int flags);
int adminServerSetClientLimits(virNetServerPtr srv, int adminServerSetClientLimits(virNetServer *srv,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams, int nparams,
unsigned int flags); unsigned int flags);
int adminServerUpdateTlsFiles(virNetServerPtr srv, int adminServerUpdateTlsFiles(virNetServer *srv,
unsigned int flags); unsigned int flags);

View File

@ -41,13 +41,12 @@
VIR_LOG_INIT("daemon.admin"); VIR_LOG_INIT("daemon.admin");
typedef struct daemonAdmClientPrivate daemonAdmClientPrivate; typedef struct daemonAdmClientPrivate daemonAdmClientPrivate;
typedef daemonAdmClientPrivate *daemonAdmClientPrivatePtr;
/* Separate private data for admin connection */ /* Separate private data for admin connection */
struct daemonAdmClientPrivate { struct daemonAdmClientPrivate {
/* Just a placeholder, not that there is anything to be locked */ /* Just a placeholder, not that there is anything to be locked */
virMutex lock; virMutex lock;
virNetDaemonPtr dmn; virNetDaemon *dmn;
}; };
void void
@ -61,7 +60,7 @@ remoteAdmClientFree(void *data)
} }
void * void *
remoteAdmClientNew(virNetServerClientPtr client G_GNUC_UNUSED, remoteAdmClientNew(virNetServerClient *client G_GNUC_UNUSED,
void *opaque) void *opaque)
{ {
struct daemonAdmClientPrivate *priv; struct daemonAdmClientPrivate *priv;
@ -106,17 +105,17 @@ remoteAdmClientNew(virNetServerClientPtr client G_GNUC_UNUSED,
return priv; return priv;
} }
void *remoteAdmClientNewPostExecRestart(virNetServerClientPtr client, void *remoteAdmClientNewPostExecRestart(virNetServerClient *client,
virJSONValuePtr object G_GNUC_UNUSED, virJSONValue *object G_GNUC_UNUSED,
void *opaque) void *opaque)
{ {
return remoteAdmClientNew(client, opaque); return remoteAdmClientNew(client, opaque);
} }
virJSONValuePtr remoteAdmClientPreExecRestart(virNetServerClientPtr client G_GNUC_UNUSED, virJSONValue *remoteAdmClientPreExecRestart(virNetServerClient *client G_GNUC_UNUSED,
void *data G_GNUC_UNUSED) void *data G_GNUC_UNUSED)
{ {
virJSONValuePtr object = virJSONValueNewObject(); virJSONValue *object = virJSONValueNewObject();
/* No content to add at this time - just need empty object */ /* No content to add at this time - just need empty object */
@ -126,28 +125,28 @@ virJSONValuePtr remoteAdmClientPreExecRestart(virNetServerClientPtr client G_GNU
/* Helpers */ /* Helpers */
static virNetServerPtr static virNetServer *
get_nonnull_server(virNetDaemonPtr dmn, admin_nonnull_server srv) get_nonnull_server(virNetDaemon *dmn, admin_nonnull_server srv)
{ {
return virNetDaemonGetServer(dmn, srv.name); return virNetDaemonGetServer(dmn, srv.name);
} }
static void static void
make_nonnull_server(admin_nonnull_server *srv_dst, make_nonnull_server(admin_nonnull_server *srv_dst,
virNetServerPtr srv_src) virNetServer *srv_src)
{ {
srv_dst->name = g_strdup(virNetServerGetName(srv_src)); srv_dst->name = g_strdup(virNetServerGetName(srv_src));
} }
static virNetServerClientPtr static virNetServerClient *
get_nonnull_client(virNetServerPtr srv, admin_nonnull_client clnt) get_nonnull_client(virNetServer *srv, admin_nonnull_client clnt)
{ {
return virNetServerGetClient(srv, clnt.id); return virNetServerGetClient(srv, clnt.id);
} }
static void static void
make_nonnull_client(admin_nonnull_client *clt_dst, make_nonnull_client(admin_nonnull_client *clt_dst,
virNetServerClientPtr clt_src) virNetServerClient *clt_src)
{ {
clt_dst->id = virNetServerClientGetID(clt_src); clt_dst->id = virNetServerClientGetID(clt_src);
clt_dst->timestamp = virNetServerClientGetTimestamp(clt_src); clt_dst->timestamp = virNetServerClientGetTimestamp(clt_src);
@ -156,10 +155,10 @@ make_nonnull_client(admin_nonnull_client *clt_dst,
/* Functions */ /* Functions */
static int static int
adminDispatchConnectOpen(virNetServerPtr server G_GNUC_UNUSED, adminDispatchConnectOpen(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
struct admin_connect_open_args *args) struct admin_connect_open_args *args)
{ {
unsigned int flags; unsigned int flags;
@ -182,17 +181,17 @@ adminDispatchConnectOpen(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchConnectClose(virNetServerPtr server G_GNUC_UNUSED, adminDispatchConnectClose(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr G_GNUC_UNUSED) struct virNetMessageError *rerr G_GNUC_UNUSED)
{ {
virNetServerClientDelayedClose(client); virNetServerClientDelayedClose(client);
return 0; return 0;
} }
static int static int
adminConnectGetLibVersion(virNetDaemonPtr dmn G_GNUC_UNUSED, adminConnectGetLibVersion(virNetDaemon *dmn G_GNUC_UNUSED,
unsigned long long *libVer) unsigned long long *libVer)
{ {
if (libVer) if (libVer)
@ -200,8 +199,8 @@ adminConnectGetLibVersion(virNetDaemonPtr dmn G_GNUC_UNUSED,
return 0; return 0;
} }
static virNetDaemonPtr static virNetDaemon *
adminGetConn(virNetServerClientPtr client) adminGetConn(virNetServerClient *client)
{ {
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client); virNetServerClientGetPrivateData(client);
@ -210,15 +209,15 @@ adminGetConn(virNetServerClientPtr client)
} }
static int static int
adminDispatchServerGetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED, adminDispatchServerGetThreadpoolParameters(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
struct admin_server_get_threadpool_parameters_args *args, struct admin_server_get_threadpool_parameters_args *args,
struct admin_server_get_threadpool_parameters_ret *ret) struct admin_server_get_threadpool_parameters_ret *ret)
{ {
int rv = -1; int rv = -1;
virNetServerPtr srv = NULL; virNetServer *srv = NULL;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
@ -233,7 +232,7 @@ adminDispatchServerGetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED,
if (virTypedParamsSerialize(params, nparams, if (virTypedParamsSerialize(params, nparams,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX, ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
(virTypedParameterRemotePtr *) &ret->params.params_val, (struct _virTypedParameterRemote **) &ret->params.params_val,
&ret->params.params_len, 0) < 0) &ret->params.params_len, 0) < 0)
goto cleanup; goto cleanup;
@ -248,14 +247,14 @@ adminDispatchServerGetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchServerSetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED, adminDispatchServerSetThreadpoolParameters(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
struct admin_server_set_threadpool_parameters_args *args) struct admin_server_set_threadpool_parameters_args *args)
{ {
int rv = -1; int rv = -1;
virNetServerPtr srv = NULL; virNetServer *srv = NULL;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
@ -268,7 +267,7 @@ adminDispatchServerSetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED,
goto cleanup; goto cleanup;
} }
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val, if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) args->params.params_val,
args->params.params_len, args->params.params_len,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX, ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
&params, &params,
@ -291,16 +290,16 @@ adminDispatchServerSetThreadpoolParameters(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchClientGetInfo(virNetServerPtr server G_GNUC_UNUSED, adminDispatchClientGetInfo(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
struct admin_client_get_info_args *args, struct admin_client_get_info_args *args,
struct admin_client_get_info_ret *ret) struct admin_client_get_info_ret *ret)
{ {
int rv = -1; int rv = -1;
virNetServerPtr srv = NULL; virNetServer *srv = NULL;
virNetServerClientPtr clnt = NULL; virNetServerClient *clnt = NULL;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
@ -325,7 +324,7 @@ adminDispatchClientGetInfo(virNetServerPtr server G_GNUC_UNUSED,
if (virTypedParamsSerialize(params, nparams, if (virTypedParamsSerialize(params, nparams,
ADMIN_CLIENT_INFO_PARAMETERS_MAX, ADMIN_CLIENT_INFO_PARAMETERS_MAX,
(virTypedParameterRemotePtr *) &ret->params.params_val, (struct _virTypedParameterRemote **) &ret->params.params_val,
&ret->params.params_len, &ret->params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0) VIR_TYPED_PARAM_STRING_OKAY) < 0)
goto cleanup; goto cleanup;
@ -343,15 +342,15 @@ adminDispatchClientGetInfo(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchServerGetClientLimits(virNetServerPtr server G_GNUC_UNUSED, adminDispatchServerGetClientLimits(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr G_GNUC_UNUSED, struct virNetMessageError *rerr G_GNUC_UNUSED,
admin_server_get_client_limits_args *args, admin_server_get_client_limits_args *args,
admin_server_get_client_limits_ret *ret) admin_server_get_client_limits_ret *ret)
{ {
int rv = -1; int rv = -1;
virNetServerPtr srv = NULL; virNetServer *srv = NULL;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
@ -365,7 +364,7 @@ adminDispatchServerGetClientLimits(virNetServerPtr server G_GNUC_UNUSED,
if (virTypedParamsSerialize(params, nparams, if (virTypedParamsSerialize(params, nparams,
ADMIN_SERVER_CLIENT_LIMITS_MAX, ADMIN_SERVER_CLIENT_LIMITS_MAX,
(virTypedParameterRemotePtr *) &ret->params.params_val, (struct _virTypedParameterRemote **) &ret->params.params_val,
&ret->params.params_len, 0) < 0) &ret->params.params_len, 0) < 0)
goto cleanup; goto cleanup;
@ -380,14 +379,14 @@ adminDispatchServerGetClientLimits(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchServerSetClientLimits(virNetServerPtr server G_GNUC_UNUSED, adminDispatchServerSetClientLimits(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client, virNetServerClient *client,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr G_GNUC_UNUSED, struct virNetMessageError *rerr G_GNUC_UNUSED,
admin_server_set_client_limits_args *args) admin_server_set_client_limits_args *args)
{ {
int rv = -1; int rv = -1;
virNetServerPtr srv = NULL; virNetServer *srv = NULL;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
struct daemonAdmClientPrivate *priv = struct daemonAdmClientPrivate *priv =
@ -400,7 +399,7 @@ adminDispatchServerSetClientLimits(virNetServerPtr server G_GNUC_UNUSED,
goto cleanup; goto cleanup;
} }
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val, if (virTypedParamsDeserialize((struct _virTypedParameterRemote *) args->params.params_val,
args->params.params_len, args->params.params_len,
ADMIN_SERVER_CLIENT_LIMITS_MAX, &params, &nparams) < 0) ADMIN_SERVER_CLIENT_LIMITS_MAX, &params, &nparams) < 0)
goto cleanup; goto cleanup;
@ -449,7 +448,7 @@ adminConnectGetLoggingFilters(char **filters, unsigned int flags)
} }
static int static int
adminConnectSetLoggingOutputs(virNetDaemonPtr dmn G_GNUC_UNUSED, adminConnectSetLoggingOutputs(virNetDaemon *dmn G_GNUC_UNUSED,
const char *outputs, const char *outputs,
unsigned int flags) unsigned int flags)
{ {
@ -459,7 +458,7 @@ adminConnectSetLoggingOutputs(virNetDaemonPtr dmn G_GNUC_UNUSED,
} }
static int static int
adminConnectSetLoggingFilters(virNetDaemonPtr dmn G_GNUC_UNUSED, adminConnectSetLoggingFilters(virNetDaemon *dmn G_GNUC_UNUSED,
const char *filters, const char *filters,
unsigned int flags) unsigned int flags)
{ {
@ -469,10 +468,10 @@ adminConnectSetLoggingFilters(virNetDaemonPtr dmn G_GNUC_UNUSED,
} }
static int static int
adminDispatchConnectGetLoggingOutputs(virNetServerPtr server G_GNUC_UNUSED, adminDispatchConnectGetLoggingOutputs(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client G_GNUC_UNUSED, virNetServerClient *client G_GNUC_UNUSED,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
admin_connect_get_logging_outputs_args *args, admin_connect_get_logging_outputs_args *args,
admin_connect_get_logging_outputs_ret *ret) admin_connect_get_logging_outputs_ret *ret)
{ {
@ -491,10 +490,10 @@ adminDispatchConnectGetLoggingOutputs(virNetServerPtr server G_GNUC_UNUSED,
} }
static int static int
adminDispatchConnectGetLoggingFilters(virNetServerPtr server G_GNUC_UNUSED, adminDispatchConnectGetLoggingFilters(virNetServer *server G_GNUC_UNUSED,
virNetServerClientPtr client G_GNUC_UNUSED, virNetServerClient *client G_GNUC_UNUSED,
virNetMessagePtr msg G_GNUC_UNUSED, virNetMessage *msg G_GNUC_UNUSED,
virNetMessageErrorPtr rerr, struct virNetMessageError *rerr,
admin_connect_get_logging_filters_args *args, admin_connect_get_logging_filters_args *args,
admin_connect_get_logging_filters_ret *ret) admin_connect_get_logging_filters_ret *ret)
{ {

View File

@ -29,9 +29,9 @@ extern virNetServerProgramProc adminProcs[];
extern size_t adminNProcs; extern size_t adminNProcs;
void remoteAdmClientFree(void *data); void remoteAdmClientFree(void *data);
void *remoteAdmClientNew(virNetServerClientPtr client, void *opaque); void *remoteAdmClientNew(virNetServerClient *client, void *opaque);
void *remoteAdmClientNewPostExecRestart(virNetServerClientPtr client, void *remoteAdmClientNewPostExecRestart(virNetServerClient *client,
virJSONValuePtr object, virJSONValue *object,
void *opaque); void *opaque);
virJSONValuePtr remoteAdmClientPreExecRestart(virNetServerClientPtr client, virJSONValue *remoteAdmClientPreExecRestart(virNetServerClient *client,
void *data); void *data);

View File

@ -97,7 +97,7 @@ virAdmInitialize(void)
} }
static char * static char *
getSocketPath(virURIPtr uri) getSocketPath(virURI *uri)
{ {
g_autofree char *rundir = virGetUserRuntimeDirectory(); g_autofree char *rundir = virGetUserRuntimeDirectory();
g_autofree char *sock_path = NULL; g_autofree char *sock_path = NULL;
@ -108,7 +108,7 @@ getSocketPath(virURIPtr uri)
for (i = 0; i < uri->paramsCount; i++) { for (i = 0; i < uri->paramsCount; i++) {
virURIParamPtr param = &uri->params[i]; virURIParam *param = &uri->params[i];
if (STREQ(param->name, "socket")) { if (STREQ(param->name, "socket")) {
g_free(sock_path); g_free(sock_path);
@ -160,7 +160,7 @@ getSocketPath(virURIPtr uri)
} }
static int static int
virAdmGetDefaultURI(virConfPtr conf, char **uristr) virAdmGetDefaultURI(virConf *conf, char **uristr)
{ {
const char *defname = getenv("LIBVIRT_ADMIN_DEFAULT_URI"); const char *defname = getenv("LIBVIRT_ADMIN_DEFAULT_URI");
if (defname && *defname) { if (defname && *defname) {
@ -381,7 +381,7 @@ int
virAdmConnectIsAlive(virAdmConnectPtr conn) virAdmConnectIsAlive(virAdmConnectPtr conn)
{ {
bool ret; bool ret;
remoteAdminPrivPtr priv = NULL; remoteAdminPriv *priv = NULL;
VIR_DEBUG("conn=%p", conn); VIR_DEBUG("conn=%p", conn);

View File

@ -40,11 +40,11 @@
VIR_LOG_INIT("bhyve.bhyve_capabilities"); VIR_LOG_INIT("bhyve.bhyve_capabilities");
virCapsPtr virCaps *
virBhyveCapsBuild(void) virBhyveCapsBuild(void)
{ {
virCapsPtr caps; virCaps *caps;
virCapsGuestPtr guest; virCapsGuest *guest;
if ((caps = virCapabilitiesNew(virArchFromHost(), if ((caps = virCapabilitiesNew(virArchFromHost(),
false, false)) == NULL) false, false)) == NULL)
@ -71,9 +71,9 @@ virBhyveCapsBuild(void)
} }
int int
virBhyveDomainCapsFill(virDomainCapsPtr caps, virBhyveDomainCapsFill(virDomainCaps *caps,
unsigned int bhyvecaps, unsigned int bhyvecaps,
virDomainCapsStringValuesPtr firmwares) virDomainCapsStringValues *firmwares)
{ {
caps->disk.supported = VIR_TRISTATE_BOOL_YES; caps->disk.supported = VIR_TRISTATE_BOOL_YES;
caps->disk.diskDevice.report = true; caps->disk.diskDevice.report = true;
@ -125,21 +125,21 @@ virBhyveDomainCapsFill(virDomainCapsPtr caps,
} }
virDomainCapsPtr virDomainCaps *
virBhyveDomainCapsBuild(bhyveConnPtr conn, virBhyveDomainCapsBuild(struct _bhyveConn *conn,
const char *emulatorbin, const char *emulatorbin,
const char *machine, const char *machine,
virArch arch, virArch arch,
virDomainVirtType virttype) virDomainVirtType virttype)
{ {
virDomainCapsPtr caps = NULL; virDomainCaps *caps = NULL;
unsigned int bhyve_caps = 0; unsigned int bhyve_caps = 0;
g_autoptr(DIR) dir = NULL; g_autoptr(DIR) dir = NULL;
struct dirent *entry; struct dirent *entry;
size_t firmwares_alloc = 0; size_t firmwares_alloc = 0;
virBhyveDriverConfigPtr cfg = virBhyveDriverGetConfig(conn); struct _virBhyveDriverConfig *cfg = virBhyveDriverGetConfig(conn);
const char *firmware_dir = cfg->firmwareDir; const char *firmware_dir = cfg->firmwareDir;
virDomainCapsStringValuesPtr firmwares = NULL; virDomainCapsStringValues *firmwares = NULL;
if (!(caps = virDomainCapsNew(emulatorbin, machine, arch, virttype))) if (!(caps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
goto cleanup; goto cleanup;
@ -176,7 +176,7 @@ int
virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps) virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps)
{ {
char *binary, *help; char *binary, *help;
virCommandPtr cmd; virCommand *cmd;
int ret, exit; int ret, exit;
ret = 0; ret = 0;
@ -215,7 +215,7 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps,
unsigned int flag) unsigned int flag)
{ {
char *error; char *error;
virCommandPtr cmd = NULL; virCommand *cmd = NULL;
int ret = -1, exit; int ret = -1, exit;
cmd = virCommandNew(binary); cmd = virCommandNew(binary);
@ -238,7 +238,7 @@ static int
bhyveProbeCapsFromHelp(unsigned int *caps, char *binary) bhyveProbeCapsFromHelp(unsigned int *caps, char *binary)
{ {
char *help; char *help;
virCommandPtr cmd = NULL; virCommand *cmd = NULL;
int ret = 0, exit; int ret = 0, exit;
cmd = virCommandNew(binary); cmd = virCommandNew(binary);

View File

@ -26,15 +26,15 @@
#include "bhyve_utils.h" #include "bhyve_utils.h"
virCapsPtr virBhyveCapsBuild(void); virCaps *virBhyveCapsBuild(void);
int virBhyveDomainCapsFill(virDomainCapsPtr caps, int virBhyveDomainCapsFill(virDomainCaps *caps,
unsigned int bhyvecaps, unsigned int bhyvecaps,
virDomainCapsStringValuesPtr firmwares); virDomainCapsStringValues *firmwares);
virDomainCapsPtr virBhyveDomainCapsBuild(bhyveConnPtr, virDomainCaps *virBhyveDomainCapsBuild(bhyveConn *conn,
const char *emulatorbin, const char *emulatorbin,
const char *machine, const char *machine,
virArch arch, virArch arch,
virDomainVirtType virttype); virDomainVirtType virttype);
/* These are bit flags: */ /* These are bit flags: */
typedef enum { typedef enum {

View File

@ -41,9 +41,9 @@ VIR_LOG_INIT("bhyve.bhyve_command");
static int static int
bhyveBuildNetArgStr(const virDomainDef *def, bhyveBuildNetArgStr(const virDomainDef *def,
virDomainNetDefPtr net, virDomainNetDef *net,
bhyveConnPtr driver, struct _bhyveConn *driver,
virCommandPtr cmd, virCommand *cmd,
bool dryRun) bool dryRun)
{ {
char macaddr[VIR_MAC_STRING_BUFLEN]; char macaddr[VIR_MAC_STRING_BUFLEN];
@ -124,9 +124,9 @@ bhyveBuildNetArgStr(const virDomainDef *def,
} }
static int static int
bhyveBuildConsoleArgStr(const virDomainDef *def, virCommandPtr cmd) bhyveBuildConsoleArgStr(const virDomainDef *def, virCommand *cmd)
{ {
virDomainChrDefPtr chr = NULL; virDomainChrDef *chr = NULL;
if (!def->nserials) if (!def->nserials)
return 0; return 0;
@ -155,9 +155,9 @@ bhyveBuildConsoleArgStr(const virDomainDef *def, virCommandPtr cmd)
static int static int
bhyveBuildAHCIControllerArgStr(const virDomainDef *def, bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
virDomainControllerDefPtr controller, virDomainControllerDef *controller,
bhyveConnPtr driver, struct _bhyveConn *driver,
virCommandPtr cmd) virCommand *cmd)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *disk_source; const char *disk_source;
@ -165,7 +165,7 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
g_auto(virBuffer) device = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) device = VIR_BUFFER_INITIALIZER;
virDomainDiskDefPtr disk = def->disks[i]; virDomainDiskDef *disk = def->disks[i];
if (disk->bus != VIR_DOMAIN_DISK_BUS_SATA) if (disk->bus != VIR_DOMAIN_DISK_BUS_SATA)
continue; continue;
@ -226,14 +226,14 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
static int static int
bhyveBuildUSBControllerArgStr(const virDomainDef *def, bhyveBuildUSBControllerArgStr(const virDomainDef *def,
virDomainControllerDefPtr controller, virDomainControllerDef *controller,
virCommandPtr cmd) virCommand *cmd)
{ {
size_t i; size_t i;
int ndevices = 0; int ndevices = 0;
for (i = 0; i < def->ninputs; i++) { for (i = 0; i < def->ninputs; i++) {
virDomainInputDefPtr input = def->inputs[i]; virDomainInputDef *input = def->inputs[i];
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB) { if (input->bus != VIR_DOMAIN_INPUT_BUS_USB) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -265,8 +265,8 @@ bhyveBuildUSBControllerArgStr(const virDomainDef *def,
static int static int
bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_GNUC_UNUSED, bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_GNUC_UNUSED,
virDomainDiskDefPtr disk, virDomainDiskDef *disk,
virCommandPtr cmd) virCommand *cmd)
{ {
const char *disk_source; const char *disk_source;
@ -298,8 +298,8 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_GNUC_UNUSED,
static int static int
bhyveBuildDiskArgStr(const virDomainDef *def, bhyveBuildDiskArgStr(const virDomainDef *def,
virDomainDiskDefPtr disk, virDomainDiskDef *disk,
virCommandPtr cmd) virCommand *cmd)
{ {
switch (disk->bus) { switch (disk->bus) {
case VIR_DOMAIN_DISK_BUS_SATA: case VIR_DOMAIN_DISK_BUS_SATA:
@ -319,9 +319,9 @@ bhyveBuildDiskArgStr(const virDomainDef *def,
static int static int
bhyveBuildControllerArgStr(const virDomainDef *def, bhyveBuildControllerArgStr(const virDomainDef *def,
virDomainControllerDefPtr controller, virDomainControllerDef *controller,
bhyveConnPtr driver, struct _bhyveConn *driver,
virCommandPtr cmd, virCommand *cmd,
unsigned *nusbcontrollers, unsigned *nusbcontrollers,
unsigned *nisacontrollers) unsigned *nisacontrollers)
{ {
@ -364,14 +364,14 @@ bhyveBuildControllerArgStr(const virDomainDef *def,
static int static int
bhyveBuildGraphicsArgStr(const virDomainDef *def, bhyveBuildGraphicsArgStr(const virDomainDef *def,
virDomainGraphicsDefPtr graphics, virDomainGraphicsDef *graphics,
virDomainVideoDefPtr video, virDomainVideoDef *video,
bhyveConnPtr driver, struct _bhyveConn *driver,
virCommandPtr cmd, virCommand *cmd,
bool dryRun) bool dryRun)
{ {
g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr glisten = NULL; virDomainGraphicsListenDef *glisten = NULL;
bool escapeAddr; bool escapeAddr;
unsigned short port; unsigned short port;
@ -487,10 +487,10 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
static int static int
bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED, bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED,
virDomainSoundDefPtr sound, virDomainSoundDef *sound,
virDomainAudioDefPtr audio, virDomainAudioDef *audio,
bhyveConnPtr driver, struct _bhyveConn *driver,
virCommandPtr cmd) virCommand *cmd)
{ {
g_auto(virBuffer) params = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) params = VIR_BUFFER_INITIALIZER;
@ -560,8 +560,8 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED,
static int static int
bhyveBuildFSArgStr(const virDomainDef *def G_GNUC_UNUSED, bhyveBuildFSArgStr(const virDomainDef *def G_GNUC_UNUSED,
virDomainFSDefPtr fs, virDomainFSDef *fs,
virCommandPtr cmd) virCommand *cmd)
{ {
g_auto(virBuffer) params = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) params = VIR_BUFFER_INITIALIZER;
@ -625,8 +625,8 @@ bhyveBuildFSArgStr(const virDomainDef *def G_GNUC_UNUSED,
return 0; return 0;
} }
virCommandPtr virCommand *
virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def, virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def,
bool dryRun) bool dryRun)
{ {
/* /*
@ -637,7 +637,7 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
* -S 31,uart,stdio \ * -S 31,uart,stdio \
* vm0 * vm0
*/ */
virCommandPtr cmd = virCommandNew(BHYVE); virCommand *cmd = virCommandNew(BHYVE);
size_t i; size_t i;
unsigned nusbcontrollers = 0; unsigned nusbcontrollers = 0;
unsigned nisacontrollers = 0; unsigned nisacontrollers = 0;
@ -786,7 +786,7 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
goto error; goto error;
if (def->namespaceData) { if (def->namespaceData) {
bhyveDomainCmdlineDefPtr bhyvecmd; bhyveDomainCmdlineDef *bhyvecmd;
VIR_WARN("Booting the guest using command line pass-through feature, " VIR_WARN("Booting the guest using command line pass-through feature, "
"which could potentially cause inconsistent state and " "which could potentially cause inconsistent state and "
@ -806,11 +806,11 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def,
return NULL; return NULL;
} }
virCommandPtr virCommand *
virBhyveProcessBuildDestroyCmd(bhyveConnPtr driver G_GNUC_UNUSED, virBhyveProcessBuildDestroyCmd(struct _bhyveConn *driver G_GNUC_UNUSED,
virDomainDefPtr def) virDomainDef *def)
{ {
virCommandPtr cmd = virCommandNew(BHYVECTL); virCommand *cmd = virCommandNew(BHYVECTL);
virCommandAddArg(cmd, "--destroy"); virCommandAddArg(cmd, "--destroy");
virCommandAddArgPair(cmd, "--vm", def->name); virCommandAddArgPair(cmd, "--vm", def->name);
@ -819,7 +819,7 @@ virBhyveProcessBuildDestroyCmd(bhyveConnPtr driver G_GNUC_UNUSED,
} }
static void static void
virAppendBootloaderArgs(virCommandPtr cmd, virDomainDefPtr def) virAppendBootloaderArgs(virCommand *cmd, virDomainDef *def)
{ {
char **blargs; char **blargs;
@ -829,10 +829,10 @@ virAppendBootloaderArgs(virCommandPtr cmd, virDomainDefPtr def)
g_strfreev(blargs); g_strfreev(blargs);
} }
static virCommandPtr static virCommand *
virBhyveProcessBuildBhyveloadCmd(virDomainDefPtr def, virDomainDiskDefPtr disk) virBhyveProcessBuildBhyveloadCmd(virDomainDef *def, virDomainDiskDef *disk)
{ {
virCommandPtr cmd; virCommand *cmd;
cmd = virCommandNew(BHYVELOAD); cmd = virCommandNew(BHYVELOAD);
@ -858,10 +858,10 @@ virBhyveProcessBuildBhyveloadCmd(virDomainDefPtr def, virDomainDiskDefPtr disk)
return cmd; return cmd;
} }
static virCommandPtr static virCommand *
virBhyveProcessBuildCustomLoaderCmd(virDomainDefPtr def) virBhyveProcessBuildCustomLoaderCmd(virDomainDef *def)
{ {
virCommandPtr cmd; virCommand *cmd;
if (def->os.bootloaderArgs == NULL) { if (def->os.bootloaderArgs == NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@ -878,7 +878,7 @@ virBhyveProcessBuildCustomLoaderCmd(virDomainDefPtr def)
} }
static bool static bool
virBhyveUsableDisk(virDomainDiskDefPtr disk) virBhyveUsableDisk(virDomainDiskDef *disk)
{ {
if (virDomainDiskTranslateSourcePool(disk) < 0) if (virDomainDiskTranslateSourcePool(disk) < 0)
return false; return false;
@ -901,7 +901,7 @@ virBhyveUsableDisk(virDomainDiskDefPtr disk)
} }
static void static void
virBhyveFormatGrubDevice(virBufferPtr devicemap, virDomainDiskDefPtr def) virBhyveFormatGrubDevice(virBuffer *devicemap, virDomainDiskDef *def)
{ {
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
virBufferAsprintf(devicemap, "(cd) %s\n", virBufferAsprintf(devicemap, "(cd) %s\n",
@ -911,17 +911,17 @@ virBhyveFormatGrubDevice(virBufferPtr devicemap, virDomainDiskDefPtr def)
virDomainDiskGetSource(def)); virDomainDiskGetSource(def));
} }
static virCommandPtr static virCommand *
virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def, virBhyveProcessBuildGrubbhyveCmd(virDomainDef *def,
bhyveConnPtr driver, struct _bhyveConn *driver,
const char *devmap_file, const char *devmap_file,
char **devicesmap_out) char **devicesmap_out)
{ {
virDomainDiskDefPtr hdd; virDomainDiskDef *hdd;
virDomainDiskDefPtr cd; virDomainDiskDef *cd;
virDomainDiskDefPtr userdef; virDomainDiskDef *userdef;
virDomainDiskDefPtr diskdef; virDomainDiskDef *diskdef;
virCommandPtr cmd; virCommand *cmd;
unsigned int best_idx = UINT_MAX; unsigned int best_idx = UINT_MAX;
size_t i; size_t i;
@ -1000,7 +1000,7 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def,
if ((bhyveDriverGetGrubCaps(driver) & BHYVE_GRUB_CAP_CONSDEV) != 0 && if ((bhyveDriverGetGrubCaps(driver) & BHYVE_GRUB_CAP_CONSDEV) != 0 &&
def->nserials > 0) { def->nserials > 0) {
virDomainChrDefPtr chr; virDomainChrDef *chr;
chr = def->serials[0]; chr = def->serials[0];
@ -1020,11 +1020,11 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def,
return cmd; return cmd;
} }
static virDomainDiskDefPtr static virDomainDiskDef *
virBhyveGetBootDisk(virDomainDefPtr def) virBhyveGetBootDisk(virDomainDef *def)
{ {
size_t i; size_t i;
virDomainDiskDefPtr match = NULL; virDomainDiskDef *match = NULL;
int boot_dev = -1; int boot_dev = -1;
if (def->ndisks < 1) { if (def->ndisks < 1) {
@ -1106,11 +1106,11 @@ virBhyveGetBootDisk(virDomainDefPtr def)
return match; return match;
} }
virCommandPtr virCommand *
virBhyveProcessBuildLoadCmd(bhyveConnPtr driver, virDomainDefPtr def, virBhyveProcessBuildLoadCmd(struct _bhyveConn *driver, virDomainDef *def,
const char *devmap_file, char **devicesmap_out) const char *devmap_file, char **devicesmap_out)
{ {
virDomainDiskDefPtr disk = NULL; virDomainDiskDef *disk = NULL;
if (def->os.bootloader == NULL) { if (def->os.bootloader == NULL) {
disk = virBhyveGetBootDisk(def); disk = virBhyveGetBootDisk(def);

View File

@ -29,14 +29,14 @@
#define BHYVE_CONFIG_FORMAT_ARGV "bhyve-argv" #define BHYVE_CONFIG_FORMAT_ARGV "bhyve-argv"
virCommandPtr virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virCommand *virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver,
virDomainDefPtr def, virDomainDef *def,
bool dryRun); bool dryRun);
virCommandPtr virCommand *
virBhyveProcessBuildDestroyCmd(bhyveConnPtr driver, virBhyveProcessBuildDestroyCmd(struct _bhyveConn *driver,
virDomainDefPtr def); virDomainDef *def);
virCommandPtr virCommand *
virBhyveProcessBuildLoadCmd(bhyveConnPtr driver, virDomainDefPtr def, virBhyveProcessBuildLoadCmd(struct _bhyveConn *driver, virDomainDef *def,
const char *devmap_file, char **devicesmap_out); const char *devmap_file, char **devicesmap_out);

View File

@ -32,7 +32,7 @@
VIR_LOG_INIT("bhyve.bhyve_conf"); VIR_LOG_INIT("bhyve.bhyve_conf");
static virClassPtr virBhyveDriverConfigClass; static virClass *virBhyveDriverConfigClass;
static void virBhyveDriverConfigDispose(void *obj); static void virBhyveDriverConfigDispose(void *obj);
static int virBhyveConfigOnceInit(void) static int virBhyveConfigOnceInit(void)
@ -45,10 +45,10 @@ static int virBhyveConfigOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virBhyveConfig); VIR_ONCE_GLOBAL_INIT(virBhyveConfig);
virBhyveDriverConfigPtr struct _virBhyveDriverConfig *
virBhyveDriverConfigNew(void) virBhyveDriverConfigNew(void)
{ {
virBhyveDriverConfigPtr cfg; struct _virBhyveDriverConfig *cfg;
if (virBhyveConfigInitialize() < 0) if (virBhyveConfigInitialize() < 0)
return NULL; return NULL;
@ -62,7 +62,7 @@ virBhyveDriverConfigNew(void)
} }
int int
virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg, virBhyveLoadDriverConfig(struct _virBhyveDriverConfig *cfg,
const char *filename) const char *filename)
{ {
g_autoptr(virConf) conf = NULL; g_autoptr(virConf) conf = NULL;
@ -82,10 +82,10 @@ virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg,
return 0; return 0;
} }
virBhyveDriverConfigPtr struct _virBhyveDriverConfig *
virBhyveDriverGetConfig(bhyveConnPtr driver) virBhyveDriverGetConfig(struct _bhyveConn *driver)
{ {
virBhyveDriverConfigPtr cfg; struct _virBhyveDriverConfig *cfg;
bhyveDriverLock(driver); bhyveDriverLock(driver);
cfg = virObjectRef(driver->config); cfg = virObjectRef(driver->config);
bhyveDriverUnlock(driver); bhyveDriverUnlock(driver);
@ -95,13 +95,13 @@ virBhyveDriverGetConfig(bhyveConnPtr driver)
static void static void
virBhyveDriverConfigDispose(void *obj) virBhyveDriverConfigDispose(void *obj)
{ {
virBhyveDriverConfigPtr cfg = obj; struct _virBhyveDriverConfig *cfg = obj;
g_free(cfg->firmwareDir); g_free(cfg->firmwareDir);
} }
void void
bhyveDomainCmdlineDefFree(bhyveDomainCmdlineDefPtr def) bhyveDomainCmdlineDefFree(bhyveDomainCmdlineDef *def)
{ {
size_t i; size_t i;

View File

@ -23,16 +23,15 @@
#include "bhyve_utils.h" #include "bhyve_utils.h"
virBhyveDriverConfigPtr virBhyveDriverConfigNew(void); struct _virBhyveDriverConfig *virBhyveDriverConfigNew(void);
virBhyveDriverConfigPtr virBhyveDriverGetConfig(bhyveConnPtr driver); struct _virBhyveDriverConfig *virBhyveDriverGetConfig(struct _bhyveConn *driver);
int virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg, int virBhyveLoadDriverConfig(struct _virBhyveDriverConfig *cfg,
const char *filename); const char *filename);
typedef struct _bhyveDomainCmdlineDef bhyveDomainCmdlineDef; typedef struct _bhyveDomainCmdlineDef bhyveDomainCmdlineDef;
typedef bhyveDomainCmdlineDef *bhyveDomainCmdlineDefPtr;
struct _bhyveDomainCmdlineDef { struct _bhyveDomainCmdlineDef {
size_t num_args; size_t num_args;
char **args; char **args;
}; };
void bhyveDomainCmdlineDefFree(bhyveDomainCmdlineDefPtr def); void bhyveDomainCmdlineDefFree(bhyveDomainCmdlineDef *def);

View File

@ -31,16 +31,16 @@
VIR_LOG_INIT("bhyve.bhyve_device"); VIR_LOG_INIT("bhyve.bhyve_device");
static int static int
bhyveCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED, bhyveCollectPCIAddress(virDomainDef *def G_GNUC_UNUSED,
virDomainDeviceDefPtr device G_GNUC_UNUSED, virDomainDeviceDef *device G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *opaque) void *opaque)
{ {
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE)
return 0; return 0;
virDomainPCIAddressSetPtr addrs = opaque; virDomainPCIAddressSet *addrs = opaque;
virPCIDeviceAddressPtr addr = &info->addr.pci; virPCIDeviceAddress *addr = &info->addr.pci;
if (addr->domain == 0 && addr->bus == 0 && addr->slot == 0) { if (addr->domain == 0 && addr->bus == 0 && addr->slot == 0) {
return 0; return 0;
@ -54,10 +54,10 @@ bhyveCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED,
return 0; return 0;
} }
virDomainPCIAddressSetPtr virDomainPCIAddressSet *
bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, unsigned int nbuses) bhyveDomainPCIAddressSetCreate(virDomainDef *def, unsigned int nbuses)
{ {
virDomainPCIAddressSetPtr addrs; virDomainPCIAddressSet *addrs;
if ((addrs = virDomainPCIAddressSetAlloc(nbuses, if ((addrs = virDomainPCIAddressSetAlloc(nbuses,
VIR_PCI_ADDRESS_EXTENSION_NONE)) == NULL) VIR_PCI_ADDRESS_EXTENSION_NONE)) == NULL)
@ -79,8 +79,8 @@ bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, unsigned int nbuses)
} }
static int static int
bhyveAssignDevicePCISlots(virDomainDefPtr def, bhyveAssignDevicePCISlots(virDomainDef *def,
virDomainPCIAddressSetPtr addrs) virDomainPCIAddressSet *addrs)
{ {
size_t i; size_t i;
virPCIDeviceAddress lpc_addr; virPCIDeviceAddress lpc_addr;
@ -188,11 +188,11 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
return 0; return 0;
} }
int bhyveDomainAssignPCIAddresses(virDomainDefPtr def, int bhyveDomainAssignPCIAddresses(virDomainDef *def,
virDomainObjPtr obj) virDomainObj *obj)
{ {
virDomainPCIAddressSetPtr addrs = NULL; virDomainPCIAddressSet *addrs = NULL;
bhyveDomainObjPrivatePtr priv = NULL; bhyveDomainObjPrivate *priv = NULL;
if (!(addrs = bhyveDomainPCIAddressSetCreate(def, 1))) if (!(addrs = bhyveDomainPCIAddressSetCreate(def, 1)))
return -1; return -1;
@ -214,7 +214,7 @@ int bhyveDomainAssignPCIAddresses(virDomainDefPtr def,
return 0; return 0;
} }
int bhyveDomainAssignAddresses(virDomainDefPtr def, virDomainObjPtr obj) int bhyveDomainAssignAddresses(virDomainDef *def, virDomainObj *obj)
{ {
return bhyveDomainAssignPCIAddresses(def, obj); return bhyveDomainAssignPCIAddresses(def, obj);
} }

View File

@ -24,10 +24,10 @@
#include "virpci.h" #include "virpci.h"
#include "bhyve_domain.h" #include "bhyve_domain.h"
int bhyveDomainAssignPCIAddresses(virDomainDefPtr def, virDomainObjPtr obj); int bhyveDomainAssignPCIAddresses(virDomainDef *def, virDomainObj *obj);
virDomainPCIAddressSetPtr bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, virDomainPCIAddressSet *bhyveDomainPCIAddressSetCreate(virDomainDef *def,
unsigned int nbuses); unsigned int nbuses);
int bhyveDomainAssignAddresses(virDomainDefPtr def, virDomainObjPtr obj) int bhyveDomainAssignAddresses(virDomainDef *def, virDomainObj *obj)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);

View File

@ -36,7 +36,7 @@ VIR_LOG_INIT("bhyve.bhyve_domain");
static void * static void *
bhyveDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED) bhyveDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED)
{ {
bhyveDomainObjPrivatePtr priv; bhyveDomainObjPrivate *priv;
priv = g_new0(bhyveDomainObjPrivate, 1); priv = g_new0(bhyveDomainObjPrivate, 1);
@ -46,7 +46,7 @@ bhyveDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED)
static void static void
bhyveDomainObjPrivateFree(void *data) bhyveDomainObjPrivateFree(void *data)
{ {
bhyveDomainObjPrivatePtr priv = data; bhyveDomainObjPrivate *priv = data;
virDomainPCIAddressSetFree(priv->pciaddrs); virDomainPCIAddressSetFree(priv->pciaddrs);
@ -59,7 +59,7 @@ virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks = {
}; };
static bool static bool
bhyveDomainDefNeedsISAController(virDomainDefPtr def) bhyveDomainDefNeedsISAController(virDomainDef *def)
{ {
if (def->os.bootloader == NULL && def->os.loader) if (def->os.bootloader == NULL && def->os.loader)
return true; return true;
@ -77,12 +77,12 @@ bhyveDomainDefNeedsISAController(virDomainDefPtr def)
} }
static int static int
bhyveDomainDefPostParse(virDomainDefPtr def, bhyveDomainDefPostParse(virDomainDef *def,
unsigned int parseFlags G_GNUC_UNUSED, unsigned int parseFlags G_GNUC_UNUSED,
void *opaque, void *opaque,
void *parseOpaque G_GNUC_UNUSED) void *parseOpaque G_GNUC_UNUSED)
{ {
bhyveConnPtr driver = opaque; struct _bhyveConn *driver = opaque;
g_autoptr(virCaps) caps = bhyveDriverGetCapabilities(driver); g_autoptr(virCaps) caps = bhyveDriverGetCapabilities(driver);
if (!caps) if (!caps)
return -1; return -1;
@ -106,8 +106,8 @@ bhyveDomainDefPostParse(virDomainDefPtr def,
} }
static int static int
bhyveDomainDiskDefAssignAddress(bhyveConnPtr driver, bhyveDomainDiskDefAssignAddress(struct _bhyveConn *driver,
virDomainDiskDefPtr def, virDomainDiskDef *def,
const virDomainDef *vmdef G_GNUC_UNUSED) const virDomainDef *vmdef G_GNUC_UNUSED)
{ {
int idx = virDiskNameToIndex(def->dst); int idx = virDiskNameToIndex(def->dst);
@ -138,16 +138,16 @@ bhyveDomainDiskDefAssignAddress(bhyveConnPtr driver,
} }
static int static int
bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, bhyveDomainDeviceDefPostParse(virDomainDeviceDef *dev,
const virDomainDef *def, const virDomainDef *def,
unsigned int parseFlags G_GNUC_UNUSED, unsigned int parseFlags G_GNUC_UNUSED,
void *opaque, void *opaque,
void *parseOpaque G_GNUC_UNUSED) void *parseOpaque G_GNUC_UNUSED)
{ {
bhyveConnPtr driver = opaque; struct _bhyveConn *driver = opaque;
if (dev->type == VIR_DOMAIN_DEVICE_DISK) { if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
virDomainDiskDefPtr disk = dev->data.disk; virDomainDiskDef *disk = dev->data.disk;
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
bhyveDomainDiskDefAssignAddress(driver, disk, def) < 0) bhyveDomainDiskDefAssignAddress(driver, disk, def) < 0)
@ -155,7 +155,7 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
} }
if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) { if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
virDomainControllerDefPtr cont = dev->data.controller; virDomainControllerDef *cont = dev->data.controller;
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI && if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
(cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
@ -175,7 +175,7 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_CHR && if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
dev->data.chr->source->type == VIR_DOMAIN_CHR_TYPE_NMDM) { dev->data.chr->source->type == VIR_DOMAIN_CHR_TYPE_NMDM) {
virDomainChrDefPtr chr = dev->data.chr; virDomainChrDef *chr = dev->data.chr;
if (!chr->source->data.nmdm.master) { if (!chr->source->data.nmdm.master) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -202,8 +202,8 @@ bhyveDomainDefAssignAddresses(virDomainDef *def,
return 0; return 0;
} }
virDomainXMLOptionPtr virDomainXMLOption *
virBhyveDriverCreateXMLConf(bhyveConnPtr driver) virBhyveDriverCreateXMLConf(struct _bhyveConn *driver)
{ {
virBhyveDriverDomainDefParserConfig.priv = driver; virBhyveDriverDomainDefParserConfig.priv = driver;
return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig, return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
@ -240,7 +240,7 @@ virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
static void static void
bhyveDomainDefNamespaceFree(void *nsdata) bhyveDomainDefNamespaceFree(void *nsdata)
{ {
bhyveDomainCmdlineDefPtr cmd = nsdata; bhyveDomainCmdlineDef *cmd = nsdata;
bhyveDomainCmdlineDefFree(cmd); bhyveDomainCmdlineDefFree(cmd);
} }
@ -249,7 +249,7 @@ static int
bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt, bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
void **data) void **data)
{ {
bhyveDomainCmdlineDefPtr cmd = NULL; bhyveDomainCmdlineDef *cmd = NULL;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int n; int n;
size_t i; size_t i;
@ -286,10 +286,10 @@ bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
} }
static int static int
bhyveDomainDefNamespaceFormatXML(virBufferPtr buf, bhyveDomainDefNamespaceFormatXML(virBuffer *buf,
void *nsdata) void *nsdata)
{ {
bhyveDomainCmdlineDefPtr cmd = nsdata; bhyveDomainCmdlineDef *cmd = nsdata;
size_t i; size_t i;
if (!cmd->num_args) if (!cmd->num_args)

View File

@ -26,15 +26,14 @@
#include "bhyve_monitor.h" #include "bhyve_monitor.h"
typedef struct _bhyveDomainObjPrivate bhyveDomainObjPrivate; typedef struct _bhyveDomainObjPrivate bhyveDomainObjPrivate;
typedef bhyveDomainObjPrivate *bhyveDomainObjPrivatePtr;
struct _bhyveDomainObjPrivate { struct _bhyveDomainObjPrivate {
virDomainPCIAddressSetPtr pciaddrs; virDomainPCIAddressSet *pciaddrs;
bool persistentAddrs; bool persistentAddrs;
bhyveMonitorPtr mon; bhyveMonitor *mon;
}; };
virDomainXMLOptionPtr virBhyveDriverCreateXMLConf(bhyveConnPtr); virDomainXMLOption *virBhyveDriverCreateXMLConf(struct _bhyveConn *);
extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks; extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig; extern virDomainDefParserConfig virBhyveDriverDomainDefParserConfig;

View File

@ -68,22 +68,22 @@
VIR_LOG_INIT("bhyve.bhyve_driver"); VIR_LOG_INIT("bhyve.bhyve_driver");
bhyveConnPtr bhyve_driver = NULL; struct _bhyveConn *bhyve_driver = NULL;
void void
bhyveDriverLock(bhyveConnPtr driver) bhyveDriverLock(struct _bhyveConn *driver)
{ {
virMutexLock(&driver->lock); virMutexLock(&driver->lock);
} }
void void
bhyveDriverUnlock(bhyveConnPtr driver) bhyveDriverUnlock(struct _bhyveConn *driver)
{ {
virMutexUnlock(&driver->lock); virMutexUnlock(&driver->lock);
} }
static int static int
bhyveAutostartDomain(virDomainObjPtr vm, void *opaque) bhyveAutostartDomain(virDomainObj *vm, void *opaque)
{ {
const struct bhyveAutostartData *data = opaque; const struct bhyveAutostartData *data = opaque;
int ret = 0; int ret = 0;
@ -103,7 +103,7 @@ bhyveAutostartDomain(virDomainObjPtr vm, void *opaque)
} }
static void static void
bhyveAutostartDomains(bhyveConnPtr driver) bhyveAutostartDomains(struct _bhyveConn *driver)
{ {
/* XXX: Figure out a better way todo this. The domain /* XXX: Figure out a better way todo this. The domain
* startup code needs a connection handle in order * startup code needs a connection handle in order
@ -123,15 +123,15 @@ bhyveAutostartDomains(bhyveConnPtr driver)
/** /**
* bhyveDriverGetCapabilities: * bhyveDriverGetCapabilities:
* *
* Get a reference to the virCapsPtr instance for the * Get a reference to the virCaps *instance for the
* driver. * driver.
* *
* The caller must release the reference with virObjetUnref * The caller must release the reference with virObjetUnref
* *
* Returns: a reference to a virCapsPtr instance or NULL * Returns: a reference to a virCaps *instance or NULL
*/ */
virCapsPtr ATTRIBUTE_NONNULL(1) virCaps *ATTRIBUTE_NONNULL(1)
bhyveDriverGetCapabilities(bhyveConnPtr driver) bhyveDriverGetCapabilities(struct _bhyveConn *driver)
{ {
return virObjectRef(driver->caps); return virObjectRef(driver->caps);
} }
@ -139,8 +139,8 @@ bhyveDriverGetCapabilities(bhyveConnPtr driver)
static char * static char *
bhyveConnectGetCapabilities(virConnectPtr conn) bhyveConnectGetCapabilities(virConnectPtr conn)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virCapsPtr caps; virCaps *caps;
char *xml = NULL; char *xml = NULL;
if (virConnectGetCapabilitiesEnsureACL(conn) < 0) if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
@ -160,11 +160,11 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
return xml; return xml;
} }
static virDomainObjPtr static virDomainObj *
bhyveDomObjFromDomain(virDomainPtr domain) bhyveDomObjFromDomain(virDomainPtr domain)
{ {
virDomainObjPtr vm; virDomainObj *vm;
bhyveConnPtr privconn = domain->conn->privateData; struct _bhyveConn *privconn = domain->conn->privateData;
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
vm = virDomainObjListFindByUUID(privconn->domains, domain->uuid); vm = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
@ -194,7 +194,7 @@ bhyveConnectURIProbe(char **uri)
static virDrvOpenStatus static virDrvOpenStatus
bhyveConnectOpen(virConnectPtr conn, bhyveConnectOpen(virConnectPtr conn,
virConnectAuthPtr auth G_GNUC_UNUSED, virConnectAuthPtr auth G_GNUC_UNUSED,
virConfPtr conf G_GNUC_UNUSED, virConf *conf G_GNUC_UNUSED,
unsigned int flags) unsigned int flags)
{ {
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
@ -223,7 +223,7 @@ bhyveConnectOpen(virConnectPtr conn,
static int static int
bhyveConnectClose(virConnectPtr conn) bhyveConnectClose(virConnectPtr conn)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virCloseCallbacksRun(privconn->closeCallbacks, conn, privconn->domains, privconn); virCloseCallbacksRun(privconn->closeCallbacks, conn, privconn->domains, privconn);
conn->privateData = NULL; conn->privateData = NULL;
@ -243,7 +243,7 @@ bhyveConnectGetHostname(virConnectPtr conn)
static char * static char *
bhyveConnectGetSysinfo(virConnectPtr conn, unsigned int flags) bhyveConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
@ -285,7 +285,7 @@ bhyveConnectGetVersion(virConnectPtr conn, unsigned long *version)
static int static int
bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) bhyveDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
{ {
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
if (!(vm = bhyveDomObjFromDomain(domain))) if (!(vm = bhyveDomObjFromDomain(domain)))
@ -317,7 +317,7 @@ bhyveDomainGetState(virDomainPtr domain,
int *reason, int *reason,
unsigned int flags) unsigned int flags)
{ {
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -339,7 +339,7 @@ bhyveDomainGetState(virDomainPtr domain,
static int static int
bhyveDomainGetAutostart(virDomainPtr domain, int *autostart) bhyveDomainGetAutostart(virDomainPtr domain, int *autostart)
{ {
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
if (!(vm = bhyveDomObjFromDomain(domain))) if (!(vm = bhyveDomObjFromDomain(domain)))
@ -359,7 +359,7 @@ bhyveDomainGetAutostart(virDomainPtr domain, int *autostart)
static int static int
bhyveDomainSetAutostart(virDomainPtr domain, int autostart) bhyveDomainSetAutostart(virDomainPtr domain, int autostart)
{ {
virDomainObjPtr vm; virDomainObj *vm;
char *configFile = NULL; char *configFile = NULL;
char *autostartLink = NULL; char *autostartLink = NULL;
int ret = -1; int ret = -1;
@ -422,7 +422,7 @@ bhyveDomainSetAutostart(virDomainPtr domain, int autostart)
static int static int
bhyveDomainIsActive(virDomainPtr domain) bhyveDomainIsActive(virDomainPtr domain)
{ {
virDomainObjPtr obj; virDomainObj *obj;
int ret = -1; int ret = -1;
if (!(obj = bhyveDomObjFromDomain(domain))) if (!(obj = bhyveDomObjFromDomain(domain)))
@ -441,7 +441,7 @@ bhyveDomainIsActive(virDomainPtr domain)
static int static int
bhyveDomainIsPersistent(virDomainPtr domain) bhyveDomainIsPersistent(virDomainPtr domain)
{ {
virDomainObjPtr obj; virDomainObj *obj;
int ret = -1; int ret = -1;
if (!(obj = bhyveDomObjFromDomain(domain))) if (!(obj = bhyveDomObjFromDomain(domain)))
@ -460,7 +460,7 @@ bhyveDomainIsPersistent(virDomainPtr domain)
static char * static char *
bhyveDomainGetOSType(virDomainPtr dom) bhyveDomainGetOSType(virDomainPtr dom)
{ {
virDomainObjPtr vm; virDomainObj *vm;
char *ret = NULL; char *ret = NULL;
if (!(vm = bhyveDomObjFromDomain(dom))) if (!(vm = bhyveDomObjFromDomain(dom)))
@ -479,8 +479,8 @@ bhyveDomainGetOSType(virDomainPtr dom)
static char * static char *
bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
{ {
bhyveConnPtr privconn = domain->conn->privateData; struct _bhyveConn *privconn = domain->conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
char *ret = NULL; char *ret = NULL;
virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS, NULL); virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS, NULL);
@ -502,13 +502,13 @@ bhyveDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
static virDomainPtr static virDomainPtr
bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags) bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
virDomainDefPtr def = NULL; virDomainDef *def = NULL;
virDomainDefPtr oldDef = NULL; virDomainDef *oldDef = NULL;
virDomainObjPtr vm = NULL; virDomainObj *vm = NULL;
virObjectEventPtr event = NULL; virObjectEvent *event = NULL;
virCapsPtr caps = NULL; virCaps *caps = NULL;
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
virCheckFlags(VIR_DOMAIN_DEFINE_VALIDATE, NULL); virCheckFlags(VIR_DOMAIN_DEFINE_VALIDATE, NULL);
@ -573,9 +573,9 @@ bhyveDomainDefineXML(virConnectPtr conn, const char *xml)
static int static int
bhyveDomainUndefineFlags(virDomainPtr domain, unsigned int flags) bhyveDomainUndefineFlags(virDomainPtr domain, unsigned int flags)
{ {
bhyveConnPtr privconn = domain->conn->privateData; struct _bhyveConn *privconn = domain->conn->privateData;
virObjectEventPtr event = NULL; virObjectEvent *event = NULL;
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -622,7 +622,7 @@ bhyveDomainUndefine(virDomainPtr domain)
static int static int
bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids) bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
if (virConnectListDomainsEnsureACL(conn) < 0) if (virConnectListDomainsEnsureACL(conn) < 0)
return -1; return -1;
@ -634,7 +634,7 @@ bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
static int static int
bhyveConnectNumOfDomains(virConnectPtr conn) bhyveConnectNumOfDomains(virConnectPtr conn)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
if (virConnectNumOfDomainsEnsureACL(conn) < 0) if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1; return -1;
@ -647,7 +647,7 @@ static int
bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names, bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames) int maxnames)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0) if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1; return -1;
@ -662,7 +662,7 @@ bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names,
static int static int
bhyveConnectNumOfDefinedDomains(virConnectPtr conn) bhyveConnectNumOfDefinedDomains(virConnectPtr conn)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0) if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1; return -1;
@ -679,10 +679,10 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainDefPtr def = NULL; virDomainDef *def = NULL;
virCommandPtr cmd = NULL; virCommand *cmd = NULL;
virCommandPtr loadcmd = NULL; virCommand *loadcmd = NULL;
char *ret = NULL; char *ret = NULL;
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
@ -746,7 +746,7 @@ bhyveConnectListAllDomains(virConnectPtr conn,
virDomainPtr **domains, virDomainPtr **domains,
unsigned int flags) unsigned int flags)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1); virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
@ -761,8 +761,8 @@ static virDomainPtr
bhyveDomainLookupByUUID(virConnectPtr conn, bhyveDomainLookupByUUID(virConnectPtr conn,
const unsigned char *uuid) const unsigned char *uuid)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
vm = virDomainObjListFindByUUID(privconn->domains, uuid); vm = virDomainObjListFindByUUID(privconn->domains, uuid);
@ -788,8 +788,8 @@ bhyveDomainLookupByUUID(virConnectPtr conn,
static virDomainPtr bhyveDomainLookupByName(virConnectPtr conn, static virDomainPtr bhyveDomainLookupByName(virConnectPtr conn,
const char *name) const char *name)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
vm = virDomainObjListFindByName(privconn->domains, name); vm = virDomainObjListFindByName(privconn->domains, name);
@ -814,8 +814,8 @@ static virDomainPtr
bhyveDomainLookupByID(virConnectPtr conn, bhyveDomainLookupByID(virConnectPtr conn,
int id) int id)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
vm = virDomainObjListFindByID(privconn->domains, id); vm = virDomainObjListFindByID(privconn->domains, id);
@ -840,9 +840,9 @@ static int
bhyveDomainCreateWithFlags(virDomainPtr dom, bhyveDomainCreateWithFlags(virDomainPtr dom,
unsigned int flags) unsigned int flags)
{ {
bhyveConnPtr privconn = dom->conn->privateData; struct _bhyveConn *privconn = dom->conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
virObjectEventPtr event = NULL; virObjectEvent *event = NULL;
unsigned int start_flags = 0; unsigned int start_flags = 0;
int ret = -1; int ret = -1;
@ -889,11 +889,11 @@ bhyveDomainCreateXML(virConnectPtr conn,
const char *xml, const char *xml,
unsigned int flags) unsigned int flags)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainPtr dom = NULL; virDomainPtr dom = NULL;
virDomainDefPtr def = NULL; virDomainDef *def = NULL;
virDomainObjPtr vm = NULL; virDomainObj *vm = NULL;
virObjectEventPtr event = NULL; virObjectEvent *event = NULL;
unsigned int start_flags = 0; unsigned int start_flags = 0;
unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE; unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
@ -949,9 +949,9 @@ static int
bhyveDomainDestroyFlags(virDomainPtr dom, unsigned int flags) bhyveDomainDestroyFlags(virDomainPtr dom, unsigned int flags)
{ {
virConnectPtr conn = dom->conn; virConnectPtr conn = dom->conn;
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
virObjectEventPtr event = NULL; virObjectEvent *event = NULL;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -988,7 +988,7 @@ bhyveDomainDestroy(virDomainPtr dom)
static int static int
bhyveDomainShutdownFlags(virDomainPtr dom, unsigned int flags) bhyveDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
{ {
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -1019,8 +1019,8 @@ static int
bhyveDomainReboot(virDomainPtr dom, unsigned int flags) bhyveDomainReboot(virDomainPtr dom, unsigned int flags)
{ {
virConnectPtr conn = dom->conn; virConnectPtr conn = dom->conn;
virDomainObjPtr vm; virDomainObj *vm;
bhyveDomainObjPrivatePtr priv; bhyveDomainObjPrivate *priv;
int ret = -1; int ret = -1;
virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN, -1); virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN, -1);
@ -1050,8 +1050,8 @@ bhyveDomainOpenConsole(virDomainPtr dom,
virStreamPtr st, virStreamPtr st,
unsigned int flags) unsigned int flags)
{ {
virDomainObjPtr vm = NULL; virDomainObj *vm = NULL;
virDomainChrDefPtr chr = NULL; virDomainChrDef *chr = NULL;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -1093,8 +1093,8 @@ bhyveDomainSetMetadata(virDomainPtr dom,
unsigned int flags) unsigned int flags)
{ {
virConnectPtr conn = dom->conn; virConnectPtr conn = dom->conn;
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
virDomainObjPtr vm; virDomainObj *vm;
int ret = -1; int ret = -1;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
@ -1111,7 +1111,7 @@ bhyveDomainSetMetadata(virDomainPtr dom,
BHYVE_CONFIG_DIR, flags); BHYVE_CONFIG_DIR, flags);
if (ret == 0) { if (ret == 0) {
virObjectEventPtr ev = NULL; virObjectEvent *ev = NULL;
ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri); ev = virDomainEventMetadataChangeNewFromObj(vm, type, uri);
virObjectEventStateQueue(privconn->domainEventState, ev); virObjectEventStateQueue(privconn->domainEventState, ev);
} }
@ -1128,7 +1128,7 @@ bhyveDomainGetMetadata(virDomainPtr dom,
const char *uri, const char *uri,
unsigned int flags) unsigned int flags)
{ {
virDomainObjPtr vm; virDomainObj *vm;
char *ret = NULL; char *ret = NULL;
if (!(vm = bhyveDomObjFromDomain(dom))) if (!(vm = bhyveDomObjFromDomain(dom)))
@ -1314,7 +1314,7 @@ bhyveStateInitialize(bool privileged,
} }
unsigned unsigned
bhyveDriverGetBhyveCaps(bhyveConnPtr driver) bhyveDriverGetBhyveCaps(struct _bhyveConn *driver)
{ {
if (driver != NULL) if (driver != NULL)
return driver->bhyvecaps; return driver->bhyvecaps;
@ -1322,7 +1322,7 @@ bhyveDriverGetBhyveCaps(bhyveConnPtr driver)
} }
unsigned unsigned
bhyveDriverGetGrubCaps(bhyveConnPtr driver) bhyveDriverGetGrubCaps(struct _bhyveConn *driver)
{ {
if (driver != NULL) if (driver != NULL)
return driver->grubcaps; return driver->grubcaps;
@ -1403,8 +1403,8 @@ bhyveConnectBaselineCPU(virConnectPtr conn,
unsigned int ncpus, unsigned int ncpus,
unsigned int flags) unsigned int flags)
{ {
virCPUDefPtr *cpus = NULL; virCPUDef **cpus = NULL;
virCPUDefPtr cpu = NULL; virCPUDef *cpu = NULL;
char *cpustr = NULL; char *cpustr = NULL;
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
@ -1438,9 +1438,9 @@ bhyveConnectCompareCPU(virConnectPtr conn,
const char *xmlDesc, const char *xmlDesc,
unsigned int flags) unsigned int flags)
{ {
bhyveConnPtr driver = conn->privateData; struct _bhyveConn *driver = conn->privateData;
int ret = VIR_CPU_COMPARE_ERROR; int ret = VIR_CPU_COMPARE_ERROR;
virCapsPtr caps = NULL; virCaps *caps = NULL;
bool failIncompatible; bool failIncompatible;
bool validateXML; bool validateXML;
@ -1484,7 +1484,7 @@ bhyveConnectDomainEventRegisterAny(virConnectPtr conn,
void *opaque, void *opaque,
virFreeCallback freecb) virFreeCallback freecb)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
int ret; int ret;
if (virConnectDomainEventRegisterAnyEnsureACL(conn) < 0) if (virConnectDomainEventRegisterAnyEnsureACL(conn) < 0)
@ -1503,7 +1503,7 @@ static int
bhyveConnectDomainEventDeregisterAny(virConnectPtr conn, bhyveConnectDomainEventDeregisterAny(virConnectPtr conn,
int callbackID) int callbackID)
{ {
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0) if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0)
return -1; return -1;
@ -1519,7 +1519,7 @@ bhyveConnectDomainEventDeregisterAny(virConnectPtr conn,
static int static int
bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) bhyveDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
{ {
virDomainObjPtr vm = NULL; virDomainObj *vm = NULL;
int ret = -1; int ret = -1;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -1572,8 +1572,8 @@ bhyveConnectDomainXMLFromNative(virConnectPtr conn,
unsigned int flags) unsigned int flags)
{ {
char *xml = NULL; char *xml = NULL;
virDomainDefPtr def = NULL; virDomainDef *def = NULL;
bhyveConnPtr privconn = conn->privateData; struct _bhyveConn *privconn = conn->privateData;
unsigned bhyveCaps = bhyveDriverGetBhyveCaps(privconn); unsigned bhyveCaps = bhyveDriverGetBhyveCaps(privconn);
virCheckFlags(0, NULL); virCheckFlags(0, NULL);
@ -1607,7 +1607,7 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn,
const char *virttype_str, const char *virttype_str,
unsigned int flags) unsigned int flags)
{ {
virDomainCapsPtr caps = NULL; virDomainCaps *caps = NULL;
char *ret = NULL; char *ret = NULL;
int virttype = VIR_DOMAIN_VIRT_BHYVE; int virttype = VIR_DOMAIN_VIRT_BHYVE;
int arch = virArchFromHost(); /* virArch */ int arch = virArchFromHost(); /* virArch */

View File

@ -25,8 +25,8 @@
int bhyveRegister(void); int bhyveRegister(void);
unsigned bhyveDriverGetBhyveCaps(bhyveConnPtr driver); unsigned bhyveDriverGetBhyveCaps(struct _bhyveConn *driver);
unsigned bhyveDriverGetGrubCaps(bhyveConnPtr driver); unsigned bhyveDriverGetGrubCaps(struct _bhyveConn *driver);
virCapsPtr bhyveDriverGetCapabilities(bhyveConnPtr driver); virCaps *bhyveDriverGetCapabilities(struct _bhyveConn *driver);

View File

@ -36,8 +36,8 @@ VIR_LOG_INIT("bhyve.bhyve_firmware");
#define BHYVE_DEFAULT_FIRMWARE "BHYVE_UEFI.fd" #define BHYVE_DEFAULT_FIRMWARE "BHYVE_UEFI.fd"
int int
bhyveFirmwareFillDomain(bhyveConnPtr driver, bhyveFirmwareFillDomain(bhyveConn *driver,
virDomainDefPtr def, virDomainDef *def,
unsigned int flags) unsigned int flags)
{ {
g_autoptr(DIR) dir = NULL; g_autoptr(DIR) dir = NULL;

View File

@ -25,6 +25,6 @@
#include "bhyve_utils.h" #include "bhyve_utils.h"
int int
bhyveFirmwareFillDomain(bhyveConnPtr driver, bhyveFirmwareFillDomain(bhyveConn *driver,
virDomainDefPtr def, virDomainDef *def,
unsigned int flags); unsigned int flags);

View File

@ -41,19 +41,19 @@ VIR_LOG_INIT("bhyve.bhyve_monitor");
struct _bhyveMonitor { struct _bhyveMonitor {
virObject parent; virObject parent;
bhyveConnPtr driver; struct _bhyveConn *driver;
virDomainObjPtr vm; virDomainObj *vm;
int kq; int kq;
int watch; int watch;
bool reboot; bool reboot;
}; };
static virClassPtr bhyveMonitorClass; static virClass *bhyveMonitorClass;
static void static void
bhyveMonitorDispose(void *obj) bhyveMonitorDispose(void *obj)
{ {
bhyveMonitorPtr mon = obj; bhyveMonitor *mon = obj;
VIR_FORCE_CLOSE(mon->kq); VIR_FORCE_CLOSE(mon->kq);
virObjectUnref(mon->vm); virObjectUnref(mon->vm);
@ -73,7 +73,7 @@ VIR_ONCE_GLOBAL_INIT(bhyveMonitor);
static void bhyveMonitorIO(int, int, int, void *); static void bhyveMonitorIO(int, int, int, void *);
static bool static bool
bhyveMonitorRegister(bhyveMonitorPtr mon) bhyveMonitorRegister(bhyveMonitor *mon)
{ {
virObjectRef(mon); virObjectRef(mon);
mon->watch = virEventAddHandle(mon->kq, mon->watch = virEventAddHandle(mon->kq,
@ -92,7 +92,7 @@ bhyveMonitorRegister(bhyveMonitorPtr mon)
} }
static void static void
bhyveMonitorUnregister(bhyveMonitorPtr mon) bhyveMonitorUnregister(bhyveMonitor *mon)
{ {
if (mon->watch < 0) if (mon->watch < 0)
return; return;
@ -102,7 +102,7 @@ bhyveMonitorUnregister(bhyveMonitorPtr mon)
} }
void void
bhyveMonitorSetReboot(bhyveMonitorPtr mon) bhyveMonitorSetReboot(bhyveMonitor *mon)
{ {
mon->reboot = true; mon->reboot = true;
} }
@ -111,9 +111,9 @@ static void
bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque) bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque)
{ {
const struct timespec zerowait = { 0, 0 }; const struct timespec zerowait = { 0, 0 };
bhyveMonitorPtr mon = opaque; bhyveMonitor *mon = opaque;
virDomainObjPtr vm = mon->vm; virDomainObj *vm = mon->vm;
bhyveConnPtr driver = mon->driver; struct _bhyveConn *driver = mon->driver;
const char *name; const char *name;
struct kevent kev; struct kevent kev;
int rc, status; int rc, status;
@ -172,10 +172,10 @@ bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque)
} }
} }
static bhyveMonitorPtr static bhyveMonitor *
bhyveMonitorOpenImpl(virDomainObjPtr vm, bhyveConnPtr driver) bhyveMonitorOpenImpl(virDomainObj *vm, struct _bhyveConn *driver)
{ {
bhyveMonitorPtr mon; bhyveMonitor *mon;
struct kevent kev; struct kevent kev;
if (bhyveMonitorInitialize() < 0) if (bhyveMonitorInitialize() < 0)
@ -217,10 +217,10 @@ bhyveMonitorOpenImpl(virDomainObjPtr vm, bhyveConnPtr driver)
return NULL; return NULL;
} }
bhyveMonitorPtr bhyveMonitor *
bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver) bhyveMonitorOpen(virDomainObj *vm, struct _bhyveConn *driver)
{ {
bhyveMonitorPtr mon; bhyveMonitor *mon;
virObjectRef(vm); virObjectRef(vm);
mon = bhyveMonitorOpenImpl(vm, driver); mon = bhyveMonitorOpenImpl(vm, driver);
@ -230,7 +230,7 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver)
} }
void void
bhyveMonitorClose(bhyveMonitorPtr mon) bhyveMonitorClose(bhyveMonitor *mon)
{ {
if (mon == NULL) if (mon == NULL)
return; return;

View File

@ -25,9 +25,8 @@
#include "bhyve_utils.h" #include "bhyve_utils.h"
typedef struct _bhyveMonitor bhyveMonitor; typedef struct _bhyveMonitor bhyveMonitor;
typedef bhyveMonitor *bhyveMonitorPtr;
bhyveMonitorPtr bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver); bhyveMonitor *bhyveMonitorOpen(virDomainObj *vm, struct _bhyveConn *driver);
void bhyveMonitorClose(bhyveMonitorPtr mon); void bhyveMonitorClose(bhyveMonitor *mon);
void bhyveMonitorSetReboot(bhyveMonitorPtr mon); void bhyveMonitorSetReboot(bhyveMonitor *mon);

View File

@ -258,7 +258,7 @@ bhyveCommandLineToArgv(const char *nativeConfig,
} }
static int static int
bhyveParseBhyveLPCArg(virDomainDefPtr def, bhyveParseBhyveLPCArg(virDomainDef *def,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
const char *arg) const char *arg)
{ {
@ -266,7 +266,7 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def,
const char *separator = NULL; const char *separator = NULL;
const char *param = NULL; const char *param = NULL;
size_t last = 0; size_t last = 0;
virDomainChrDefPtr chr = NULL; virDomainChrDef *chr = NULL;
char *type = NULL; char *type = NULL;
separator = strchr(arg, ','); separator = strchr(arg, ',');
@ -400,7 +400,7 @@ bhyveParsePCISlot(const char *slotdef,
} }
static int static int
bhyveParsePCIDisk(virDomainDefPtr def, bhyveParsePCIDisk(virDomainDef *def,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
unsigned pcibus, unsigned pcibus,
unsigned pcislot, unsigned pcislot,
@ -414,7 +414,7 @@ bhyveParsePCIDisk(virDomainDefPtr def,
/* -s slot,virtio-blk|ahci-cd|ahci-hd,/path/to/file */ /* -s slot,virtio-blk|ahci-cd|ahci-hd,/path/to/file */
const char *separator = NULL; const char *separator = NULL;
int idx = -1; int idx = -1;
virDomainDiskDefPtr disk = NULL; virDomainDiskDef *disk = NULL;
if (!(disk = virDomainDiskDefNew(NULL))) if (!(disk = virDomainDiskDefNew(NULL)))
return 0; return 0;
@ -470,8 +470,8 @@ bhyveParsePCIDisk(virDomainDefPtr def,
} }
static int static int
bhyveParsePCINet(virDomainDefPtr def, bhyveParsePCINet(virDomainDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
unsigned bus, unsigned bus,
unsigned slot, unsigned slot,
@ -481,7 +481,7 @@ bhyveParsePCINet(virDomainDefPtr def,
{ {
/* -s slot,virtio-net,tapN[,mac=xx:xx:xx:xx:xx:xx] */ /* -s slot,virtio-net,tapN[,mac=xx:xx:xx:xx:xx:xx] */
virDomainNetDefPtr net = NULL; virDomainNetDef *net = NULL;
const char *separator = NULL; const char *separator = NULL;
const char *mac = NULL; const char *mac = NULL;
@ -546,8 +546,8 @@ bhyveParsePCINet(virDomainDefPtr def,
} }
static int static int
bhyveParsePCIFbuf(virDomainDefPtr def, bhyveParsePCIFbuf(virDomainDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned caps G_GNUC_UNUSED, unsigned caps G_GNUC_UNUSED,
unsigned bus, unsigned bus,
unsigned slot, unsigned slot,
@ -556,8 +556,8 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
{ {
/* -s slot,fbuf,wait,vga=on|io|off,rfb=<ip>:port,w=width,h=height */ /* -s slot,fbuf,wait,vga=on|io|off,rfb=<ip>:port,w=width,h=height */
virDomainVideoDefPtr video = NULL; virDomainVideoDef *video = NULL;
virDomainGraphicsDefPtr graphics = NULL; virDomainGraphicsDef *graphics = NULL;
g_auto(GStrv) params = NULL; g_auto(GStrv) params = NULL;
GStrv next; GStrv next;
@ -657,8 +657,8 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
} }
static int static int
bhyveParseBhyvePCIArg(virDomainDefPtr def, bhyveParseBhyvePCIArg(virDomainDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned caps, unsigned caps,
unsigned *nvirtiodisk, unsigned *nvirtiodisk,
unsigned *nahcidisk, unsigned *nahcidisk,
@ -742,8 +742,8 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def,
* Parse the /usr/sbin/bhyve command line. * Parse the /usr/sbin/bhyve command line.
*/ */
static int static int
bhyveParseBhyveCommandLine(virDomainDefPtr def, bhyveParseBhyveCommandLine(virDomainDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned caps, unsigned caps,
int argc, char **argv) int argc, char **argv)
{ {
@ -852,7 +852,7 @@ bhyveParseBhyveCommandLine(virDomainDefPtr def,
* Parse the /usr/sbin/bhyveload command line. * Parse the /usr/sbin/bhyveload command line.
*/ */
static int static int
bhyveParseBhyveLoadCommandLine(virDomainDefPtr def, bhyveParseBhyveLoadCommandLine(virDomainDef *def,
int argc, char **argv) int argc, char **argv)
{ {
/* bhyveload called with default arguments when only -m and -d are given. /* bhyveload called with default arguments when only -m and -d are given.
@ -932,7 +932,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def,
#undef CONSUME_ARG #undef CONSUME_ARG
static int static int
bhyveParseCustomLoaderCommandLine(virDomainDefPtr def, bhyveParseCustomLoaderCommandLine(virDomainDef *def,
int argc G_GNUC_UNUSED, int argc G_GNUC_UNUSED,
char **argv) char **argv)
{ {
@ -945,12 +945,12 @@ bhyveParseCustomLoaderCommandLine(virDomainDefPtr def,
return 0; return 0;
} }
virDomainDefPtr virDomainDef *
bhyveParseCommandLineString(const char* nativeConfig, bhyveParseCommandLineString(const char* nativeConfig,
unsigned caps, unsigned caps,
virDomainXMLOptionPtr xmlopt) virDomainXMLOption *xmlopt)
{ {
virDomainDefPtr def = NULL; virDomainDef *def = NULL;
int bhyve_argc = 0; int bhyve_argc = 0;
char **bhyve_argv = NULL; char **bhyve_argv = NULL;
int loader_argc = 0; int loader_argc = 0;

View File

@ -20,6 +20,6 @@
#pragma once #pragma once
virDomainDefPtr bhyveParseCommandLineString(const char* nativeConfig, virDomainDef *bhyveParseCommandLineString(const char* nativeConfig,
unsigned caps, unsigned caps,
virDomainXMLOptionPtr xmlopt); virDomainXMLOption *xmlopt);

View File

@ -55,11 +55,11 @@
VIR_LOG_INIT("bhyve.bhyve_process"); VIR_LOG_INIT("bhyve.bhyve_process");
static void static void
bhyveProcessAutoDestroy(virDomainObjPtr vm, bhyveProcessAutoDestroy(virDomainObj *vm,
virConnectPtr conn G_GNUC_UNUSED, virConnectPtr conn G_GNUC_UNUSED,
void *opaque) void *opaque)
{ {
bhyveConnPtr driver = opaque; struct _bhyveConn *driver = opaque;
virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
@ -68,12 +68,12 @@ bhyveProcessAutoDestroy(virDomainObjPtr vm,
} }
static void static void
bhyveNetCleanup(virDomainObjPtr vm) bhyveNetCleanup(virDomainObj *vm)
{ {
size_t i; size_t i;
for (i = 0; i < vm->def->nnets; i++) { for (i = 0; i < vm->def->nnets; i++) {
virDomainNetDefPtr net = vm->def->nets[i]; virDomainNetDef *net = vm->def->nets[i];
virDomainNetType actualType = virDomainNetGetActualType(net); virDomainNetType actualType = virDomainNetGetActualType(net);
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
@ -94,7 +94,7 @@ virBhyveFormatDevMapFile(const char *vm_name, char **fn_out)
} }
static int static int
bhyveProcessStartHook(virDomainObjPtr vm, virHookBhyveOpType op) bhyveProcessStartHook(virDomainObj *vm, virHookBhyveOpType op)
{ {
if (!virHookPresent(VIR_HOOK_DRIVER_BHYVE)) if (!virHookPresent(VIR_HOOK_DRIVER_BHYVE))
return 0; return 0;
@ -104,7 +104,7 @@ bhyveProcessStartHook(virDomainObjPtr vm, virHookBhyveOpType op)
} }
static void static void
bhyveProcessStopHook(virDomainObjPtr vm, virHookBhyveOpType op) bhyveProcessStopHook(virDomainObj *vm, virHookBhyveOpType op)
{ {
if (virHookPresent(VIR_HOOK_DRIVER_BHYVE)) if (virHookPresent(VIR_HOOK_DRIVER_BHYVE))
virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op,
@ -112,17 +112,17 @@ bhyveProcessStopHook(virDomainObjPtr vm, virHookBhyveOpType op)
} }
static int static int
virBhyveProcessStartImpl(bhyveConnPtr driver, virBhyveProcessStartImpl(struct _bhyveConn *driver,
virDomainObjPtr vm, virDomainObj *vm,
virDomainRunningReason reason) virDomainRunningReason reason)
{ {
char *devmap_file = NULL; char *devmap_file = NULL;
char *devicemap = NULL; char *devicemap = NULL;
char *logfile = NULL; char *logfile = NULL;
int logfd = -1; int logfd = -1;
virCommandPtr cmd = NULL; virCommand *cmd = NULL;
virCommandPtr load_cmd = NULL; virCommand *load_cmd = NULL;
bhyveDomainObjPrivatePtr priv = vm->privateData; bhyveDomainObjPrivate *priv = vm->privateData;
int ret = -1, rc; int ret = -1, rc;
logfile = g_strdup_printf("%s/%s.log", BHYVE_LOG_DIR, vm->def->name); logfile = g_strdup_printf("%s/%s.log", BHYVE_LOG_DIR, vm->def->name);
@ -233,7 +233,7 @@ virBhyveProcessStartImpl(bhyveConnPtr driver,
if (ret < 0) { if (ret < 0) {
int exitstatus; /* Needed to avoid logging non-zero status */ int exitstatus; /* Needed to avoid logging non-zero status */
virCommandPtr destroy_cmd; virCommand *destroy_cmd;
if ((destroy_cmd = virBhyveProcessBuildDestroyCmd(driver, if ((destroy_cmd = virBhyveProcessBuildDestroyCmd(driver,
vm->def)) != NULL) { vm->def)) != NULL) {
virCommandSetOutputFD(load_cmd, &logfd); virCommandSetOutputFD(load_cmd, &logfd);
@ -253,8 +253,8 @@ virBhyveProcessStartImpl(bhyveConnPtr driver,
} }
int int
bhyveProcessPrepareDomain(bhyveConnPtr driver, bhyveProcessPrepareDomain(bhyveConn *driver,
virDomainObjPtr vm, virDomainObj *vm,
unsigned int flags) unsigned int flags)
{ {
if (bhyveFirmwareFillDomain(driver, vm->def, flags) < 0) if (bhyveFirmwareFillDomain(driver, vm->def, flags) < 0)
@ -265,11 +265,11 @@ bhyveProcessPrepareDomain(bhyveConnPtr driver,
int int
virBhyveProcessStart(virConnectPtr conn, virBhyveProcessStart(virConnectPtr conn,
virDomainObjPtr vm, virDomainObj *vm,
virDomainRunningReason reason, virDomainRunningReason reason,
unsigned int flags) unsigned int flags)
{ {
bhyveConnPtr driver = conn->privateData; struct _bhyveConn *driver = conn->privateData;
/* Run an early hook to setup missing devices. */ /* Run an early hook to setup missing devices. */
if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0)
@ -287,13 +287,13 @@ virBhyveProcessStart(virConnectPtr conn,
} }
int int
virBhyveProcessStop(bhyveConnPtr driver, virBhyveProcessStop(struct _bhyveConn *driver,
virDomainObjPtr vm, virDomainObj *vm,
virDomainShutoffReason reason) virDomainShutoffReason reason)
{ {
int ret = -1; int ret = -1;
virCommandPtr cmd = NULL; virCommand *cmd = NULL;
bhyveDomainObjPrivatePtr priv = vm->privateData; bhyveDomainObjPrivate *priv = vm->privateData;
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
VIR_DEBUG("VM '%s' not active", vm->def->name); VIR_DEBUG("VM '%s' not active", vm->def->name);
@ -351,7 +351,7 @@ virBhyveProcessStop(bhyveConnPtr driver,
} }
int int
virBhyveProcessShutdown(virDomainObjPtr vm) virBhyveProcessShutdown(virDomainObj *vm)
{ {
if (vm->pid <= 0) { if (vm->pid <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
@ -374,8 +374,8 @@ virBhyveProcessShutdown(virDomainObjPtr vm)
} }
int int
virBhyveProcessRestart(bhyveConnPtr driver, virBhyveProcessRestart(struct _bhyveConn *driver,
virDomainObjPtr vm) virDomainObj *vm)
{ {
if (virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN) < 0) if (virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN) < 0)
return -1; return -1;
@ -387,7 +387,7 @@ virBhyveProcessRestart(bhyveConnPtr driver,
} }
int int
virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm, virBhyveGetDomainTotalCpuStats(virDomainObj *vm,
unsigned long long *cpustats) unsigned long long *cpustats)
{ {
struct kinfo_proc *kp; struct kinfo_proc *kp;
@ -423,12 +423,12 @@ virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
} }
struct bhyveProcessReconnectData { struct bhyveProcessReconnectData {
bhyveConnPtr driver; struct _bhyveConn *driver;
kvm_t *kd; kvm_t *kd;
}; };
static int static int
virBhyveProcessReconnect(virDomainObjPtr vm, virBhyveProcessReconnect(virDomainObj *vm,
void *opaque) void *opaque)
{ {
struct bhyveProcessReconnectData *data = opaque; struct bhyveProcessReconnectData *data = opaque;
@ -436,7 +436,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
int nprocs; int nprocs;
char **proc_argv; char **proc_argv;
char *expected_proctitle = NULL; char *expected_proctitle = NULL;
bhyveDomainObjPrivatePtr priv = vm->privateData; bhyveDomainObjPrivate *priv = vm->privateData;
int ret = -1; int ret = -1;
if (!virDomainObjIsActive(vm)) if (!virDomainObjIsActive(vm))
@ -489,7 +489,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
} }
void void
virBhyveProcessReconnectAll(bhyveConnPtr driver) virBhyveProcessReconnectAll(struct _bhyveConn *driver)
{ {
kvm_t *kd; kvm_t *kd;
struct bhyveProcessReconnectData data; struct bhyveProcessReconnectData data;

View File

@ -24,28 +24,28 @@
#include "bhyve_utils.h" #include "bhyve_utils.h"
int int
bhyveProcessPrepareDomain(bhyveConnPtr driver, bhyveProcessPrepareDomain(bhyveConn *driver,
virDomainObjPtr vm, virDomainObj *vm,
unsigned int flags); unsigned int flags);
int virBhyveProcessStart(virConnectPtr conn, int virBhyveProcessStart(virConnect *conn,
virDomainObjPtr vm, virDomainObj *vm,
virDomainRunningReason reason, virDomainRunningReason reason,
unsigned int flags); unsigned int flags);
int virBhyveProcessStop(bhyveConnPtr driver, int virBhyveProcessStop(struct _bhyveConn *driver,
virDomainObjPtr vm, virDomainObj *vm,
virDomainShutoffReason reason); virDomainShutoffReason reason);
int virBhyveProcessRestart(bhyveConnPtr driver, int virBhyveProcessRestart(struct _bhyveConn *driver,
virDomainObjPtr vm); virDomainObj *vm);
int virBhyveProcessShutdown(virDomainObjPtr vm); int virBhyveProcessShutdown(virDomainObj *vm);
int virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm, int virBhyveGetDomainTotalCpuStats(virDomainObj *vm,
unsigned long long *cpustats); unsigned long long *cpustats);
void virBhyveProcessReconnectAll(bhyveConnPtr driver); void virBhyveProcessReconnectAll(struct _bhyveConn *driver);
typedef enum { typedef enum {
VIR_BHYVE_PROCESS_START_AUTODESTROY = 1 << 0, VIR_BHYVE_PROCESS_START_AUTODESTROY = 1 << 0,

View File

@ -35,8 +35,6 @@
#define BHYVE_LOG_DIR LOCALSTATEDIR "/log/libvirt/bhyve" #define BHYVE_LOG_DIR LOCALSTATEDIR "/log/libvirt/bhyve"
typedef struct _virBhyveDriverConfig virBhyveDriverConfig; typedef struct _virBhyveDriverConfig virBhyveDriverConfig;
typedef struct _virBhyveDriverConfig *virBhyveDriverConfigPtr;
struct _virBhyveDriverConfig { struct _virBhyveDriverConfig {
virObject parent; virObject parent;
@ -48,34 +46,33 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virBhyveDriverConfig, virObjectUnref);
struct _bhyveConn { struct _bhyveConn {
virMutex lock; virMutex lock;
virBhyveDriverConfigPtr config; struct _virBhyveDriverConfig *config;
/* pid file FD, ensures two copies of the driver can't use the same root */ /* pid file FD, ensures two copies of the driver can't use the same root */
int lockFD; int lockFD;
virDomainObjListPtr domains; virDomainObjList *domains;
virCapsPtr caps; virCaps *caps;
virDomainXMLOptionPtr xmlopt; virDomainXMLOption *xmlopt;
char *pidfile; char *pidfile;
virSysinfoDefPtr hostsysinfo; virSysinfoDef *hostsysinfo;
virObjectEventStatePtr domainEventState; virObjectEventState *domainEventState;
virCloseCallbacksPtr closeCallbacks; virCloseCallbacks *closeCallbacks;
virPortAllocatorRangePtr remotePorts; virPortAllocatorRange *remotePorts;
unsigned bhyvecaps; unsigned bhyvecaps;
unsigned grubcaps; unsigned grubcaps;
}; };
typedef struct _bhyveConn bhyveConn; typedef struct _bhyveConn bhyveConn;
typedef struct _bhyveConn *bhyveConnPtr;
struct bhyveAutostartData { struct bhyveAutostartData {
bhyveConnPtr driver; struct _bhyveConn *driver;
virConnectPtr conn; virConnectPtr conn;
}; };
void bhyveDriverLock(bhyveConnPtr driver); void bhyveDriverLock(struct _bhyveConn *driver);
void bhyveDriverUnlock(bhyveConnPtr driver); void bhyveDriverUnlock(struct _bhyveConn *driver);

View File

@ -64,7 +64,7 @@ VIR_ENUM_IMPL(virDomainBackupDiskBackupMode,
"incremental"); "incremental");
void void
virDomainBackupDefFree(virDomainBackupDefPtr def) virDomainBackupDefFree(virDomainBackupDef *def)
{ {
size_t i; size_t i;
@ -76,7 +76,7 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
virStorageNetHostDefFree(1, def->server); virStorageNetHostDefFree(1, def->server);
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
virDomainBackupDiskDefPtr disk = def->disks + i; virDomainBackupDiskDef *disk = def->disks + i;
g_free(disk->name); g_free(disk->name);
g_free(disk->incremental); g_free(disk->incremental);
@ -97,10 +97,10 @@ virDomainBackupDefFree(virDomainBackupDefPtr def)
static int static int
virDomainBackupDiskDefParseXML(xmlNodePtr node, virDomainBackupDiskDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virDomainBackupDiskDefPtr def, virDomainBackupDiskDef *def,
bool push, bool push,
unsigned int flags, unsigned int flags,
virDomainXMLOptionPtr xmlopt) virDomainXMLOption *xmlopt)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree char *type = NULL; g_autofree char *type = NULL;
@ -200,7 +200,7 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node,
static void static void
virDomainBackupDefParsePrivate(virDomainBackupDefPtr def, virDomainBackupDefParsePrivate(virDomainBackupDef *def,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int flags) unsigned int flags)
{ {
@ -212,9 +212,9 @@ virDomainBackupDefParsePrivate(virDomainBackupDefPtr def,
} }
static virDomainBackupDefPtr static virDomainBackupDef *
virDomainBackupDefParse(xmlXPathContextPtr ctxt, virDomainBackupDefParse(xmlXPathContextPtr ctxt,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
g_autoptr(virDomainBackupDef) def = NULL; g_autoptr(virDomainBackupDef) def = NULL;
@ -302,12 +302,12 @@ virDomainBackupDefParse(xmlXPathContextPtr ctxt,
} }
virDomainBackupDefPtr virDomainBackupDef *
virDomainBackupDefParseString(const char *xmlStr, virDomainBackupDefParseString(const char *xmlStr,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
virDomainBackupDefPtr ret = NULL; virDomainBackupDef *ret = NULL;
g_autoptr(xmlDoc) xml = NULL; g_autoptr(xmlDoc) xml = NULL;
int keepBlanksDefault = xmlKeepBlanksDefault(0); int keepBlanksDefault = xmlKeepBlanksDefault(0);
@ -322,10 +322,10 @@ virDomainBackupDefParseString(const char *xmlStr,
} }
virDomainBackupDefPtr virDomainBackupDef *
virDomainBackupDefParseNode(xmlDocPtr xml, virDomainBackupDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
g_autoptr(xmlXPathContext) ctxt = NULL; g_autoptr(xmlXPathContext) ctxt = NULL;
@ -355,8 +355,8 @@ virDomainBackupDefParseNode(xmlDocPtr xml,
static int static int
virDomainBackupDiskDefFormat(virBufferPtr buf, virDomainBackupDiskDefFormat(virBuffer *buf,
virDomainBackupDiskDefPtr disk, virDomainBackupDiskDef *disk,
bool push, bool push,
bool internal) bool internal)
{ {
@ -408,8 +408,8 @@ virDomainBackupDiskDefFormat(virBufferPtr buf,
static void static void
virDomainBackupDefFormatPrivate(virBufferPtr buf, virDomainBackupDefFormatPrivate(virBuffer *buf,
virDomainBackupDefPtr def, virDomainBackupDef *def,
bool internal) bool internal)
{ {
g_auto(virBuffer) privChildBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) privChildBuf = VIR_BUFFER_INIT_CHILD(buf);
@ -428,8 +428,8 @@ virDomainBackupDefFormatPrivate(virBufferPtr buf,
int int
virDomainBackupDefFormat(virBufferPtr buf, virDomainBackupDefFormat(virBuffer *buf,
virDomainBackupDefPtr def, virDomainBackupDef *def,
bool internal) bool internal)
{ {
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
@ -473,8 +473,8 @@ virDomainBackupDefFormat(virBufferPtr buf,
static int static int
virDomainBackupDefAssignStore(virDomainBackupDiskDefPtr disk, virDomainBackupDefAssignStore(virDomainBackupDiskDef *disk,
virStorageSourcePtr src, virStorageSource *src,
const char *suffix) const char *suffix)
{ {
if (virStorageSourceIsEmpty(src)) { if (virStorageSourceIsEmpty(src)) {
@ -501,8 +501,8 @@ virDomainBackupDefAssignStore(virDomainBackupDiskDefPtr disk,
int int
virDomainBackupAlignDisks(virDomainBackupDefPtr def, virDomainBackupAlignDisks(virDomainBackupDef *def,
virDomainDefPtr dom, virDomainDef *dom,
const char *suffix) const char *suffix)
{ {
g_autoptr(GHashTable) disks = virHashNew(NULL); g_autoptr(GHashTable) disks = virHashNew(NULL);
@ -519,8 +519,8 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
/* Double check requested disks. */ /* Double check requested disks. */
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
virDomainBackupDiskDefPtr backupdisk = &def->disks[i]; virDomainBackupDiskDef *backupdisk = &def->disks[i];
virDomainDiskDefPtr domdisk; virDomainDiskDef *domdisk;
if (!(domdisk = virDomainDiskByTarget(dom, backupdisk->name))) { if (!(domdisk = virDomainDiskByTarget(dom, backupdisk->name))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@ -557,8 +557,8 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
VIR_EXPAND_N(def->disks, def->ndisks, dom->ndisks - def->ndisks); VIR_EXPAND_N(def->disks, def->ndisks, dom->ndisks - def->ndisks);
for (i = 0; i < dom->ndisks; i++) { for (i = 0; i < dom->ndisks; i++) {
virDomainBackupDiskDefPtr backupdisk = NULL; virDomainBackupDiskDef *backupdisk = NULL;
virDomainDiskDefPtr domdisk = dom->disks[i]; virDomainDiskDef *domdisk = dom->disks[i];
if (virHashHasEntry(disks, domdisk->dst)) if (virHashHasEntry(disks, domdisk->dst))
continue; continue;
@ -579,7 +579,7 @@ virDomainBackupAlignDisks(virDomainBackupDefPtr def,
} }
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
virDomainBackupDiskDefPtr backupdisk = &def->disks[i]; virDomainBackupDiskDef *backupdisk = &def->disks[i];
if (backupdisk->backupmode == VIR_DOMAIN_BACKUP_DISK_BACKUP_MODE_DEFAULT) { if (backupdisk->backupmode == VIR_DOMAIN_BACKUP_DISK_BACKUP_MODE_DEFAULT) {
if (def->incremental || backupdisk->incremental) { if (def->incremental || backupdisk->incremental) {

View File

@ -57,7 +57,6 @@ typedef enum {
/* Stores disk-backup information */ /* Stores disk-backup information */
typedef struct _virDomainBackupDiskDef virDomainBackupDiskDef; typedef struct _virDomainBackupDiskDef virDomainBackupDiskDef;
typedef virDomainBackupDiskDef *virDomainBackupDiskDefPtr;
struct _virDomainBackupDiskDef { struct _virDomainBackupDiskDef {
char *name; /* name matching the <target dev='...' of the domain */ char *name; /* name matching the <target dev='...' of the domain */
virTristateBool backup; /* whether backup is requested */ virTristateBool backup; /* whether backup is requested */
@ -67,7 +66,7 @@ struct _virDomainBackupDiskDef {
char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */ char *exportbitmap; /* name of the bitmap exposed in NBD for pull mode backup */
/* details of target for push-mode, or of the scratch file for pull-mode */ /* details of target for push-mode, or of the scratch file for pull-mode */
virStorageSourcePtr store; virStorageSource *store;
/* internal data */ /* internal data */
virDomainBackupDiskState state; virDomainBackupDiskState state;
@ -75,12 +74,11 @@ struct _virDomainBackupDiskDef {
/* Stores the complete backup metadata */ /* Stores the complete backup metadata */
typedef struct _virDomainBackupDef virDomainBackupDef; typedef struct _virDomainBackupDef virDomainBackupDef;
typedef virDomainBackupDef *virDomainBackupDefPtr;
struct _virDomainBackupDef { struct _virDomainBackupDef {
/* Public XML. */ /* Public XML. */
int type; /* virDomainBackupType */ int type; /* virDomainBackupType */
char *incremental; char *incremental;
virStorageNetHostDefPtr server; /* only when type == PULL */ virStorageNetHostDef *server; /* only when type == PULL */
virTristateBool tls; /* use TLS for NBD */ virTristateBool tls; /* use TLS for NBD */
size_t ndisks; /* should not exceed dom->ndisks */ size_t ndisks; /* should not exceed dom->ndisks */
@ -107,26 +105,26 @@ typedef enum {
VIR_DOMAIN_BACKUP_PARSE_INTERNAL = 1 << 0, VIR_DOMAIN_BACKUP_PARSE_INTERNAL = 1 << 0,
} virDomainBackupParseFlags; } virDomainBackupParseFlags;
virDomainBackupDefPtr virDomainBackupDef *
virDomainBackupDefParseString(const char *xmlStr, virDomainBackupDefParseString(const char *xmlStr,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
virDomainBackupDefPtr virDomainBackupDef *
virDomainBackupDefParseNode(xmlDocPtr xml, virDomainBackupDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
void void
virDomainBackupDefFree(virDomainBackupDefPtr def); virDomainBackupDefFree(virDomainBackupDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainBackupDef, virDomainBackupDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainBackupDef, virDomainBackupDefFree);
int int
virDomainBackupDefFormat(virBufferPtr buf, virDomainBackupDefFormat(virBuffer *buf,
virDomainBackupDefPtr def, virDomainBackupDef *def,
bool internal); bool internal);
int int
virDomainBackupAlignDisks(virDomainBackupDefPtr backup, virDomainBackupAlignDisks(virDomainBackupDef *backup,
virDomainDefPtr dom, virDomainDef *dom,
const char *suffix); const char *suffix);

View File

@ -54,7 +54,7 @@ VIR_ENUM_IMPL(virCapsHostPMTarget,
"suspend_mem", "suspend_disk", "suspend_hybrid", "suspend_mem", "suspend_disk", "suspend_hybrid",
); );
static virClassPtr virCapsClass; static virClass *virCapsClass;
static void virCapsDispose(void *obj); static void virCapsDispose(void *obj);
static int virCapabilitiesOnceInit(void) static int virCapabilitiesOnceInit(void)
@ -75,12 +75,12 @@ VIR_ONCE_GLOBAL_INIT(virCapabilities);
* *
* Allocate a new capabilities object * Allocate a new capabilities object
*/ */
virCapsPtr virCaps *
virCapabilitiesNew(virArch hostarch, virCapabilitiesNew(virArch hostarch,
bool offlineMigrate, bool offlineMigrate,
bool liveMigrate) bool liveMigrate)
{ {
virCapsPtr caps; virCaps *caps;
if (virCapabilitiesInitialize() < 0) if (virCapabilitiesInitialize() < 0)
return NULL; return NULL;
@ -96,7 +96,7 @@ virCapabilitiesNew(virArch hostarch,
} }
void void
virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPUPtr cpus, virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPU *cpus,
size_t ncpus) size_t ncpus)
{ {
size_t i; size_t i;
@ -111,7 +111,7 @@ virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPUPtr cpus,
} }
static void static void
virCapabilitiesFreeHostNUMACell(virCapsHostNUMACellPtr cell) virCapabilitiesFreeHostNUMACell(virCapsHostNUMACell *cell)
{ {
if (cell == NULL) if (cell == NULL)
return; return;
@ -125,7 +125,7 @@ virCapabilitiesFreeHostNUMACell(virCapsHostNUMACellPtr cell)
} }
static void static void
virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine) virCapabilitiesFreeGuestMachine(virCapsGuestMachine *machine)
{ {
if (machine == NULL) if (machine == NULL)
return; return;
@ -135,7 +135,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine)
} }
static void static void
virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom) virCapabilitiesFreeGuestDomain(virCapsGuestDomain *dom)
{ {
size_t i; size_t i;
if (dom == NULL) if (dom == NULL)
@ -151,7 +151,7 @@ virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
} }
void void
virCapabilitiesFreeGuest(virCapsGuestPtr guest) virCapabilitiesFreeGuest(virCapsGuest *guest)
{ {
size_t i; size_t i;
if (guest == NULL) if (guest == NULL)
@ -172,7 +172,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest)
static void static void
virCapabilitiesFreeStoragePool(virCapsStoragePoolPtr pool) virCapabilitiesFreeStoragePool(virCapsStoragePool *pool)
{ {
if (!pool) if (!pool)
return; return;
@ -182,7 +182,7 @@ virCapabilitiesFreeStoragePool(virCapsStoragePoolPtr pool)
void void
virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps) virCapabilitiesHostNUMAUnref(virCapsHostNUMA *caps)
{ {
if (!caps) if (!caps)
return; return;
@ -195,13 +195,13 @@ virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps)
} }
void void
virCapabilitiesHostNUMARef(virCapsHostNUMAPtr caps) virCapabilitiesHostNUMARef(virCapsHostNUMA *caps)
{ {
g_atomic_int_inc(&caps->refs); g_atomic_int_inc(&caps->refs);
} }
static void static void
virCapsHostMemBWNodeFree(virCapsHostMemBWNodePtr ptr) virCapsHostMemBWNodeFree(virCapsHostMemBWNode *ptr)
{ {
if (!ptr) if (!ptr)
return; return;
@ -211,7 +211,7 @@ virCapsHostMemBWNodeFree(virCapsHostMemBWNodePtr ptr)
} }
static void static void
virCapabilitiesClearSecModel(virCapsHostSecModelPtr secmodel) virCapabilitiesClearSecModel(virCapsHostSecModel *secmodel)
{ {
size_t i; size_t i;
for (i = 0; i < secmodel->nlabels; i++) { for (i = 0; i < secmodel->nlabels; i++) {
@ -227,7 +227,7 @@ virCapabilitiesClearSecModel(virCapsHostSecModelPtr secmodel)
static void static void
virCapsDispose(void *object) virCapsDispose(void *object)
{ {
virCapsPtr caps = object; virCaps *caps = object;
size_t i; size_t i;
for (i = 0; i < caps->npools; i++) for (i = 0; i < caps->npools; i++)
@ -277,7 +277,7 @@ virCapsDispose(void *object)
* Registers a new host CPU feature, eg 'pae', or 'vmx' * Registers a new host CPU feature, eg 'pae', or 'vmx'
*/ */
int int
virCapabilitiesAddHostFeature(virCapsPtr caps, virCapabilitiesAddHostFeature(virCaps *caps,
const char *name) const char *name)
{ {
VIR_RESIZE_N(caps->host.features, caps->host.nfeatures_max, VIR_RESIZE_N(caps->host.features, caps->host.nfeatures_max,
@ -296,7 +296,7 @@ virCapabilitiesAddHostFeature(virCapsPtr caps,
* Registers a new domain migration transport URI * Registers a new domain migration transport URI
*/ */
int int
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps, virCapabilitiesAddHostMigrateTransport(virCaps *caps,
const char *name) const char *name)
{ {
VIR_RESIZE_N(caps->host.migrateTrans, caps->host.nmigrateTrans_max, VIR_RESIZE_N(caps->host.migrateTrans, caps->host.nmigrateTrans_max,
@ -315,7 +315,7 @@ virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
* Registers the prefix that is used for generated network interfaces * Registers the prefix that is used for generated network interfaces
*/ */
int int
virCapabilitiesSetNetPrefix(virCapsPtr caps, virCapabilitiesSetNetPrefix(virCaps *caps,
const char *prefix) const char *prefix)
{ {
caps->host.netprefix = g_strdup(prefix); caps->host.netprefix = g_strdup(prefix);
@ -340,17 +340,17 @@ virCapabilitiesSetNetPrefix(virCapsPtr caps,
* array of CPU IDs belonging to the cell * array of CPU IDs belonging to the cell
*/ */
void void
virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps, virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
int num, int num,
unsigned long long mem, unsigned long long mem,
int ncpus, int ncpus,
virCapsHostNUMACellCPUPtr cpus, virCapsHostNUMACellCPU *cpus,
int nsiblings, int nsiblings,
virCapsHostNUMACellSiblingInfoPtr siblings, virCapsHostNUMACellSiblingInfo *siblings,
int npageinfo, int npageinfo,
virCapsHostNUMACellPageInfoPtr pageinfo) virCapsHostNUMACellPageInfo *pageinfo)
{ {
virCapsHostNUMACellPtr cell = g_new0(virCapsHostNUMACell, 1); virCapsHostNUMACell *cell = g_new0(virCapsHostNUMACell, 1);
cell->num = num; cell->num = num;
cell->mem = mem; cell->mem = mem;
@ -369,16 +369,16 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps,
* @machines: machine variants for emulator ('pc', or 'isapc', etc) * @machines: machine variants for emulator ('pc', or 'isapc', etc)
* @nmachines: number of machine variants for emulator * @nmachines: number of machine variants for emulator
* *
* Allocate a table of virCapsGuestMachinePtr from the supplied table * Allocate a table of virCapsGuestMachine *from the supplied table
* of machine names. * of machine names.
*/ */
virCapsGuestMachinePtr * virCapsGuestMachine **
virCapabilitiesAllocMachines(const char *const *names, int nnames) virCapabilitiesAllocMachines(const char *const *names, int nnames)
{ {
virCapsGuestMachinePtr *machines; virCapsGuestMachine **machines;
size_t i; size_t i;
machines = g_new0(virCapsGuestMachinePtr, nnames); machines = g_new0(virCapsGuestMachine *, nnames);
for (i = 0; i < nnames; i++) { for (i = 0; i < nnames; i++) {
machines[i] = g_new0(virCapsGuestMachine, 1); machines[i] = g_new0(virCapsGuestMachine, 1);
@ -392,10 +392,10 @@ virCapabilitiesAllocMachines(const char *const *names, int nnames)
* virCapabilitiesFreeMachines: * virCapabilitiesFreeMachines:
* @machines: table of vircapsGuestMachinePtr * @machines: table of vircapsGuestMachinePtr
* *
* Free a table of virCapsGuestMachinePtr * Free a table of virCapsGuestMachine *
*/ */
void void
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines, virCapabilitiesFreeMachines(virCapsGuestMachine **machines,
int nmachines) int nmachines)
{ {
size_t i; size_t i;
@ -423,16 +423,16 @@ virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
* followed by registration of at least one domain for * followed by registration of at least one domain for
* running the guest * running the guest
*/ */
virCapsGuestPtr virCapsGuest *
virCapabilitiesAddGuest(virCapsPtr caps, virCapabilitiesAddGuest(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
const char *emulator, const char *emulator,
const char *loader, const char *loader,
int nmachines, int nmachines,
virCapsGuestMachinePtr *machines) virCapsGuestMachine **machines)
{ {
virCapsGuestPtr guest; virCapsGuest *guest;
guest = g_new0(virCapsGuest, 1); guest = g_new0(virCapsGuest, 1);
@ -467,15 +467,15 @@ virCapabilitiesAddGuest(virCapsPtr caps,
* Registers a virtual domain capable of running a * Registers a virtual domain capable of running a
* guest operating system * guest operating system
*/ */
virCapsGuestDomainPtr virCapsGuestDomain *
virCapabilitiesAddGuestDomain(virCapsGuestPtr guest, virCapabilitiesAddGuestDomain(virCapsGuest *guest,
int hvtype, int hvtype,
const char *emulator, const char *emulator,
const char *loader, const char *loader,
int nmachines, int nmachines,
virCapsGuestMachinePtr *machines) virCapsGuestMachine **machines)
{ {
virCapsGuestDomainPtr dom; virCapsGuestDomain *dom;
dom = g_new0(virCapsGuestDomain, 1); dom = g_new0(virCapsGuestDomain, 1);
@ -516,7 +516,7 @@ static const struct virCapsGuestFeatureInfo virCapsGuestFeatureInfos[VIR_CAPS_GU
static void static void
virCapabilitiesAddGuestFeatureInternal(virCapsGuestPtr guest, virCapabilitiesAddGuestFeatureInternal(virCapsGuest *guest,
virCapsGuestFeatureType feature, virCapsGuestFeatureType feature,
bool defaultOn, bool defaultOn,
bool toggle) bool toggle)
@ -538,7 +538,7 @@ virCapabilitiesAddGuestFeatureInternal(virCapsGuestPtr guest,
* Registers a feature for a guest domain. * Registers a feature for a guest domain.
*/ */
void void
virCapabilitiesAddGuestFeature(virCapsGuestPtr guest, virCapabilitiesAddGuestFeature(virCapsGuest *guest,
virCapsGuestFeatureType feature) virCapsGuestFeatureType feature)
{ {
virCapabilitiesAddGuestFeatureInternal(guest, feature, false, false); virCapabilitiesAddGuestFeatureInternal(guest, feature, false, false);
@ -555,7 +555,7 @@ virCapabilitiesAddGuestFeature(virCapsGuestPtr guest,
* Registers a feature with toggles for a guest domain. * Registers a feature with toggles for a guest domain.
*/ */
void void
virCapabilitiesAddGuestFeatureWithToggle(virCapsGuestPtr guest, virCapabilitiesAddGuestFeatureWithToggle(virCapsGuest *guest,
virCapsGuestFeatureType feature, virCapsGuestFeatureType feature,
bool defaultOn, bool defaultOn,
bool toggle) bool toggle)
@ -573,7 +573,7 @@ virCapabilitiesAddGuestFeatureWithToggle(virCapsGuestPtr guest,
* Returns non-zero on error. * Returns non-zero on error.
*/ */
extern int extern int
virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModelPtr secmodel, virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModel *secmodel,
const char *type, const char *type,
const char *label) const char *label)
{ {
@ -588,24 +588,24 @@ virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModelPtr secmodel,
} }
static virCapsDomainDataPtr static virCapsDomainData *
virCapabilitiesDomainDataLookupInternal(virCapsPtr caps, virCapabilitiesDomainDataLookupInternal(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
virDomainVirtType domaintype, virDomainVirtType domaintype,
const char *emulator, const char *emulator,
const char *machinetype) const char *machinetype)
{ {
virCapsGuestPtr foundguest = NULL; virCapsGuest *foundguest = NULL;
virCapsGuestDomainPtr founddomain = NULL; virCapsGuestDomain *founddomain = NULL;
virCapsGuestMachinePtr foundmachine = NULL; virCapsGuestMachine *foundmachine = NULL;
virCapsDomainDataPtr ret = NULL; virCapsDomainData *ret = NULL;
size_t i, j, k; size_t i, j, k;
VIR_DEBUG("Lookup ostype=%d arch=%d domaintype=%d emulator=%s machine=%s", VIR_DEBUG("Lookup ostype=%d arch=%d domaintype=%d emulator=%s machine=%s",
ostype, arch, domaintype, NULLSTR(emulator), NULLSTR(machinetype)); ostype, arch, domaintype, NULLSTR(emulator), NULLSTR(machinetype));
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
virCapsGuestPtr guest = caps->guests[i]; virCapsGuest *guest = caps->guests[i];
if (ostype != -1 && guest->ostype != ostype) { if (ostype != -1 && guest->ostype != ostype) {
VIR_DEBUG("Skip os type want=%d vs got=%d", ostype, guest->ostype); VIR_DEBUG("Skip os type want=%d vs got=%d", ostype, guest->ostype);
@ -620,8 +620,8 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
VIR_DEBUG("Match arch %d", arch); VIR_DEBUG("Match arch %d", arch);
for (j = 0; j < guest->arch.ndomains; j++) { for (j = 0; j < guest->arch.ndomains; j++) {
virCapsGuestDomainPtr domain = guest->arch.domains[j]; virCapsGuestDomain *domain = guest->arch.domains[j];
virCapsGuestMachinePtr *machinelist; virCapsGuestMachine **machinelist;
int nmachines; int nmachines;
const char *check_emulator = NULL; const char *check_emulator = NULL;
@ -651,7 +651,7 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
} }
for (k = 0; k < nmachines; k++) { for (k = 0; k < nmachines; k++) {
virCapsGuestMachinePtr machine = machinelist[k]; virCapsGuestMachine *machine = machinelist[k];
if (machinetype && if (machinetype &&
STRNEQ(machine->name, machinetype) && STRNEQ(machine->name, machinetype) &&
@ -733,15 +733,15 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
* Search capabilities for the passed values, and if found return * Search capabilities for the passed values, and if found return
* virCapabilitiesDomainDataLookup filled in with the default values * virCapabilitiesDomainDataLookup filled in with the default values
*/ */
virCapsDomainDataPtr virCapsDomainData *
virCapabilitiesDomainDataLookup(virCapsPtr caps, virCapabilitiesDomainDataLookup(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
int domaintype, int domaintype,
const char *emulator, const char *emulator,
const char *machinetype) const char *machinetype)
{ {
virCapsDomainDataPtr ret; virCapsDomainData *ret;
if (arch == VIR_ARCH_NONE) { if (arch == VIR_ARCH_NONE) {
/* Prefer host arch if its available */ /* Prefer host arch if its available */
@ -760,12 +760,12 @@ virCapabilitiesDomainDataLookup(virCapsPtr caps,
bool bool
virCapabilitiesDomainSupported(virCapsPtr caps, virCapabilitiesDomainSupported(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
int virttype) int virttype)
{ {
g_autofree virCapsDomainDataPtr capsdata = NULL; g_autofree virCapsDomainData *capsdata = NULL;
capsdata = virCapabilitiesDomainDataLookup(caps, ostype, capsdata = virCapabilitiesDomainDataLookup(caps, ostype,
arch, arch,
@ -777,10 +777,10 @@ virCapabilitiesDomainSupported(virCapsPtr caps,
int int
virCapabilitiesAddStoragePool(virCapsPtr caps, virCapabilitiesAddStoragePool(virCaps *caps,
int poolType) int poolType)
{ {
virCapsStoragePoolPtr pool; virCapsStoragePool *pool;
pool = g_new0(virCapsStoragePool, 1); pool = g_new0(virCapsStoragePool, 1);
@ -794,8 +794,8 @@ virCapabilitiesAddStoragePool(virCapsPtr caps,
static int static int
virCapabilitiesHostNUMAFormat(virCapsHostNUMAPtr caps, virCapabilitiesHostNUMAFormat(virCapsHostNUMA *caps,
virBufferPtr buf) virBuffer *buf)
{ {
size_t i; size_t i;
size_t j; size_t j;
@ -806,7 +806,7 @@ virCapabilitiesHostNUMAFormat(virCapsHostNUMAPtr caps,
virBufferAsprintf(buf, "<cells num='%d'>\n", caps->cells->len); virBufferAsprintf(buf, "<cells num='%d'>\n", caps->cells->len);
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (i = 0; i < caps->cells->len; i++) { for (i = 0; i < caps->cells->len; i++) {
virCapsHostNUMACellPtr cell = g_ptr_array_index(caps->cells, i); virCapsHostNUMACell *cell = g_ptr_array_index(caps->cells, i);
virBufferAsprintf(buf, "<cell id='%d'>\n", cell->num); virBufferAsprintf(buf, "<cell id='%d'>\n", cell->num);
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
@ -866,8 +866,8 @@ virCapabilitiesHostNUMAFormat(virCapsHostNUMAPtr caps,
static int static int
virCapabilitiesFormatResctrlMonitor(virBufferPtr buf, virCapabilitiesFormatResctrlMonitor(virBuffer *buf,
virResctrlInfoMonPtr monitor) virResctrlInfoMon *monitor)
{ {
size_t i = 0; size_t i = 0;
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
@ -905,8 +905,8 @@ virCapabilitiesFormatResctrlMonitor(virBufferPtr buf,
} }
static int static int
virCapabilitiesFormatCaches(virBufferPtr buf, virCapabilitiesFormatCaches(virBuffer *buf,
virCapsHostCachePtr cache) virCapsHostCache *cache)
{ {
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;
@ -920,7 +920,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
for (i = 0; i < cache->nbanks; i++) { for (i = 0; i < cache->nbanks; i++) {
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
virCapsHostCacheBankPtr bank = cache->banks[i]; virCapsHostCacheBank *bank = cache->banks[i];
g_autofree char *cpus_str = virBitmapFormat(bank->cpus); g_autofree char *cpus_str = virBitmapFormat(bank->cpus);
const char *unit = NULL; const char *unit = NULL;
unsigned long long short_size = virFormatIntPretty(bank->size, &unit); unsigned long long short_size = virFormatIntPretty(bank->size, &unit);
@ -941,7 +941,7 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
for (j = 0; j < bank->ncontrols; j++) { for (j = 0; j < bank->ncontrols; j++) {
const char *min_unit; const char *min_unit;
virResctrlInfoPerCachePtr controls = bank->controls[j]; virResctrlInfoPerCache *controls = bank->controls[j];
unsigned long long gran_short_size = controls->granularity; unsigned long long gran_short_size = controls->granularity;
unsigned long long min_short_size = controls->min; unsigned long long min_short_size = controls->min;
@ -991,8 +991,8 @@ virCapabilitiesFormatCaches(virBufferPtr buf,
} }
static int static int
virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf, virCapabilitiesFormatMemoryBandwidth(virBuffer *buf,
virCapsHostMemBWPtr memBW) virCapsHostMemBW *memBW)
{ {
size_t i = 0; size_t i = 0;
@ -1005,8 +1005,8 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf,
for (i = 0; i < memBW->nnodes; i++) { for (i = 0; i < memBW->nnodes; i++) {
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
virCapsHostMemBWNodePtr node = memBW->nodes[i]; virCapsHostMemBWNode *node = memBW->nodes[i];
virResctrlInfoMemBWPerNodePtr control = &node->control; virResctrlInfoMemBWPerNode *control = &node->control;
g_autofree char *cpus_str = virBitmapFormat(node->cpus); g_autofree char *cpus_str = virBitmapFormat(node->cpus);
if (!cpus_str) if (!cpus_str)
@ -1036,8 +1036,8 @@ virCapabilitiesFormatMemoryBandwidth(virBufferPtr buf,
static int static int
virCapabilitiesFormatHostXML(virCapsHostPtr host, virCapabilitiesFormatHostXML(virCapsHost *host,
virBufferPtr buf) virBuffer *buf)
{ {
size_t i, j; size_t i, j;
char host_uuid[VIR_UUID_STRING_BUFLEN]; char host_uuid[VIR_UUID_STRING_BUFLEN];
@ -1159,14 +1159,14 @@ virCapabilitiesFormatHostXML(virCapsHostPtr host,
static void static void
virCapabilitiesFormatGuestFeatures(virCapsGuestPtr guest, virCapabilitiesFormatGuestFeatures(virCapsGuest *guest,
virBufferPtr buf) virBuffer *buf)
{ {
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
size_t i; size_t i;
for (i = 0; i < VIR_CAPS_GUEST_FEATURE_TYPE_LAST; i++) { for (i = 0; i < VIR_CAPS_GUEST_FEATURE_TYPE_LAST; i++) {
virCapsGuestFeaturePtr feature = guest->features + i; virCapsGuestFeature *feature = guest->features + i;
if (!feature->present) if (!feature->present)
continue; continue;
@ -1191,9 +1191,9 @@ virCapabilitiesFormatGuestFeatures(virCapsGuestPtr guest,
static void static void
virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests, virCapabilitiesFormatGuestXML(virCapsGuest **guests,
size_t nguests, size_t nguests,
virBufferPtr buf) virBuffer *buf)
{ {
size_t i, j, k; size_t i, j, k;
@ -1216,7 +1216,7 @@ virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests,
guests[i]->arch.defaultInfo.loader); guests[i]->arch.defaultInfo.loader);
for (j = 0; j < guests[i]->arch.defaultInfo.nmachines; j++) { for (j = 0; j < guests[i]->arch.defaultInfo.nmachines; j++) {
virCapsGuestMachinePtr machine = guests[i]->arch.defaultInfo.machines[j]; virCapsGuestMachine *machine = guests[i]->arch.defaultInfo.machines[j];
virBufferAddLit(buf, "<machine"); virBufferAddLit(buf, "<machine");
if (machine->canonical) if (machine->canonical)
virBufferAsprintf(buf, " canonical='%s'", machine->canonical); virBufferAsprintf(buf, " canonical='%s'", machine->canonical);
@ -1246,7 +1246,7 @@ virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests,
guests[i]->arch.domains[j]->info.loader); guests[i]->arch.domains[j]->info.loader);
for (k = 0; k < guests[i]->arch.domains[j]->info.nmachines; k++) { for (k = 0; k < guests[i]->arch.domains[j]->info.nmachines; k++) {
virCapsGuestMachinePtr machine = guests[i]->arch.domains[j]->info.machines[k]; virCapsGuestMachine *machine = guests[i]->arch.domains[j]->info.machines[k];
virBufferAddLit(buf, "<machine"); virBufferAddLit(buf, "<machine");
if (machine->canonical) if (machine->canonical)
virBufferAsprintf(buf, " canonical='%s'", machine->canonical); virBufferAsprintf(buf, " canonical='%s'", machine->canonical);
@ -1270,9 +1270,9 @@ virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests,
static void static void
virCapabilitiesFormatStoragePoolXML(virCapsStoragePoolPtr *pools, virCapabilitiesFormatStoragePoolXML(virCapsStoragePool **pools,
size_t npools, size_t npools,
virBufferPtr buf) virBuffer *buf)
{ {
size_t i; size_t i;
@ -1304,7 +1304,7 @@ virCapabilitiesFormatStoragePoolXML(virCapsStoragePoolPtr *pools,
* Returns the XML document as a string * Returns the XML document as a string
*/ */
char * char *
virCapabilitiesFormatXML(virCapsPtr caps) virCapabilitiesFormatXML(virCaps *caps)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@ -1326,15 +1326,14 @@ virCapabilitiesFormatXML(virCapsPtr caps)
/* get the maximum ID of cpus in the host */ /* get the maximum ID of cpus in the host */
static unsigned int static unsigned int
virCapabilitiesHostNUMAGetMaxcpu(virCapsHostNUMAPtr caps) virCapabilitiesHostNUMAGetMaxcpu(virCapsHostNUMA *caps)
{ {
unsigned int maxcpu = 0; unsigned int maxcpu = 0;
size_t node; size_t node;
size_t cpu; size_t cpu;
for (node = 0; node < caps->cells->len; node++) { for (node = 0; node < caps->cells->len; node++) {
virCapsHostNUMACellPtr cell = virCapsHostNUMACell *cell = g_ptr_array_index(caps->cells, node);
g_ptr_array_index(caps->cells, node);
for (cpu = 0; cpu < cell->ncpus; cpu++) { for (cpu = 0; cpu < cell->ncpus; cpu++) {
if (cell->cpus[cpu].id > maxcpu) if (cell->cpus[cpu].id > maxcpu)
@ -1347,11 +1346,11 @@ virCapabilitiesHostNUMAGetMaxcpu(virCapsHostNUMAPtr caps)
/* set cpus of a numa node in the bitmask */ /* set cpus of a numa node in the bitmask */
static int static int
virCapabilitiesHostNUMAGetCellCpus(virCapsHostNUMAPtr caps, virCapabilitiesHostNUMAGetCellCpus(virCapsHostNUMA *caps,
size_t node, size_t node,
virBitmapPtr cpumask) virBitmap *cpumask)
{ {
virCapsHostNUMACellPtr cell = NULL; virCapsHostNUMACell *cell = NULL;
size_t cpu; size_t cpu;
size_t i; size_t i;
/* The numa node numbers can be non-contiguous. Ex: 0,1,16,17. */ /* The numa node numbers can be non-contiguous. Ex: 0,1,16,17. */
@ -1375,11 +1374,11 @@ virCapabilitiesHostNUMAGetCellCpus(virCapsHostNUMAPtr caps,
return 0; return 0;
} }
virBitmapPtr virBitmap *
virCapabilitiesHostNUMAGetCpus(virCapsHostNUMAPtr caps, virCapabilitiesHostNUMAGetCpus(virCapsHostNUMA *caps,
virBitmapPtr nodemask) virBitmap *nodemask)
{ {
virBitmapPtr ret = NULL; virBitmap *ret = NULL;
unsigned int maxcpu = virCapabilitiesHostNUMAGetMaxcpu(caps); unsigned int maxcpu = virCapabilitiesHostNUMAGetMaxcpu(caps);
ssize_t node = -1; ssize_t node = -1;
@ -1423,7 +1422,7 @@ virCapabilitiesGetNodeInfo(virNodeInfoPtr nodeinfo)
/* returns 1 on success, 0 if the detection failed and -1 on hard error */ /* returns 1 on success, 0 if the detection failed and -1 on hard error */
static int static int
virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED, virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED,
virCapsHostNUMACellCPUPtr cpu G_GNUC_UNUSED) virCapsHostNUMACellCPU *cpu G_GNUC_UNUSED)
{ {
#ifdef __linux__ #ifdef __linux__
cpu->id = cpu_id; cpu->id = cpu_id;
@ -1446,10 +1445,10 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED,
static int static int
virCapabilitiesGetNUMASiblingInfo(int node, virCapabilitiesGetNUMASiblingInfo(int node,
virCapsHostNUMACellSiblingInfoPtr *siblings, virCapsHostNUMACellSiblingInfo **siblings,
int *nsiblings) int *nsiblings)
{ {
virCapsHostNUMACellSiblingInfoPtr tmp = NULL; virCapsHostNUMACellSiblingInfo *tmp = NULL;
int tmp_size = 0; int tmp_size = 0;
int ret = -1; int ret = -1;
int *distances = NULL; int *distances = NULL;
@ -1490,7 +1489,7 @@ virCapabilitiesGetNUMASiblingInfo(int node,
static int static int
virCapabilitiesGetNUMAPagesInfo(int node, virCapabilitiesGetNUMAPagesInfo(int node,
virCapsHostNUMACellPageInfoPtr *pageinfo, virCapsHostNUMACellPageInfo **pageinfo,
int *npageinfo) int *npageinfo)
{ {
int ret = -1; int ret = -1;
@ -1519,10 +1518,10 @@ virCapabilitiesGetNUMAPagesInfo(int node,
static int static int
virCapabilitiesHostNUMAInitFake(virCapsHostNUMAPtr caps) virCapabilitiesHostNUMAInitFake(virCapsHostNUMA *caps)
{ {
virNodeInfo nodeinfo; virNodeInfo nodeinfo;
virCapsHostNUMACellCPUPtr cpus; virCapsHostNUMACellCPU *cpus;
int ncpus; int ncpus;
int n, s, c, t; int n, s, c, t;
int id, cid; int id, cid;
@ -1583,15 +1582,15 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMAPtr caps)
static int static int
virCapabilitiesHostNUMAInitReal(virCapsHostNUMAPtr caps) virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
{ {
int n; int n;
unsigned long long memory; unsigned long long memory;
virCapsHostNUMACellCPUPtr cpus = NULL; virCapsHostNUMACellCPU *cpus = NULL;
virBitmapPtr cpumap = NULL; virBitmap *cpumap = NULL;
virCapsHostNUMACellSiblingInfoPtr siblings = NULL; virCapsHostNUMACellSiblingInfo *siblings = NULL;
int nsiblings = 0; int nsiblings = 0;
virCapsHostNUMACellPageInfoPtr pageinfo = NULL; virCapsHostNUMACellPageInfo *pageinfo = NULL;
int npageinfo; int npageinfo;
int ret = -1; int ret = -1;
int ncpus = 0; int ncpus = 0;
@ -1654,10 +1653,10 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMAPtr caps)
} }
virCapsHostNUMAPtr virCapsHostNUMA *
virCapabilitiesHostNUMANew(void) virCapabilitiesHostNUMANew(void)
{ {
virCapsHostNUMAPtr caps = NULL; virCapsHostNUMA *caps = NULL;
caps = g_new0(virCapsHostNUMA, 1); caps = g_new0(virCapsHostNUMA, 1);
caps->refs = 1; caps->refs = 1;
@ -1668,10 +1667,10 @@ virCapabilitiesHostNUMANew(void)
} }
virCapsHostNUMAPtr virCapsHostNUMA *
virCapabilitiesHostNUMANewHost(void) virCapabilitiesHostNUMANewHost(void)
{ {
virCapsHostNUMAPtr caps = virCapabilitiesHostNUMANew(); virCapsHostNUMA *caps = virCapabilitiesHostNUMANew();
if (virNumaIsAvailable()) { if (virNumaIsAvailable()) {
if (virCapabilitiesHostNUMAInitReal(caps) == 0) if (virCapabilitiesHostNUMAInitReal(caps) == 0)
@ -1692,7 +1691,7 @@ virCapabilitiesHostNUMANewHost(void)
int int
virCapabilitiesInitPages(virCapsPtr caps) virCapabilitiesInitPages(virCaps *caps)
{ {
int ret = -1; int ret = -1;
unsigned int *pages_size = NULL; unsigned int *pages_size = NULL;
@ -1714,8 +1713,8 @@ virCapabilitiesInitPages(virCapsPtr caps)
bool bool
virCapsHostCacheBankEquals(virCapsHostCacheBankPtr a, virCapsHostCacheBankEquals(virCapsHostCacheBank *a,
virCapsHostCacheBankPtr b) virCapsHostCacheBank *b)
{ {
return (a->id == b->id && return (a->id == b->id &&
a->level == b->level && a->level == b->level &&
@ -1725,7 +1724,7 @@ virCapsHostCacheBankEquals(virCapsHostCacheBankPtr a,
} }
void void
virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr) virCapsHostCacheBankFree(virCapsHostCacheBank *ptr)
{ {
size_t i; size_t i;
@ -1744,8 +1743,8 @@ static int
virCapsHostCacheBankSorter(const void *a, virCapsHostCacheBankSorter(const void *a,
const void *b) const void *b)
{ {
virCapsHostCacheBankPtr ca = *(virCapsHostCacheBankPtr *)a; virCapsHostCacheBank *ca = *(virCapsHostCacheBank **)a;
virCapsHostCacheBankPtr cb = *(virCapsHostCacheBankPtr *)b; virCapsHostCacheBank *cb = *(virCapsHostCacheBank **)b;
if (ca->level < cb->level) if (ca->level < cb->level)
return -1; return -1;
@ -1757,7 +1756,7 @@ virCapsHostCacheBankSorter(const void *a,
static int static int
virCapabilitiesInitResctrl(virCapsPtr caps) virCapabilitiesInitResctrl(virCaps *caps)
{ {
if (caps->host.resctrl) if (caps->host.resctrl)
return 0; return 0;
@ -1771,16 +1770,16 @@ virCapabilitiesInitResctrl(virCapsPtr caps)
static int static int
virCapabilitiesInitResctrlMemory(virCapsPtr caps) virCapabilitiesInitResctrlMemory(virCaps *caps)
{ {
virCapsHostMemBWNodePtr node = NULL; virCapsHostMemBWNode *node = NULL;
size_t i = 0; size_t i = 0;
int ret = -1; int ret = -1;
const virResctrlMonitorType montype = VIR_RESCTRL_MONITOR_TYPE_MEMBW; const virResctrlMonitorType montype = VIR_RESCTRL_MONITOR_TYPE_MEMBW;
const char *prefix = virResctrlMonitorPrefixTypeToString(montype); const char *prefix = virResctrlMonitorPrefixTypeToString(montype);
for (i = 0; i < caps->host.cache.nbanks; i++) { for (i = 0; i < caps->host.cache.nbanks; i++) {
virCapsHostCacheBankPtr bank = caps->host.cache.banks[i]; virCapsHostCacheBank *bank = caps->host.cache.banks[i];
node = g_new0(virCapsHostMemBWNode, 1); node = g_new0(virCapsHostMemBWNode, 1);
if (virResctrlInfoGetMemoryBandwidth(caps->host.resctrl, if (virResctrlInfoGetMemoryBandwidth(caps->host.resctrl,
@ -1809,16 +1808,16 @@ virCapabilitiesInitResctrlMemory(virCapsPtr caps)
int int
virCapabilitiesInitCaches(virCapsPtr caps) virCapabilitiesInitCaches(virCaps *caps)
{ {
size_t i = 0; size_t i = 0;
virBitmapPtr cpus = NULL; virBitmap *cpus = NULL;
ssize_t pos = -1; ssize_t pos = -1;
int ret = -1; int ret = -1;
char *path = NULL; char *path = NULL;
char *type = NULL; char *type = NULL;
struct dirent *ent = NULL; struct dirent *ent = NULL;
virCapsHostCacheBankPtr bank = NULL; virCapsHostCacheBank *bank = NULL;
const virResctrlMonitorType montype = VIR_RESCTRL_MONITOR_TYPE_CACHE; const virResctrlMonitorType montype = VIR_RESCTRL_MONITOR_TYPE_CACHE;
const char *prefix = virResctrlMonitorPrefixTypeToString(montype); const char *prefix = virResctrlMonitorPrefixTypeToString(montype);
@ -1952,7 +1951,7 @@ virCapabilitiesInitCaches(virCapsPtr caps)
void void
virCapabilitiesHostInitIOMMU(virCapsPtr caps) virCapabilitiesHostInitIOMMU(virCaps *caps)
{ {
caps->host.iommu = virHostHasIOMMU(); caps->host.iommu = virHostHasIOMMU();
} }

View File

@ -63,7 +63,7 @@ struct _virCapsGuestDomainInfo {
char *emulator; char *emulator;
char *loader; char *loader;
int nmachines; int nmachines;
virCapsGuestMachinePtr *machines; virCapsGuestMachine **machines;
}; };
struct _virCapsGuestDomain { struct _virCapsGuestDomain {
@ -77,7 +77,7 @@ struct _virCapsGuestArch {
virCapsGuestDomainInfo defaultInfo; virCapsGuestDomainInfo defaultInfo;
size_t ndomains; size_t ndomains;
size_t ndomains_max; size_t ndomains_max;
virCapsGuestDomainPtr *domains; virCapsGuestDomain **domains;
}; };
struct _virCapsGuest { struct _virCapsGuest {
@ -91,7 +91,7 @@ struct _virCapsHostNUMACellCPU {
unsigned int socket_id; unsigned int socket_id;
unsigned int die_id; unsigned int die_id;
unsigned int core_id; unsigned int core_id;
virBitmapPtr siblings; virBitmap *siblings;
}; };
struct _virCapsHostNUMACellSiblingInfo { struct _virCapsHostNUMACellSiblingInfo {
@ -108,11 +108,11 @@ struct _virCapsHostNUMACell {
int num; int num;
int ncpus; int ncpus;
unsigned long long mem; /* in kibibytes */ unsigned long long mem; /* in kibibytes */
virCapsHostNUMACellCPUPtr cpus; virCapsHostNUMACellCPU *cpus;
int nsiblings; int nsiblings;
virCapsHostNUMACellSiblingInfoPtr siblings; virCapsHostNUMACellSiblingInfo *siblings;
int npageinfo; int npageinfo;
virCapsHostNUMACellPageInfoPtr pageinfo; virCapsHostNUMACellPageInfo *pageinfo;
}; };
struct _virCapsHostNUMA { struct _virCapsHostNUMA {
@ -129,7 +129,7 @@ struct _virCapsHostSecModel {
char *model; char *model;
char *doi; char *doi;
size_t nlabels; size_t nlabels;
virCapsHostSecModelLabelPtr labels; virCapsHostSecModelLabel *labels;
}; };
struct _virCapsHostCacheBank { struct _virCapsHostCacheBank {
@ -137,29 +137,29 @@ struct _virCapsHostCacheBank {
unsigned int level; /* 1=L1, 2=L2, 3=L3, etc. */ unsigned int level; /* 1=L1, 2=L2, 3=L3, etc. */
unsigned long long size; /* B */ unsigned long long size; /* B */
virCacheType type; /* Data, Instruction or Unified */ virCacheType type; /* Data, Instruction or Unified */
virBitmapPtr cpus; /* All CPUs that share this bank */ virBitmap *cpus; /* All CPUs that share this bank */
size_t ncontrols; size_t ncontrols;
virResctrlInfoPerCachePtr *controls; virResctrlInfoPerCache **controls;
}; };
struct _virCapsHostCache { struct _virCapsHostCache {
size_t nbanks; size_t nbanks;
virCapsHostCacheBankPtr *banks; virCapsHostCacheBank **banks;
virResctrlInfoMonPtr monitor; virResctrlInfoMon *monitor;
}; };
struct _virCapsHostMemBWNode { struct _virCapsHostMemBWNode {
unsigned int id; unsigned int id;
virBitmapPtr cpus; /* All CPUs that belong to this node */ virBitmap *cpus; /* All CPUs that belong to this node */
virResctrlInfoMemBWPerNode control; virResctrlInfoMemBWPerNode control;
}; };
struct _virCapsHostMemBW { struct _virCapsHostMemBW {
size_t nnodes; size_t nnodes;
virCapsHostMemBWNodePtr *nodes; virCapsHostMemBWNode **nodes;
virResctrlInfoMonPtr monitor; virResctrlInfoMon *monitor;
}; };
struct _virCapsHost { struct _virCapsHost {
@ -176,19 +176,19 @@ struct _virCapsHost {
size_t nmigrateTrans_max; size_t nmigrateTrans_max;
char **migrateTrans; char **migrateTrans;
virCapsHostNUMAPtr numa; virCapsHostNUMA *numa;
virResctrlInfoPtr resctrl; virResctrlInfo *resctrl;
virCapsHostCache cache; virCapsHostCache cache;
virCapsHostMemBW memBW; virCapsHostMemBW memBW;
size_t nsecModels; size_t nsecModels;
virCapsHostSecModelPtr secModels; virCapsHostSecModel *secModels;
char *netprefix; char *netprefix;
virCPUDefPtr cpu; virCPUDef *cpu;
int nPagesSize; /* size of pagesSize array */ int nPagesSize; /* size of pagesSize array */
unsigned int *pagesSize; /* page sizes support on the system */ unsigned int *pagesSize; /* page sizes support on the system */
unsigned char host_uuid[VIR_UUID_BUFLEN]; unsigned char host_uuid[VIR_UUID_BUFLEN];
@ -206,11 +206,11 @@ struct _virCaps {
virCapsHost host; virCapsHost host;
size_t nguests; size_t nguests;
size_t nguests_max; size_t nguests_max;
virCapsGuestPtr *guests; virCapsGuest **guests;
size_t npools; size_t npools;
size_t npools_max; size_t npools_max;
virCapsStoragePoolPtr *pools; virCapsStoragePool **pools;
}; };
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCaps, virObjectUnref); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCaps, virObjectUnref);
@ -225,88 +225,88 @@ struct _virCapsDomainData {
}; };
virCapsPtr virCaps *
virCapabilitiesNew(virArch hostarch, virCapabilitiesNew(virArch hostarch,
bool offlineMigrate, bool offlineMigrate,
bool liveMigrate); bool liveMigrate);
void void
virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps); virCapabilitiesHostNUMAUnref(virCapsHostNUMA *caps);
void void
virCapabilitiesHostNUMARef(virCapsHostNUMAPtr caps); virCapabilitiesHostNUMARef(virCapsHostNUMA *caps);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCapsHostNUMA, virCapabilitiesHostNUMAUnref); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCapsHostNUMA, virCapabilitiesHostNUMAUnref);
int int
virCapabilitiesAddHostFeature(virCapsPtr caps, virCapabilitiesAddHostFeature(virCaps *caps,
const char *name); const char *name);
int int
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps, virCapabilitiesAddHostMigrateTransport(virCaps *caps,
const char *name); const char *name);
int int
virCapabilitiesSetNetPrefix(virCapsPtr caps, virCapabilitiesSetNetPrefix(virCaps *caps,
const char *prefix); const char *prefix);
void void
virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps, virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
int num, int num,
unsigned long long mem, unsigned long long mem,
int ncpus, int ncpus,
virCapsHostNUMACellCPUPtr cpus, virCapsHostNUMACellCPU *cpus,
int nsiblings, int nsiblings,
virCapsHostNUMACellSiblingInfoPtr siblings, virCapsHostNUMACellSiblingInfo *siblings,
int npageinfo, int npageinfo,
virCapsHostNUMACellPageInfoPtr pageinfo); virCapsHostNUMACellPageInfo *pageinfo);
virCapsGuestMachinePtr * virCapsGuestMachine **
virCapabilitiesAllocMachines(const char *const *names, virCapabilitiesAllocMachines(const char *const *names,
int nnames); int nnames);
void void
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines, virCapabilitiesFreeMachines(virCapsGuestMachine **machines,
int nmachines); int nmachines);
void void
virCapabilitiesFreeGuest(virCapsGuestPtr guest); virCapabilitiesFreeGuest(virCapsGuest *guest);
virCapsGuestPtr virCapsGuest *
virCapabilitiesAddGuest(virCapsPtr caps, virCapabilitiesAddGuest(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
const char *emulator, const char *emulator,
const char *loader, const char *loader,
int nmachines, int nmachines,
virCapsGuestMachinePtr *machines); virCapsGuestMachine **machines);
virCapsGuestDomainPtr virCapsGuestDomain *
virCapabilitiesAddGuestDomain(virCapsGuestPtr guest, virCapabilitiesAddGuestDomain(virCapsGuest *guest,
int hvtype, int hvtype,
const char *emulator, const char *emulator,
const char *loader, const char *loader,
int nmachines, int nmachines,
virCapsGuestMachinePtr *machines); virCapsGuestMachine **machines);
void void
virCapabilitiesAddGuestFeature(virCapsGuestPtr guest, virCapabilitiesAddGuestFeature(virCapsGuest *guest,
virCapsGuestFeatureType feature); virCapsGuestFeatureType feature);
void void
virCapabilitiesAddGuestFeatureWithToggle(virCapsGuestPtr guest, virCapabilitiesAddGuestFeatureWithToggle(virCapsGuest *guest,
virCapsGuestFeatureType feature, virCapsGuestFeatureType feature,
bool defaultOn, bool defaultOn,
bool toggle); bool toggle);
int int
virCapabilitiesAddStoragePool(virCapsPtr caps, virCapabilitiesAddStoragePool(virCaps *caps,
int poolType); int poolType);
int int
virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModelPtr secmodel, virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModel *secmodel,
const char *type, const char *type,
const char *label); const char *label);
virCapsDomainDataPtr virCapsDomainData *
virCapabilitiesDomainDataLookup(virCapsPtr caps, virCapabilitiesDomainDataLookup(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
int domaintype, int domaintype,
@ -314,33 +314,33 @@ virCapabilitiesDomainDataLookup(virCapsPtr caps,
const char *machinetype); const char *machinetype);
bool bool
virCapabilitiesDomainSupported(virCapsPtr caps, virCapabilitiesDomainSupported(virCaps *caps,
int ostype, int ostype,
virArch arch, virArch arch,
int domaintype); int domaintype);
void void
virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPUPtr cpu, virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPU *cpu,
size_t ncpus); size_t ncpus);
char * char *
virCapabilitiesFormatXML(virCapsPtr caps); virCapabilitiesFormatXML(virCaps *caps);
virBitmapPtr virCapabilitiesHostNUMAGetCpus(virCapsHostNUMAPtr caps, virBitmap *virCapabilitiesHostNUMAGetCpus(virCapsHostNUMA *caps,
virBitmapPtr nodemask); virBitmap *nodemask);
int virCapabilitiesGetNodeInfo(virNodeInfoPtr nodeinfo); int virCapabilitiesGetNodeInfo(virNodeInfoPtr nodeinfo);
int virCapabilitiesInitPages(virCapsPtr caps); int virCapabilitiesInitPages(virCaps *caps);
virCapsHostNUMAPtr virCapabilitiesHostNUMANew(void); virCapsHostNUMA *virCapabilitiesHostNUMANew(void);
virCapsHostNUMAPtr virCapabilitiesHostNUMANewHost(void); virCapsHostNUMA *virCapabilitiesHostNUMANewHost(void);
bool virCapsHostCacheBankEquals(virCapsHostCacheBankPtr a, bool virCapsHostCacheBankEquals(virCapsHostCacheBank *a,
virCapsHostCacheBankPtr b); virCapsHostCacheBank *b);
void virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr); void virCapsHostCacheBankFree(virCapsHostCacheBank *ptr);
int virCapabilitiesInitCaches(virCapsPtr caps); int virCapabilitiesInitCaches(virCaps *caps);
void virCapabilitiesHostInitIOMMU(virCapsPtr caps); void virCapabilitiesHostInitIOMMU(virCaps *caps);

View File

@ -42,7 +42,7 @@
VIR_LOG_INIT("conf.checkpoint_conf"); VIR_LOG_INIT("conf.checkpoint_conf");
static virClassPtr virDomainCheckpointDefClass; static virClass *virDomainCheckpointDefClass;
static void virDomainCheckpointDefDispose(void *obj); static void virDomainCheckpointDefDispose(void *obj);
static int static int
@ -63,14 +63,14 @@ VIR_ENUM_IMPL(virDomainCheckpoint,
/* Checkpoint Def functions */ /* Checkpoint Def functions */
static void static void
virDomainCheckpointDiskDefClear(virDomainCheckpointDiskDefPtr disk) virDomainCheckpointDiskDefClear(virDomainCheckpointDiskDef *disk)
{ {
VIR_FREE(disk->name); VIR_FREE(disk->name);
VIR_FREE(disk->bitmap); VIR_FREE(disk->bitmap);
} }
/* Allocate a new virDomainCheckpointDef; free with virObjectUnref() */ /* Allocate a new virDomainCheckpointDef; free with virObjectUnref() */
virDomainCheckpointDefPtr virDomainCheckpointDef *
virDomainCheckpointDefNew(void) virDomainCheckpointDefNew(void)
{ {
if (virDomainCheckpointInitialize() < 0) if (virDomainCheckpointInitialize() < 0)
@ -82,7 +82,7 @@ virDomainCheckpointDefNew(void)
static void static void
virDomainCheckpointDefDispose(void *obj) virDomainCheckpointDefDispose(void *obj)
{ {
virDomainCheckpointDefPtr def = obj; virDomainCheckpointDef *def = obj;
size_t i; size_t i;
for (i = 0; i < def->ndisks; i++) for (i = 0; i < def->ndisks; i++)
@ -93,7 +93,7 @@ virDomainCheckpointDefDispose(void *obj)
static int static int
virDomainCheckpointDiskDefParseXML(xmlNodePtr node, virDomainCheckpointDiskDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virDomainCheckpointDiskDefPtr def) virDomainCheckpointDiskDef *def)
{ {
g_autofree char *checkpoint = NULL; g_autofree char *checkpoint = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -117,13 +117,13 @@ virDomainCheckpointDiskDefParseXML(xmlNodePtr node,
/* flags is bitwise-or of virDomainCheckpointParseFlags. /* flags is bitwise-or of virDomainCheckpointParseFlags.
*/ */
static virDomainCheckpointDefPtr static virDomainCheckpointDef *
virDomainCheckpointDefParse(xmlXPathContextPtr ctxt, virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque, void *parseOpaque,
unsigned int flags) unsigned int flags)
{ {
virDomainCheckpointDefPtr ret = NULL; virDomainCheckpointDef *ret = NULL;
size_t i; size_t i;
int n; int n;
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
@ -185,10 +185,10 @@ virDomainCheckpointDefParse(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static virDomainCheckpointDefPtr static virDomainCheckpointDef *
virDomainCheckpointDefParseNode(xmlDocPtr xml, virDomainCheckpointDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque, void *parseOpaque,
unsigned int flags) unsigned int flags)
{ {
@ -216,13 +216,13 @@ virDomainCheckpointDefParseNode(xmlDocPtr xml,
return virDomainCheckpointDefParse(ctxt, xmlopt, parseOpaque, flags); return virDomainCheckpointDefParse(ctxt, xmlopt, parseOpaque, flags);
} }
virDomainCheckpointDefPtr virDomainCheckpointDef *
virDomainCheckpointDefParseString(const char *xmlStr, virDomainCheckpointDefParseString(const char *xmlStr,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque, void *parseOpaque,
unsigned int flags) unsigned int flags)
{ {
virDomainCheckpointDefPtr ret = NULL; virDomainCheckpointDef *ret = NULL;
xmlDocPtr xml; xmlDocPtr xml;
int keepBlanksDefault = xmlKeepBlanksDefault(0); int keepBlanksDefault = xmlKeepBlanksDefault(0);
@ -246,12 +246,12 @@ virDomainCheckpointDefParseString(const char *xmlStr,
* success, -1 on error. * success, -1 on error.
*/ */
static int static int
virDomainCheckpointDefAssignBitmapNames(virDomainCheckpointDefPtr def) virDomainCheckpointDefAssignBitmapNames(virDomainCheckpointDef *def)
{ {
size_t i; size_t i;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
virDomainCheckpointDiskDefPtr disk = &def->disks[i]; virDomainCheckpointDiskDef *disk = &def->disks[i];
if (disk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP || if (disk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP ||
disk->bitmap) disk->bitmap)
@ -270,11 +270,11 @@ virDomainCheckpointDefAssignBitmapNames(virDomainCheckpointDefPtr def)
* if any def->disks[n]->name appears more than once or does not map * if any def->disks[n]->name appears more than once or does not map
* to dom->disks. */ * to dom->disks. */
int int
virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef) virDomainCheckpointAlignDisks(virDomainCheckpointDef *chkdef)
{ {
virDomainDefPtr domdef = chkdef->parent.dom; virDomainDef *domdef = chkdef->parent.dom;
g_autoptr(GHashTable) map = virHashNew(NULL); g_autoptr(GHashTable) map = virHashNew(NULL);
g_autofree virDomainCheckpointDiskDefPtr olddisks = NULL; g_autofree virDomainCheckpointDiskDef *olddisks = NULL;
size_t i; size_t i;
int checkpoint_default = VIR_DOMAIN_CHECKPOINT_TYPE_NONE; int checkpoint_default = VIR_DOMAIN_CHECKPOINT_TYPE_NONE;
@ -304,8 +304,8 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef)
/* Double check requested disks. */ /* Double check requested disks. */
for (i = 0; i < chkdef->ndisks; i++) { for (i = 0; i < chkdef->ndisks; i++) {
virDomainCheckpointDiskDefPtr chkdisk = &chkdef->disks[i]; virDomainCheckpointDiskDef *chkdisk = &chkdef->disks[i];
virDomainDiskDefPtr domdisk = virDomainDiskByName(domdef, chkdisk->name, false); virDomainDiskDef *domdisk = virDomainDiskByName(domdef, chkdisk->name, false);
if (!domdisk) { if (!domdisk) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@ -343,9 +343,9 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr chkdef)
chkdef->ndisks = domdef->ndisks; chkdef->ndisks = domdef->ndisks;
for (i = 0; i < domdef->ndisks; i++) { for (i = 0; i < domdef->ndisks; i++) {
virDomainDiskDefPtr domdisk = domdef->disks[i]; virDomainDiskDef *domdisk = domdef->disks[i];
virDomainCheckpointDiskDefPtr chkdisk = chkdef->disks + i; virDomainCheckpointDiskDef *chkdisk = chkdef->disks + i;
virDomainCheckpointDiskDefPtr existing; virDomainCheckpointDiskDef *existing;
/* copy existing disks */ /* copy existing disks */
if ((existing = virHashLookup(map, domdisk->dst))) { if ((existing = virHashLookup(map, domdisk->dst))) {
@ -391,8 +391,8 @@ unsigned int virDomainCheckpointFormatConvertXMLFlags(unsigned int flags)
static int static int
virDomainCheckpointDiskDefFormat(virBufferPtr buf, virDomainCheckpointDiskDefFormat(virBuffer *buf,
virDomainCheckpointDiskDefPtr disk, virDomainCheckpointDiskDef *disk,
unsigned int flags) unsigned int flags)
{ {
if (!disk->name) if (!disk->name)
@ -413,9 +413,9 @@ virDomainCheckpointDiskDefFormat(virBufferPtr buf,
static int static int
virDomainCheckpointDefFormatInternal(virBufferPtr buf, virDomainCheckpointDefFormatInternal(virBuffer *buf,
virDomainCheckpointDefPtr def, virDomainCheckpointDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
size_t i; size_t i;
@ -469,8 +469,8 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
char * char *
virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def, virDomainCheckpointDefFormat(virDomainCheckpointDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@ -487,11 +487,11 @@ virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
int int
virDomainCheckpointRedefinePrep(virDomainObjPtr vm, virDomainCheckpointRedefinePrep(virDomainObj *vm,
virDomainCheckpointDefPtr def, virDomainCheckpointDef *def,
bool *update_current) bool *update_current)
{ {
virDomainMomentObjPtr parent = NULL; virDomainMomentObj *parent = NULL;
if (virDomainCheckpointCheckCycles(vm->checkpoints, def, vm->def->name) < 0) if (virDomainCheckpointCheckCycles(vm->checkpoints, def, vm->def->name) < 0)
return -1; return -1;
@ -528,14 +528,14 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
} }
virDomainMomentObjPtr virDomainMomentObj *
virDomainCheckpointRedefineCommit(virDomainObjPtr vm, virDomainCheckpointRedefineCommit(virDomainObj *vm,
virDomainCheckpointDefPtr *defptr) virDomainCheckpointDef **defptr)
{ {
virDomainCheckpointDefPtr def = *defptr; virDomainCheckpointDef *def = *defptr;
virDomainMomentObjPtr other = NULL; virDomainMomentObj *other = NULL;
virDomainCheckpointDefPtr otherdef = NULL; virDomainCheckpointDef *otherdef = NULL;
virDomainMomentObjPtr chk = NULL; virDomainMomentObj *chk = NULL;
other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name); other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name);
if (other) { if (other) {

View File

@ -39,7 +39,6 @@ typedef enum {
/* Stores disk-checkpoint information */ /* Stores disk-checkpoint information */
typedef struct _virDomainCheckpointDiskDef virDomainCheckpointDiskDef; typedef struct _virDomainCheckpointDiskDef virDomainCheckpointDiskDef;
typedef virDomainCheckpointDiskDef *virDomainCheckpointDiskDefPtr;
struct _virDomainCheckpointDiskDef { struct _virDomainCheckpointDiskDef {
char *name; /* name matching the <target dev='...' of the domain */ char *name; /* name matching the <target dev='...' of the domain */
int type; /* virDomainCheckpointType */ int type; /* virDomainCheckpointType */
@ -72,30 +71,30 @@ typedef enum {
unsigned int unsigned int
virDomainCheckpointFormatConvertXMLFlags(unsigned int flags); virDomainCheckpointFormatConvertXMLFlags(unsigned int flags);
virDomainCheckpointDefPtr virDomainCheckpointDef *
virDomainCheckpointDefParseString(const char *xmlStr, virDomainCheckpointDefParseString(const char *xmlStr,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque, void *parseOpaque,
unsigned int flags); unsigned int flags);
virDomainCheckpointDefPtr virDomainCheckpointDef *
virDomainCheckpointDefNew(void); virDomainCheckpointDefNew(void);
char * char *
virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def, virDomainCheckpointDefFormat(virDomainCheckpointDef *def,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
int int
virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr checkpoint); virDomainCheckpointAlignDisks(virDomainCheckpointDef *checkpoint);
int int
virDomainCheckpointRedefinePrep(virDomainObjPtr vm, virDomainCheckpointRedefinePrep(virDomainObj *vm,
virDomainCheckpointDefPtr def, virDomainCheckpointDef *def,
bool *update_current); bool *update_current);
virDomainMomentObjPtr virDomainMomentObj *
virDomainCheckpointRedefineCommit(virDomainObjPtr vm, virDomainCheckpointRedefineCommit(virDomainObj *vm,
virDomainCheckpointDefPtr *defptr); virDomainCheckpointDef **defptr);
VIR_ENUM_DECL(virDomainCheckpoint); VIR_ENUM_DECL(virDomainCheckpoint);

View File

@ -85,15 +85,15 @@ VIR_ENUM_IMPL(virCPUCacheMode,
); );
virCPUDefPtr virCPUDefNew(void) virCPUDef *virCPUDefNew(void)
{ {
virCPUDefPtr cpu = g_new0(virCPUDef, 1); virCPUDef *cpu = g_new0(virCPUDef, 1);
cpu->refs = 1; cpu->refs = 1;
return cpu; return cpu;
} }
void void
virCPUDefFreeFeatures(virCPUDefPtr def) virCPUDefFreeFeatures(virCPUDef *def)
{ {
size_t i; size_t i;
@ -106,7 +106,7 @@ virCPUDefFreeFeatures(virCPUDefPtr def)
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def) virCPUDefFreeModel(virCPUDef *def)
{ {
VIR_FREE(def->model); VIR_FREE(def->model);
VIR_FREE(def->vendor); VIR_FREE(def->vendor);
@ -115,13 +115,13 @@ virCPUDefFreeModel(virCPUDefPtr def)
} }
void void
virCPUDefRef(virCPUDefPtr def) virCPUDefRef(virCPUDef *def)
{ {
g_atomic_int_inc(&def->refs); g_atomic_int_inc(&def->refs);
} }
void void
virCPUDefFree(virCPUDefPtr def) virCPUDefFree(virCPUDef *def)
{ {
if (!def) if (!def)
return; return;
@ -136,7 +136,7 @@ virCPUDefFree(virCPUDefPtr def)
int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virCPUDefCopyModel(virCPUDefPtr dst, virCPUDefCopyModel(virCPUDef *dst,
const virCPUDef *src, const virCPUDef *src,
bool resetPolicy) bool resetPolicy)
{ {
@ -145,7 +145,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
int int
virCPUDefCopyModelFilter(virCPUDefPtr dst, virCPUDefCopyModelFilter(virCPUDef *dst,
const virCPUDef *src, const virCPUDef *src,
bool resetPolicy, bool resetPolicy,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
@ -193,8 +193,8 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
* than overwriting it with the values from @src. * than overwriting it with the values from @src.
*/ */
void void
virCPUDefStealModel(virCPUDefPtr dst, virCPUDefStealModel(virCPUDef *dst,
virCPUDefPtr src, virCPUDef *src,
bool keepVendor) bool keepVendor)
{ {
char *vendor = NULL; char *vendor = NULL;
@ -225,7 +225,7 @@ virCPUDefStealModel(virCPUDefPtr dst,
} }
virCPUDefPtr virCPUDef *
virCPUDefCopyWithoutModel(const virCPUDef *cpu) virCPUDefCopyWithoutModel(const virCPUDef *cpu)
{ {
g_autoptr(virCPUDef) copy = NULL; g_autoptr(virCPUDef) copy = NULL;
@ -260,7 +260,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu)
} }
virCPUDefPtr virCPUDef *
virCPUDefCopy(const virCPUDef *cpu) virCPUDefCopy(const virCPUDef *cpu)
{ {
g_autoptr(virCPUDef) copy = NULL; g_autoptr(virCPUDef) copy = NULL;
@ -278,7 +278,7 @@ virCPUDefCopy(const virCPUDef *cpu)
int int
virCPUDefParseXMLString(const char *xml, virCPUDefParseXMLString(const char *xml,
virCPUType type, virCPUType type,
virCPUDefPtr *cpu, virCPUDef **cpu,
bool validateXML) bool validateXML)
{ {
xmlDocPtr doc = NULL; xmlDocPtr doc = NULL;
@ -321,7 +321,7 @@ int
virCPUDefParseXML(xmlXPathContextPtr ctxt, virCPUDefParseXML(xmlXPathContextPtr ctxt,
const char *xpath, const char *xpath,
virCPUType type, virCPUType type,
virCPUDefPtr *cpu, virCPUDef **cpu,
bool validateXML) bool validateXML)
{ {
g_autoptr(virCPUDef) def = NULL; g_autoptr(virCPUDef) def = NULL;
@ -334,7 +334,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
g_autofree char *vendor_id = NULL; g_autofree char *vendor_id = NULL;
g_autofree char *tscScaling = NULL; g_autofree char *tscScaling = NULL;
g_autofree char *migratable = NULL; g_autofree char *migratable = NULL;
g_autofree virHostCPUTscInfoPtr tsc = NULL; g_autofree virHostCPUTscInfo *tsc = NULL;
*cpu = NULL; *cpu = NULL;
@ -676,8 +676,8 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
char * char *
virCPUDefFormat(virCPUDefPtr def, virCPUDefFormat(virCPUDef *def,
virDomainNumaPtr numa) virDomainNuma *numa)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@ -689,9 +689,9 @@ virCPUDefFormat(virCPUDefPtr def,
int int
virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefFormatBufFull(virBuffer *buf,
virCPUDefPtr def, virCPUDef *def,
virDomainNumaPtr numa) virDomainNuma *numa)
{ {
g_auto(virBuffer) attributeBuf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) attributeBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
@ -751,8 +751,8 @@ virCPUDefFormatBufFull(virBufferPtr buf,
} }
int int
virCPUDefFormatBuf(virBufferPtr buf, virCPUDefFormatBuf(virBuffer *buf,
virCPUDefPtr def) virCPUDef *def)
{ {
size_t i; size_t i;
bool formatModel; bool formatModel;
@ -830,7 +830,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
} }
for (i = 0; i < def->nfeatures; i++) { for (i = 0; i < def->nfeatures; i++) {
virCPUFeatureDefPtr feature = def->features + i; virCPUFeatureDef *feature = def->features + i;
if (!feature->name) { if (!feature->name) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -867,12 +867,12 @@ typedef enum {
} virCPUDefAddFeatureMode; } virCPUDefAddFeatureMode;
static int static int
virCPUDefAddFeatureInternal(virCPUDefPtr def, virCPUDefAddFeatureInternal(virCPUDef *def,
const char *name, const char *name,
int policy, int policy,
virCPUDefAddFeatureMode mode) virCPUDefAddFeatureMode mode)
{ {
virCPUFeatureDefPtr feat; virCPUFeatureDef *feat;
if (def->type == VIR_CPU_TYPE_HOST) if (def->type == VIR_CPU_TYPE_HOST)
policy = -1; policy = -1;
@ -904,7 +904,7 @@ virCPUDefAddFeatureInternal(virCPUDefPtr def,
} }
int int
virCPUDefUpdateFeature(virCPUDefPtr def, virCPUDefUpdateFeature(virCPUDef *def,
const char *name, const char *name,
int policy) int policy)
{ {
@ -913,7 +913,7 @@ virCPUDefUpdateFeature(virCPUDefPtr def,
} }
int int
virCPUDefAddFeature(virCPUDefPtr def, virCPUDefAddFeature(virCPUDef *def,
const char *name, const char *name,
int policy) int policy)
{ {
@ -923,7 +923,7 @@ virCPUDefAddFeature(virCPUDefPtr def,
int int
virCPUDefAddFeatureIfMissing(virCPUDefPtr def, virCPUDefAddFeatureIfMissing(virCPUDef *def,
const char *name, const char *name,
int policy) int policy)
{ {
@ -932,7 +932,7 @@ virCPUDefAddFeatureIfMissing(virCPUDefPtr def,
} }
virCPUFeatureDefPtr virCPUFeatureDef *
virCPUDefFindFeature(const virCPUDef *def, virCPUDefFindFeature(const virCPUDef *def,
const char *name) const char *name)
{ {
@ -948,7 +948,7 @@ virCPUDefFindFeature(const virCPUDef *def,
int int
virCPUDefFilterFeatures(virCPUDefPtr cpu, virCPUDefFilterFeatures(virCPUDef *cpu,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
void *opaque) void *opaque)
{ {
@ -978,7 +978,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
* Returns the number of features matching @filter or -1 on error. * Returns the number of features matching @filter or -1 on error.
*/ */
int int
virCPUDefCheckFeatures(virCPUDefPtr cpu, virCPUDefCheckFeatures(virCPUDef *cpu,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
void *opaque, void *opaque,
char ***features) char ***features)
@ -1003,8 +1003,8 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
bool bool
virCPUDefIsEqual(virCPUDefPtr src, virCPUDefIsEqual(virCPUDef *src,
virCPUDefPtr dst, virCPUDef *dst,
bool reportError) bool reportError)
{ {
size_t i; size_t i;
@ -1130,14 +1130,14 @@ virCPUDefIsEqual(virCPUDefPtr src,
/* /*
* Parses a list of CPU XMLs into a NULL-terminated list of CPU defs. * Parses a list of CPU XMLs into a NULL-terminated list of CPU defs.
*/ */
virCPUDefPtr * virCPUDef **
virCPUDefListParse(const char **xmlCPUs, virCPUDefListParse(const char **xmlCPUs,
unsigned int ncpus, unsigned int ncpus,
virCPUType cpuType) virCPUType cpuType)
{ {
xmlDocPtr doc = NULL; xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL; xmlXPathContextPtr ctxt = NULL;
virCPUDefPtr *cpus = NULL; virCPUDef **cpus = NULL;
size_t i; size_t i;
VIR_DEBUG("xmlCPUs=%p, ncpus=%u", xmlCPUs, ncpus); VIR_DEBUG("xmlCPUs=%p, ncpus=%u", xmlCPUs, ncpus);
@ -1158,7 +1158,7 @@ virCPUDefListParse(const char **xmlCPUs,
goto error; goto error;
} }
cpus = g_new0(virCPUDefPtr, ncpus + 1); cpus = g_new0(virCPUDef *, ncpus + 1);
for (i = 0; i < ncpus; i++) { for (i = 0; i < ncpus; i++) {
if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt))) if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt)))
@ -1187,9 +1187,9 @@ virCPUDefListParse(const char **xmlCPUs,
* Frees NULL-terminated list of CPUs created by virCPUDefListParse. * Frees NULL-terminated list of CPUs created by virCPUDefListParse.
*/ */
void void
virCPUDefListFree(virCPUDefPtr *cpus) virCPUDefListFree(virCPUDef **cpus)
{ {
virCPUDefPtr *cpu; virCPUDef **cpu;
if (!cpus) if (!cpus)
return; return;

View File

@ -94,7 +94,6 @@ typedef enum {
VIR_ENUM_DECL(virCPUFeaturePolicy); VIR_ENUM_DECL(virCPUFeaturePolicy);
typedef struct _virCPUFeatureDef virCPUFeatureDef; typedef struct _virCPUFeatureDef virCPUFeatureDef;
typedef virCPUFeatureDef *virCPUFeatureDefPtr;
struct _virCPUFeatureDef { struct _virCPUFeatureDef {
char *name; char *name;
int policy; /* enum virCPUFeaturePolicy */ int policy; /* enum virCPUFeaturePolicy */
@ -112,7 +111,6 @@ typedef enum {
VIR_ENUM_DECL(virCPUCacheMode); VIR_ENUM_DECL(virCPUCacheMode);
typedef struct _virCPUCacheDef virCPUCacheDef; typedef struct _virCPUCacheDef virCPUCacheDef;
typedef virCPUCacheDef *virCPUCacheDefPtr;
struct _virCPUCacheDef { struct _virCPUCacheDef {
int level; /* -1 for unspecified */ int level; /* -1 for unspecified */
virCPUCacheMode mode; virCPUCacheMode mode;
@ -120,7 +118,6 @@ struct _virCPUCacheDef {
typedef struct _virCPUDef virCPUDef; typedef struct _virCPUDef virCPUDef;
typedef virCPUDef *virCPUDefPtr;
struct _virCPUDef { struct _virCPUDef {
int refs; int refs;
int type; /* enum virCPUType */ int type; /* enum virCPUType */
@ -139,28 +136,28 @@ struct _virCPUDef {
unsigned int threads; unsigned int threads;
size_t nfeatures; size_t nfeatures;
size_t nfeatures_max; size_t nfeatures_max;
virCPUFeatureDefPtr features; virCPUFeatureDef *features;
virCPUCacheDefPtr cache; virCPUCacheDef *cache;
virHostCPUTscInfoPtr tsc; virHostCPUTscInfo *tsc;
virTristateSwitch migratable; /* for host-passthrough mode */ virTristateSwitch migratable; /* for host-passthrough mode */
}; };
virCPUDefPtr virCPUDefNew(void); virCPUDef *virCPUDefNew(void);
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeFeatures(virCPUDefPtr def); virCPUDefFreeFeatures(virCPUDef *def);
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def); virCPUDefFreeModel(virCPUDef *def);
void void
virCPUDefRef(virCPUDefPtr def); virCPUDefRef(virCPUDef *def);
void void
virCPUDefFree(virCPUDefPtr def); virCPUDefFree(virCPUDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUDef, virCPUDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUDef, virCPUDefFree);
int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virCPUDefCopyModel(virCPUDefPtr dst, virCPUDefCopyModel(virCPUDef *dst,
const virCPUDef *src, const virCPUDef *src,
bool resetPolicy); bool resetPolicy);
@ -172,7 +169,7 @@ typedef bool (*virCPUDefFeatureFilter)(const char *name,
void *opaque); void *opaque);
int int
virCPUDefCopyModelFilter(virCPUDefPtr dst, virCPUDefCopyModelFilter(virCPUDef *dst,
const virCPUDef *src, const virCPUDef *src,
bool resetPolicy, bool resetPolicy,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
@ -180,79 +177,79 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void void
virCPUDefStealModel(virCPUDefPtr dst, virCPUDefStealModel(virCPUDef *dst,
virCPUDefPtr src, virCPUDef *src,
bool keepVendor); bool keepVendor);
virCPUDefPtr virCPUDef *
virCPUDefCopy(const virCPUDef *cpu); virCPUDefCopy(const virCPUDef *cpu);
virCPUDefPtr virCPUDef *
virCPUDefCopyWithoutModel(const virCPUDef *cpu); virCPUDefCopyWithoutModel(const virCPUDef *cpu);
int int
virCPUDefParseXMLString(const char *xml, virCPUDefParseXMLString(const char *xml,
virCPUType type, virCPUType type,
virCPUDefPtr *cpu, virCPUDef **cpu,
bool validateXML); bool validateXML);
int int
virCPUDefParseXML(xmlXPathContextPtr ctxt, virCPUDefParseXML(xmlXPathContextPtr ctxt,
const char *xpath, const char *xpath,
virCPUType mode, virCPUType mode,
virCPUDefPtr *cpu, virCPUDef **cpu,
bool validateXML); bool validateXML);
bool bool
virCPUDefIsEqual(virCPUDefPtr src, virCPUDefIsEqual(virCPUDef *src,
virCPUDefPtr dst, virCPUDef *dst,
bool reportError); bool reportError);
char * char *
virCPUDefFormat(virCPUDefPtr def, virCPUDefFormat(virCPUDef *def,
virDomainNumaPtr numa); virDomainNuma *numa);
int int
virCPUDefFormatBuf(virBufferPtr buf, virCPUDefFormatBuf(virBuffer *buf,
virCPUDefPtr def); virCPUDef *def);
int int
virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefFormatBufFull(virBuffer *buf,
virCPUDefPtr def, virCPUDef *def,
virDomainNumaPtr numa); virDomainNuma *numa);
int int
virCPUDefAddFeature(virCPUDefPtr cpu, virCPUDefAddFeature(virCPUDef *cpu,
const char *name, const char *name,
int policy); int policy);
int int
virCPUDefUpdateFeature(virCPUDefPtr cpu, virCPUDefUpdateFeature(virCPUDef *cpu,
const char *name, const char *name,
int policy); int policy);
int int
virCPUDefAddFeatureIfMissing(virCPUDefPtr def, virCPUDefAddFeatureIfMissing(virCPUDef *def,
const char *name, const char *name,
int policy); int policy);
virCPUFeatureDefPtr virCPUFeatureDef *
virCPUDefFindFeature(const virCPUDef *def, virCPUDefFindFeature(const virCPUDef *def,
const char *name); const char *name);
int int
virCPUDefFilterFeatures(virCPUDefPtr cpu, virCPUDefFilterFeatures(virCPUDef *cpu,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
void *opaque); void *opaque);
int int
virCPUDefCheckFeatures(virCPUDefPtr cpu, virCPUDefCheckFeatures(virCPUDef *cpu,
virCPUDefFeatureFilter filter, virCPUDefFeatureFilter filter,
void *opaque, void *opaque,
char ***features); char ***features);
virCPUDefPtr * virCPUDef **
virCPUDefListParse(const char **xmlCPUs, virCPUDefListParse(const char **xmlCPUs,
unsigned int ncpus, unsigned int ncpus,
virCPUType cpuType); virCPUType cpuType);
void void
virCPUDefListFree(virCPUDefPtr *cpus); virCPUDefListFree(virCPUDef **cpus);

View File

@ -50,7 +50,7 @@ VIR_ENUM_IMPL(virDomainDeviceAddress,
static int static int
virZPCIDeviceAddressParseXML(xmlNodePtr node, virZPCIDeviceAddressParseXML(xmlNodePtr node,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
virZPCIDeviceAddress def = { .uid = { 0 }, .fid = { 0 } }; virZPCIDeviceAddress def = { .uid = { 0 }, .fid = { 0 } };
g_autofree char *uid = NULL; g_autofree char *uid = NULL;
@ -83,7 +83,7 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
} }
void void
virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) virDomainDeviceInfoClear(virDomainDeviceInfo *info)
{ {
VIR_FREE(info->alias); VIR_FREE(info->alias);
memset(&info->addr, 0, sizeof(info->addr)); memset(&info->addr, 0, sizeof(info->addr));
@ -95,7 +95,7 @@ virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
} }
void void
virDomainDeviceInfoFree(virDomainDeviceInfoPtr info) virDomainDeviceInfoFree(virDomainDeviceInfo *info)
{ {
if (info) { if (info) {
virDomainDeviceInfoClear(info); virDomainDeviceInfoClear(info);
@ -206,7 +206,7 @@ virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info)
int int
virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressParseXML(xmlNodePtr node,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
xmlNodePtr cur; xmlNodePtr cur;
xmlNodePtr zpci = NULL; xmlNodePtr zpci = NULL;
@ -273,7 +273,7 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
} }
void void
virPCIDeviceAddressFormat(virBufferPtr buf, virPCIDeviceAddressFormat(virBuffer *buf,
virPCIDeviceAddress addr, virPCIDeviceAddress addr,
bool includeTypeInAddr) bool includeTypeInAddr)
{ {
@ -287,7 +287,7 @@ virPCIDeviceAddressFormat(virBufferPtr buf,
} }
bool bool
virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr) virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddress *addr)
{ {
return addr->cssid <= VIR_DOMAIN_DEVICE_CCW_MAX_CSSID && return addr->cssid <= VIR_DOMAIN_DEVICE_CCW_MAX_CSSID &&
addr->ssid <= VIR_DOMAIN_DEVICE_CCW_MAX_SSID && addr->ssid <= VIR_DOMAIN_DEVICE_CCW_MAX_SSID &&
@ -296,7 +296,7 @@ virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr)
int int
virDomainDeviceCCWAddressParseXML(xmlNodePtr node, virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
virDomainDeviceCCWAddressPtr addr) virDomainDeviceCCWAddress *addr)
{ {
g_autofree char *cssid = virXMLPropString(node, "cssid"); g_autofree char *cssid = virXMLPropString(node, "cssid");
g_autofree char *ssid = virXMLPropString(node, "ssid"); g_autofree char *ssid = virXMLPropString(node, "ssid");
@ -342,8 +342,8 @@ virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
} }
bool bool
virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddressPtr addr1, virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddress *addr1,
virDomainDeviceCCWAddressPtr addr2) virDomainDeviceCCWAddress *addr2)
{ {
if (addr1->cssid == addr2->cssid && if (addr1->cssid == addr2->cssid &&
addr1->ssid == addr2->ssid && addr1->ssid == addr2->ssid &&
@ -355,7 +355,7 @@ virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddressPtr addr1,
int int
virDomainDeviceDriveAddressParseXML(xmlNodePtr node, virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
virDomainDeviceDriveAddressPtr addr) virDomainDeviceDriveAddress *addr)
{ {
g_autofree char *controller = virXMLPropString(node, "controller"); g_autofree char *controller = virXMLPropString(node, "controller");
g_autofree char *bus = virXMLPropString(node, "bus"); g_autofree char *bus = virXMLPropString(node, "bus");
@ -397,7 +397,7 @@ virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
int int
virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node, virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node,
virDomainDeviceVirtioSerialAddressPtr addr) virDomainDeviceVirtioSerialAddress *addr)
{ {
g_autofree char *controller = virXMLPropString(node, "controller"); g_autofree char *controller = virXMLPropString(node, "controller");
g_autofree char *bus = virXMLPropString(node, "bus"); g_autofree char *bus = virXMLPropString(node, "bus");
@ -431,7 +431,7 @@ virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node,
int int
virDomainDeviceCcidAddressParseXML(xmlNodePtr node, virDomainDeviceCcidAddressParseXML(xmlNodePtr node,
virDomainDeviceCcidAddressPtr addr) virDomainDeviceCcidAddress *addr)
{ {
g_autofree char *controller = virXMLPropString(node, "controller"); g_autofree char *controller = virXMLPropString(node, "controller");
g_autofree char *slot = virXMLPropString(node, "slot"); g_autofree char *slot = virXMLPropString(node, "slot");
@ -456,7 +456,7 @@ virDomainDeviceCcidAddressParseXML(xmlNodePtr node,
} }
static int static int
virDomainDeviceUSBAddressParsePort(virDomainDeviceUSBAddressPtr addr, virDomainDeviceUSBAddressParsePort(virDomainDeviceUSBAddress *addr,
char *port) char *port)
{ {
char *tmp = port; char *tmp = port;
@ -480,7 +480,7 @@ virDomainDeviceUSBAddressParsePort(virDomainDeviceUSBAddressPtr addr,
int int
virDomainDeviceUSBAddressParseXML(xmlNodePtr node, virDomainDeviceUSBAddressParseXML(xmlNodePtr node,
virDomainDeviceUSBAddressPtr addr) virDomainDeviceUSBAddress *addr)
{ {
g_autofree char *port = virXMLPropString(node, "port"); g_autofree char *port = virXMLPropString(node, "port");
g_autofree char *bus = virXMLPropString(node, "bus"); g_autofree char *bus = virXMLPropString(node, "bus");
@ -501,7 +501,7 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node,
int int
virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node,
virDomainDeviceSpaprVioAddressPtr addr) virDomainDeviceSpaprVioAddress *addr)
{ {
g_autofree char *reg = virXMLPropString(node, "reg"); g_autofree char *reg = virXMLPropString(node, "reg");
@ -520,7 +520,7 @@ virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node,
} }
bool bool
virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, virDomainDeviceAddressIsValid(virDomainDeviceInfo *info,
int type) int type)
{ {
if (info->type != type) if (info->type != type)
@ -549,7 +549,7 @@ virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
int int
virInterfaceLinkParseXML(xmlNodePtr node, virInterfaceLinkParseXML(xmlNodePtr node,
virNetDevIfLinkPtr lnk) virNetDevIfLink *lnk)
{ {
int state; int state;
@ -577,7 +577,7 @@ virInterfaceLinkParseXML(xmlNodePtr node,
} }
int int
virInterfaceLinkFormat(virBufferPtr buf, virInterfaceLinkFormat(virBuffer *buf,
const virNetDevIfLink *lnk) const virNetDevIfLink *lnk)
{ {
if (!lnk->speed && !lnk->state) { if (!lnk->speed && !lnk->state) {

View File

@ -52,7 +52,6 @@ typedef enum {
VIR_ENUM_DECL(virDomainDeviceAddress); VIR_ENUM_DECL(virDomainDeviceAddress);
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress; typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
struct _virDomainDeviceDriveAddress { struct _virDomainDeviceDriveAddress {
unsigned int controller; unsigned int controller;
unsigned int bus; unsigned int bus;
@ -61,7 +60,6 @@ struct _virDomainDeviceDriveAddress {
}; };
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress; typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
struct _virDomainDeviceVirtioSerialAddress { struct _virDomainDeviceVirtioSerialAddress {
unsigned int controller; unsigned int controller;
unsigned int bus; unsigned int bus;
@ -73,7 +71,6 @@ struct _virDomainDeviceVirtioSerialAddress {
#define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO 65535 #define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO 65535
typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress; typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress;
typedef virDomainDeviceCCWAddress *virDomainDeviceCCWAddressPtr;
struct _virDomainDeviceCCWAddress { struct _virDomainDeviceCCWAddress {
unsigned int cssid; unsigned int cssid;
unsigned int ssid; unsigned int ssid;
@ -82,7 +79,6 @@ struct _virDomainDeviceCCWAddress {
}; };
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress; typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
struct _virDomainDeviceCcidAddress { struct _virDomainDeviceCcidAddress {
unsigned int controller; unsigned int controller;
unsigned int slot; unsigned int slot;
@ -91,14 +87,12 @@ struct _virDomainDeviceCcidAddress {
#define VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH 4 #define VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH 4
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress; typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
struct _virDomainDeviceUSBAddress { struct _virDomainDeviceUSBAddress {
unsigned int bus; unsigned int bus;
unsigned int port[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH]; unsigned int port[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH];
}; };
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress; typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
struct _virDomainDeviceSpaprVioAddress { struct _virDomainDeviceSpaprVioAddress {
unsigned long long reg; unsigned long long reg;
bool has_reg; bool has_reg;
@ -112,27 +106,23 @@ typedef enum {
} virDomainControllerMaster; } virDomainControllerMaster;
typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster; typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster;
typedef virDomainDeviceUSBMaster *virDomainDeviceUSBMasterPtr;
struct _virDomainDeviceUSBMaster { struct _virDomainDeviceUSBMaster {
unsigned int startport; unsigned int startport;
}; };
typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress; typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
struct _virDomainDeviceISAAddress { struct _virDomainDeviceISAAddress {
unsigned int iobase; unsigned int iobase;
unsigned int irq; unsigned int irq;
}; };
typedef struct _virDomainDeviceDimmAddress virDomainDeviceDimmAddress; typedef struct _virDomainDeviceDimmAddress virDomainDeviceDimmAddress;
typedef virDomainDeviceDimmAddress *virDomainDeviceDimmAddressPtr;
struct _virDomainDeviceDimmAddress { struct _virDomainDeviceDimmAddress {
unsigned int slot; unsigned int slot;
unsigned long long base; unsigned long long base;
}; };
typedef struct _virDomainDeviceInfo virDomainDeviceInfo; typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo { struct _virDomainDeviceInfo {
char *alias; char *alias;
int type; /* virDomainDeviceAddressType */ int type; /* virDomainDeviceAddressType */
@ -184,14 +174,14 @@ struct _virDomainDeviceInfo {
bool isolationGroupLocked; bool isolationGroupLocked;
}; };
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); void virDomainDeviceInfoClear(virDomainDeviceInfo *info);
void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info); void virDomainDeviceInfoFree(virDomainDeviceInfo *info);
bool virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a, bool virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a,
const virDomainDeviceInfo *b) const virDomainDeviceInfo *b)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
bool virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, bool virDomainDeviceAddressIsValid(virDomainDeviceInfo *info,
int type); int type);
bool virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info); bool virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info);
@ -201,36 +191,36 @@ bool virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *info);
bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info); bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info);
int virPCIDeviceAddressParseXML(xmlNodePtr node, int virPCIDeviceAddressParseXML(xmlNodePtr node,
virPCIDeviceAddressPtr addr); virPCIDeviceAddress *addr);
void virPCIDeviceAddressFormat(virBufferPtr buf, void virPCIDeviceAddressFormat(virBuffer *buf,
virPCIDeviceAddress addr, virPCIDeviceAddress addr,
bool includeTypeInAddr); bool includeTypeInAddr);
bool virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr); bool virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddress *addr);
int virDomainDeviceCCWAddressParseXML(xmlNodePtr node, int virDomainDeviceCCWAddressParseXML(xmlNodePtr node,
virDomainDeviceCCWAddressPtr addr); virDomainDeviceCCWAddress *addr);
bool virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddressPtr addr1, bool virDomainDeviceCCWAddressEqual(virDomainDeviceCCWAddress *addr1,
virDomainDeviceCCWAddressPtr addr2); virDomainDeviceCCWAddress *addr2);
#define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x" #define VIR_CCW_DEVICE_ADDRESS_FMT "%x.%x.%04x"
int virDomainDeviceDriveAddressParseXML(xmlNodePtr node, int virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
virDomainDeviceDriveAddressPtr addr); virDomainDeviceDriveAddress *addr);
int virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node, int virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node,
virDomainDeviceVirtioSerialAddressPtr addr); virDomainDeviceVirtioSerialAddress *addr);
int virDomainDeviceCcidAddressParseXML(xmlNodePtr node, int virDomainDeviceCcidAddressParseXML(xmlNodePtr node,
virDomainDeviceCcidAddressPtr addr); virDomainDeviceCcidAddress *addr);
int virDomainDeviceUSBAddressParseXML(xmlNodePtr node, int virDomainDeviceUSBAddressParseXML(xmlNodePtr node,
virDomainDeviceUSBAddressPtr addr); virDomainDeviceUSBAddress *addr);
int virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, int virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node,
virDomainDeviceSpaprVioAddressPtr addr); virDomainDeviceSpaprVioAddress *addr);
int virInterfaceLinkParseXML(xmlNodePtr node, int virInterfaceLinkParseXML(xmlNodePtr node,
virNetDevIfLinkPtr lnk); virNetDevIfLink *lnk);
int virInterfaceLinkFormat(virBufferPtr buf, int virInterfaceLinkFormat(virBuffer *buf,
const virNetDevIfLink *lnk); const virNetDevIfLink *lnk);

View File

@ -62,7 +62,7 @@ virDomainZPCIAddressReserveId(GHashTable *set,
static int static int
virDomainZPCIAddressReserveUid(GHashTable *set, virDomainZPCIAddressReserveUid(GHashTable *set,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
return virDomainZPCIAddressReserveId(set, &addr->uid, "uid"); return virDomainZPCIAddressReserveId(set, &addr->uid, "uid");
} }
@ -70,7 +70,7 @@ virDomainZPCIAddressReserveUid(GHashTable *set,
static int static int
virDomainZPCIAddressReserveFid(GHashTable *set, virDomainZPCIAddressReserveFid(GHashTable *set,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
return virDomainZPCIAddressReserveId(set, &addr->fid, "fid"); return virDomainZPCIAddressReserveId(set, &addr->fid, "fid");
} }
@ -105,7 +105,7 @@ virDomainZPCIAddressAssignId(GHashTable *set,
static int static int
virDomainZPCIAddressAssignUid(GHashTable *set, virDomainZPCIAddressAssignUid(GHashTable *set,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
return virDomainZPCIAddressAssignId(set, &addr->uid, 1, return virDomainZPCIAddressAssignId(set, &addr->uid, 1,
VIR_DOMAIN_DEVICE_ZPCI_MAX_UID, "uid"); VIR_DOMAIN_DEVICE_ZPCI_MAX_UID, "uid");
@ -114,7 +114,7 @@ virDomainZPCIAddressAssignUid(GHashTable *set,
static int static int
virDomainZPCIAddressAssignFid(GHashTable *set, virDomainZPCIAddressAssignFid(GHashTable *set,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
return virDomainZPCIAddressAssignId(set, &addr->fid, 0, return virDomainZPCIAddressAssignId(set, &addr->fid, 0,
VIR_DOMAIN_DEVICE_ZPCI_MAX_FID, "fid"); VIR_DOMAIN_DEVICE_ZPCI_MAX_FID, "fid");
@ -136,8 +136,8 @@ virDomainZPCIAddressReleaseId(GHashTable *set,
static void static void
virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds, virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIds *zpciIds,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
if (!zpciIds) if (!zpciIds)
return; return;
@ -148,8 +148,8 @@ virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds,
static int static int
virDomainZPCIAddressEnsureAddr(virDomainZPCIAddressIdsPtr zpciIds, virDomainZPCIAddressEnsureAddr(virDomainZPCIAddressIds *zpciIds,
virZPCIDeviceAddressPtr addr) virZPCIDeviceAddress *addr)
{ {
if (virDomainZPCIAddressAssignUid(zpciIds->uids, addr) < 0) if (virDomainZPCIAddressAssignUid(zpciIds->uids, addr) < 0)
return -1; return -1;
@ -170,8 +170,8 @@ virDomainZPCIAddressEnsureAddr(virDomainZPCIAddressIdsPtr zpciIds,
int int
virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
/* Reserve uid/fid to ZPCI device which has defined uid/fid /* Reserve uid/fid to ZPCI device which has defined uid/fid
@ -185,8 +185,8 @@ virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs,
int int
virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
virZPCIDeviceAddress zpci = addr->zpci; virZPCIDeviceAddress zpci = addr->zpci;
@ -203,11 +203,11 @@ virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addrs,
static int static int
virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
virZPCIDeviceAddressPtr zpci = &addr->zpci; virZPCIDeviceAddress *zpci = &addr->zpci;
if (virDomainZPCIAddressEnsureAddr(addrs->zpciIds, zpci) < 0) if (virDomainZPCIAddressEnsureAddr(addrs->zpciIds, zpci) < 0)
return -1; return -1;
@ -293,7 +293,7 @@ virDomainPCIControllerConnectTypeToModel(virDomainPCIConnectFlags flags)
static bool static bool
virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr, virDomainPCIAddressFlagsCompatible(virPCIDeviceAddress *addr,
const char *addrStr, const char *addrStr,
virDomainPCIConnectFlags busFlags, virDomainPCIConnectFlags busFlags,
virDomainPCIConnectFlags devFlags, virDomainPCIConnectFlags devFlags,
@ -398,13 +398,13 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
* comparing the flags). * comparing the flags).
*/ */
bool bool
virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressValidate(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
const char *addrStr, const char *addrStr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
bool fromConfig) bool fromConfig)
{ {
virDomainPCIAddressBusPtr bus; virDomainPCIAddressBus *bus;
virErrorNumber errType = (fromConfig virErrorNumber errType = (fromConfig
? VIR_ERR_XML_ERROR : VIR_ERR_INTERNAL_ERROR); ? VIR_ERR_XML_ERROR : VIR_ERR_INTERNAL_ERROR);
@ -460,7 +460,7 @@ virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
int int
virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus, virDomainPCIAddressBusSetModel(virDomainPCIAddressBus *bus,
virDomainControllerModelPCI model, virDomainControllerModelPCI model,
bool allowHotplug) bool allowHotplug)
{ {
@ -574,7 +574,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
bool bool
virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus) virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBus *bus)
{ {
size_t i; size_t i;
@ -588,7 +588,7 @@ virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus)
static bool ATTRIBUTE_NONNULL(1) static bool ATTRIBUTE_NONNULL(1)
virDomainPCIAddressBusIsEmpty(virDomainPCIAddressBusPtr bus) virDomainPCIAddressBusIsEmpty(virDomainPCIAddressBus *bus)
{ {
size_t i; size_t i;
@ -609,8 +609,8 @@ virDomainPCIAddressBusIsEmpty(virDomainPCIAddressBusPtr bus)
* >0 = number of buses added * >0 = number of buses added
*/ */
static int static int
virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressSetGrow(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
virDomainPCIConnectFlags flags) virDomainPCIConnectFlags flags)
{ {
int add; int add;
@ -777,8 +777,8 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
* Check if the PCI slot is used by another device. * Check if the PCI slot is used by another device.
*/ */
bool bool
virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressSlotInUse(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
return !!addrs->buses[addr->bus].slot[addr->slot].functions; return !!addrs->buses[addr->bus].slot[addr->slot].functions;
} }
@ -792,14 +792,14 @@ virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
* XML). * XML).
*/ */
static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virDomainPCIAddressReserveAddrInternal(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressReserveAddrInternal(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
unsigned int isolationGroup, unsigned int isolationGroup,
bool fromConfig) bool fromConfig)
{ {
g_autofree char *addrStr = NULL; g_autofree char *addrStr = NULL;
virDomainPCIAddressBusPtr bus; virDomainPCIAddressBus *bus;
virErrorNumber errType = (fromConfig virErrorNumber errType = (fromConfig
? VIR_ERR_XML_ERROR : VIR_ERR_INTERNAL_ERROR); ? VIR_ERR_XML_ERROR : VIR_ERR_INTERNAL_ERROR);
@ -862,8 +862,8 @@ virDomainPCIAddressReserveAddrInternal(virDomainPCIAddressSetPtr addrs,
int int
virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressReserveAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
unsigned int isolationGroup) unsigned int isolationGroup)
{ {
@ -872,8 +872,8 @@ virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
} }
int int
virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressEnsureAddr(virDomainPCIAddressSet *addrs,
virDomainDeviceInfoPtr dev, virDomainDeviceInfo *dev,
virDomainPCIConnectFlags flags) virDomainPCIConnectFlags flags)
{ {
g_autofree char *addrStr = NULL; g_autofree char *addrStr = NULL;
@ -926,8 +926,8 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
void void
virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI)
virDomainZPCIAddressReleaseIds(addrs->zpciIds, &addr->zpci); virDomainZPCIAddressReleaseIds(addrs->zpciIds, &addr->zpci);
@ -935,15 +935,15 @@ virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs,
void void
virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressReleaseAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
{ {
addrs->buses[addr->bus].slot[addr->slot].functions &= ~(1 << addr->function); addrs->buses[addr->bus].slot[addr->slot].functions &= ~(1 << addr->function);
} }
static void static void
virDomainPCIAddressSetExtensionFree(virDomainZPCIAddressIdsPtr zpciIds) virDomainPCIAddressSetExtensionFree(virDomainZPCIAddressIds *zpciIds)
{ {
if (!zpciIds) if (!zpciIds)
return; return;
@ -956,7 +956,7 @@ virDomainPCIAddressSetExtensionFree(virDomainZPCIAddressIdsPtr zpciIds)
static int static int
virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressExtensionFlags extFlags) virPCIDeviceAddressExtensionFlags extFlags)
{ {
if (extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { if (extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) {
@ -973,11 +973,11 @@ virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs,
} }
virDomainPCIAddressSetPtr virDomainPCIAddressSet *
virDomainPCIAddressSetAlloc(unsigned int nbuses, virDomainPCIAddressSetAlloc(unsigned int nbuses,
virPCIDeviceAddressExtensionFlags extFlags) virPCIDeviceAddressExtensionFlags extFlags)
{ {
virDomainPCIAddressSetPtr addrs; virDomainPCIAddressSet *addrs;
addrs = g_new0(virDomainPCIAddressSet, 1); addrs = g_new0(virDomainPCIAddressSet, 1);
addrs->buses = g_new0(virDomainPCIAddressBus, nbuses); addrs->buses = g_new0(virDomainPCIAddressBus, nbuses);
@ -995,7 +995,7 @@ virDomainPCIAddressSetAlloc(unsigned int nbuses,
void void
virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs) virDomainPCIAddressSetFree(virDomainPCIAddressSet *addrs)
{ {
if (!addrs) if (!addrs)
return; return;
@ -1007,8 +1007,8 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs)
static int static int
virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus, virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBus *bus,
virPCIDeviceAddressPtr searchAddr, virPCIDeviceAddress *searchAddr,
int function, int function,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
bool *found) bool *found)
@ -1069,8 +1069,8 @@ virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus,
static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressGetNextAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr next_addr, virPCIDeviceAddress *next_addr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
unsigned int isolationGroup, unsigned int isolationGroup,
int function) int function)
@ -1093,7 +1093,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
* don't match. This ensures all devices sharing the same isolation * don't match. This ensures all devices sharing the same isolation
* group will end up on the same bus */ * group will end up on the same bus */
for (a.bus = 0; a.bus < addrs->nbuses; a.bus++) { for (a.bus = 0; a.bus < addrs->nbuses; a.bus++) {
virDomainPCIAddressBusPtr bus = &addrs->buses[a.bus]; virDomainPCIAddressBus *bus = &addrs->buses[a.bus];
bool found = false; bool found = false;
if (bus->isolationGroup != isolationGroup) if (bus->isolationGroup != isolationGroup)
@ -1114,7 +1114,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
* might still be able to make this work by altering the isolation * might still be able to make this work by altering the isolation
* group for a bus that's currently empty. So let's try that */ * group for a bus that's currently empty. So let's try that */
for (a.bus = 0; a.bus < addrs->nbuses; a.bus++) { for (a.bus = 0; a.bus < addrs->nbuses; a.bus++) {
virDomainPCIAddressBusPtr bus = &addrs->buses[a.bus]; virDomainPCIAddressBus *bus = &addrs->buses[a.bus];
bool found = false; bool found = false;
/* We can only change the isolation group for a bus when /* We can only change the isolation group for a bus when
@ -1176,8 +1176,8 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
* returns 0 on success, or -1 on failure. * returns 0 on success, or -1 on failure.
*/ */
int int
virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs, virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSet *addrs,
virDomainDeviceInfoPtr dev, virDomainDeviceInfo *dev,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
int function) int function)
{ {
@ -1204,13 +1204,13 @@ virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
static int static int
virDomainPCIAddressSetMultiIter(virDomainDefPtr def G_GNUC_UNUSED, virDomainPCIAddressSetMultiIter(virDomainDef *def G_GNUC_UNUSED,
virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDeviceDef *dev G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *data) void *data)
{ {
virPCIDeviceAddressPtr testAddr = data; virPCIDeviceAddress *testAddr = data;
virPCIDeviceAddressPtr thisAddr; virPCIDeviceAddress *thisAddr;
if (!info || info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) if (!info || info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
return 0; return 0;
@ -1237,12 +1237,12 @@ virDomainPCIAddressSetMultiIter(virDomainDefPtr def G_GNUC_UNUSED,
static int static int
virDomainPCIAddressSetAllMultiIter(virDomainDefPtr def, virDomainPCIAddressSetAllMultiIter(virDomainDef *def,
virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDeviceDef *dev G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *data G_GNUC_UNUSED) void *data G_GNUC_UNUSED)
{ {
virPCIDeviceAddressPtr testAddr; virPCIDeviceAddress *testAddr;
if (!info || info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) if (!info || info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
return 0; return 0;
@ -1272,7 +1272,7 @@ virDomainPCIAddressSetAllMultiIter(virDomainDefPtr def,
* No return code, since there is no possibility of failure. * No return code, since there is no possibility of failure.
*/ */
void void
virDomainPCIAddressSetAllMulti(virDomainDefPtr def) virDomainPCIAddressSetAllMulti(virDomainDef *def)
{ {
/* Use nested iterators over all the devices - the outer iterator /* Use nested iterators over all the devices - the outer iterator
* scans through all the devices looking for those whose address * scans through all the devices looking for those whose address
@ -1287,13 +1287,13 @@ virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
char* char*
virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr) virDomainCCWAddressAsString(virDomainDeviceCCWAddress *addr)
{ {
return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno); return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
} }
static int static int
virDomainCCWAddressIncrement(virDomainDeviceCCWAddressPtr addr) virDomainCCWAddressIncrement(virDomainDeviceCCWAddress *addr)
{ {
virDomainDeviceCCWAddress ccwaddr = *addr; virDomainDeviceCCWAddress ccwaddr = *addr;
@ -1307,8 +1307,8 @@ virDomainCCWAddressIncrement(virDomainDeviceCCWAddressPtr addr)
int int
virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev, virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
virDomainCCWAddressSetPtr addrs, virDomainCCWAddressSet *addrs,
bool autoassign) bool autoassign)
{ {
g_autofree char *addr = NULL; g_autofree char *addr = NULL;
@ -1355,24 +1355,24 @@ virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
} }
static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
virDomainCCWAddressAllocate(virDomainDefPtr def G_GNUC_UNUSED, virDomainCCWAddressAllocate(virDomainDef *def G_GNUC_UNUSED,
virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDeviceDef *dev G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *data) void *data)
{ {
return virDomainCCWAddressAssign(info, data, true); return virDomainCCWAddressAssign(info, data, true);
} }
static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
virDomainCCWAddressValidate(virDomainDefPtr def G_GNUC_UNUSED, virDomainCCWAddressValidate(virDomainDef *def G_GNUC_UNUSED,
virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDeviceDef *dev G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *data) void *data)
{ {
return virDomainCCWAddressAssign(info, data, false); return virDomainCCWAddressAssign(info, data, false);
} }
void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs) void virDomainCCWAddressSetFree(virDomainCCWAddressSet *addrs)
{ {
if (!addrs) if (!addrs)
return; return;
@ -1381,10 +1381,10 @@ void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs)
g_free(addrs); g_free(addrs);
} }
static virDomainCCWAddressSetPtr static virDomainCCWAddressSet *
virDomainCCWAddressSetCreate(void) virDomainCCWAddressSetCreate(void)
{ {
virDomainCCWAddressSetPtr addrs = NULL; virDomainCCWAddressSet *addrs = NULL;
addrs = g_new0(virDomainCCWAddressSet, 1); addrs = g_new0(virDomainCCWAddressSet, 1);
@ -1404,10 +1404,10 @@ virDomainCCWAddressSetCreate(void)
} }
virDomainCCWAddressSetPtr virDomainCCWAddressSet *
virDomainCCWAddressSetCreateFromDomain(virDomainDefPtr def) virDomainCCWAddressSetCreateFromDomain(virDomainDef *def)
{ {
virDomainCCWAddressSetPtr addrs = NULL; virDomainCCWAddressSet *addrs = NULL;
if (!(addrs = virDomainCCWAddressSetCreate())) if (!(addrs = virDomainCCWAddressSetCreate()))
goto error; goto error;
@ -1435,10 +1435,10 @@ virDomainCCWAddressSetCreateFromDomain(virDomainDefPtr def)
* *
* Allocates an address set for virtio serial addresses * Allocates an address set for virtio serial addresses
*/ */
static virDomainVirtioSerialAddrSetPtr static virDomainVirtioSerialAddrSet *
virDomainVirtioSerialAddrSetCreate(void) virDomainVirtioSerialAddrSetCreate(void)
{ {
virDomainVirtioSerialAddrSetPtr ret = NULL; virDomainVirtioSerialAddrSet *ret = NULL;
ret = g_new0(virDomainVirtioSerialAddrSet, 1); ret = g_new0(virDomainVirtioSerialAddrSet, 1);
@ -1446,7 +1446,7 @@ virDomainVirtioSerialAddrSetCreate(void)
} }
static void static void
virDomainVirtioSerialControllerFree(virDomainVirtioSerialControllerPtr cont) virDomainVirtioSerialControllerFree(virDomainVirtioSerialController *cont)
{ {
if (cont) { if (cont) {
virBitmapFree(cont->ports); virBitmapFree(cont->ports);
@ -1455,8 +1455,8 @@ virDomainVirtioSerialControllerFree(virDomainVirtioSerialControllerPtr cont)
} }
static ssize_t static ssize_t
virDomainVirtioSerialAddrPlaceController(virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrPlaceController(virDomainVirtioSerialAddrSet *addrs,
virDomainVirtioSerialControllerPtr cont) virDomainVirtioSerialController *cont)
{ {
size_t i; size_t i;
@ -1475,7 +1475,7 @@ virDomainVirtioSerialAddrPlaceController(virDomainVirtioSerialAddrSetPtr addrs,
} }
static ssize_t static ssize_t
virDomainVirtioSerialAddrFindController(virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrFindController(virDomainVirtioSerialAddrSet *addrs,
unsigned int idx) unsigned int idx)
{ {
size_t i; size_t i;
@ -1493,12 +1493,12 @@ virDomainVirtioSerialAddrFindController(virDomainVirtioSerialAddrSetPtr addrs,
* to the address set. * to the address set.
*/ */
static int static int
virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSet *addrs,
virDomainControllerDefPtr cont) virDomainControllerDef *cont)
{ {
int ret = -1; int ret = -1;
int ports; int ports;
virDomainVirtioSerialControllerPtr cnt = NULL; virDomainVirtioSerialController *cnt = NULL;
ssize_t insertAt; ssize_t insertAt;
if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
@ -1535,8 +1535,8 @@ virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSetPtr addrs,
* to the address set. * to the address set.
*/ */
static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSet *addrs,
virDomainDefPtr def) virDomainDef *def)
{ {
size_t i; size_t i;
@ -1551,7 +1551,7 @@ virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSetPtr addrs
void void
virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs) virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSet *addrs)
{ {
size_t i; size_t i;
if (addrs) { if (addrs) {
@ -1570,13 +1570,13 @@ virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs)
* opaque should be the address set * opaque should be the address set
*/ */
static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
virDomainVirtioSerialAddrReserve(virDomainDefPtr def G_GNUC_UNUSED, virDomainVirtioSerialAddrReserve(virDomainDef *def G_GNUC_UNUSED,
virDomainDeviceDefPtr dev G_GNUC_UNUSED, virDomainDeviceDef *dev G_GNUC_UNUSED,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *data) void *data)
{ {
virDomainVirtioSerialAddrSetPtr addrs = data; virDomainVirtioSerialAddrSet *addrs = data;
virBitmapPtr map = NULL; virBitmap *map = NULL;
bool b; bool b;
ssize_t i; ssize_t i;
@ -1623,11 +1623,11 @@ virDomainVirtioSerialAddrReserve(virDomainDefPtr def G_GNUC_UNUSED,
* Inspect the domain definition and return an address set containing * Inspect the domain definition and return an address set containing
* every virtio serial address we find * every virtio serial address we find
*/ */
virDomainVirtioSerialAddrSetPtr virDomainVirtioSerialAddrSet *
virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def) virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDef *def)
{ {
virDomainVirtioSerialAddrSetPtr addrs = NULL; virDomainVirtioSerialAddrSet *addrs = NULL;
virDomainVirtioSerialAddrSetPtr ret = NULL; virDomainVirtioSerialAddrSet *ret = NULL;
if (!(addrs = virDomainVirtioSerialAddrSetCreate())) if (!(addrs = virDomainVirtioSerialAddrSetCreate()))
goto cleanup; goto cleanup;
@ -1646,8 +1646,8 @@ virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def)
} }
static int static int
virDomainVirtioSerialAddrSetAutoaddController(virDomainDefPtr def, virDomainVirtioSerialAddrSetAutoaddController(virDomainDef *def,
virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSet *addrs,
unsigned int idx) unsigned int idx)
{ {
int contidx; int contidx;
@ -1666,8 +1666,8 @@ virDomainVirtioSerialAddrSetAutoaddController(virDomainDefPtr def,
} }
static int static int
virDomainVirtioSerialAddrNext(virDomainDefPtr def, virDomainVirtioSerialAddrNext(virDomainDef *def,
virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSet *addrs,
virDomainDeviceVirtioSerialAddress *addr, virDomainDeviceVirtioSerialAddress *addr,
bool allowZero) bool allowZero)
{ {
@ -1686,7 +1686,7 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
} }
for (i = 0; i < addrs->ncontrollers; i++) { for (i = 0; i < addrs->ncontrollers; i++) {
virBitmapPtr map = addrs->controllers[i]->ports; virBitmap *map = addrs->controllers[i]->ports;
if ((port = virBitmapNextClearBit(map, startPort)) >= 0) { if ((port = virBitmapNextClearBit(map, startPort)) >= 0) {
controller = addrs->controllers[i]->idx; controller = addrs->controllers[i]->idx;
goto success; goto success;
@ -1722,12 +1722,12 @@ virDomainVirtioSerialAddrNext(virDomainDefPtr def,
} }
static int static int
virDomainVirtioSerialAddrNextFromController(virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrNextFromController(virDomainVirtioSerialAddrSet *addrs,
virDomainDeviceVirtioSerialAddress *addr) virDomainDeviceVirtioSerialAddress *addr)
{ {
ssize_t port; ssize_t port;
ssize_t i; ssize_t i;
virBitmapPtr map; virBitmap *map;
i = virDomainVirtioSerialAddrFindController(addrs, addr->controller); i = virDomainVirtioSerialAddrFindController(addrs, addr->controller);
if (i < 0) { if (i < 0) {
@ -1753,14 +1753,14 @@ virDomainVirtioSerialAddrNextFromController(virDomainVirtioSerialAddrSetPtr addr
} }
static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
virDomainVirtioSerialAddrAssign(virDomainDefPtr def, virDomainVirtioSerialAddrAssign(virDomainDef *def,
virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSet *addrs,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
bool allowZero, bool allowZero,
bool portOnly) bool portOnly)
{ {
virDomainDeviceInfo nfo = { 0 }; virDomainDeviceInfo nfo = { 0 };
virDomainDeviceInfoPtr ptr = allowZero ? &nfo : info; virDomainDeviceInfo *ptr = allowZero ? &nfo : info;
ptr->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL; ptr->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL;
@ -1786,9 +1786,9 @@ virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
* or assign a virtio serial address to the device * or assign a virtio serial address to the device
*/ */
int int
virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def, virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDef *def,
virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSet *addrs,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
bool allowZero) bool allowZero)
{ {
bool portOnly = info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL; bool portOnly = info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL;
@ -1800,11 +1800,11 @@ virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
} }
int int
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def, virDomainVirtioSerialAddrAutoAssign(virDomainDef *def,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
bool allowZero) bool allowZero)
{ {
virDomainVirtioSerialAddrSetPtr addrs = NULL; virDomainVirtioSerialAddrSet *addrs = NULL;
int ret = -1; int ret = -1;
if (!(addrs = virDomainVirtioSerialAddrSetCreateFromDomain(def))) if (!(addrs = virDomainVirtioSerialAddrSetCreateFromDomain(def)))
@ -1826,7 +1826,7 @@ virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
* Check if the address is complete, or it needs auto-assignment * Check if the address is complete, or it needs auto-assignment
*/ */
bool bool
virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfoPtr info) virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfo *info)
{ {
return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL && return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
info->addr.vioserial.port != 0; info->addr.vioserial.port != 0;
@ -1841,7 +1841,7 @@ virDomainUSBAddressPortIsValid(unsigned int *port)
void void
virDomainUSBAddressPortFormatBuf(virBufferPtr buf, virDomainUSBAddressPortFormatBuf(virBuffer *buf,
unsigned int *port) unsigned int *port)
{ {
size_t i; size_t i;
@ -1864,10 +1864,10 @@ virDomainUSBAddressPortFormat(unsigned int *port)
} }
virDomainUSBAddressSetPtr virDomainUSBAddressSet *
virDomainUSBAddressSetCreate(void) virDomainUSBAddressSetCreate(void)
{ {
virDomainUSBAddressSetPtr addrs; virDomainUSBAddressSet *addrs;
addrs = g_new0(virDomainUSBAddressSet, 1); addrs = g_new0(virDomainUSBAddressSet, 1);
@ -1876,7 +1876,7 @@ virDomainUSBAddressSetCreate(void)
static void static void
virDomainUSBAddressHubFree(virDomainUSBAddressHubPtr hub) virDomainUSBAddressHubFree(virDomainUSBAddressHub *hub)
{ {
size_t i; size_t i;
@ -1892,7 +1892,7 @@ virDomainUSBAddressHubFree(virDomainUSBAddressHubPtr hub)
void void
virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs) virDomainUSBAddressSetFree(virDomainUSBAddressSet *addrs)
{ {
size_t i; size_t i;
@ -1907,7 +1907,7 @@ virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs)
static size_t static size_t
virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont) virDomainUSBAddressControllerModelToPorts(virDomainControllerDef *cont)
{ {
switch ((virDomainControllerModelUSB) cont->model) { switch ((virDomainControllerModelUSB) cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT:
@ -1951,16 +1951,16 @@ virDomainUSBAddressControllerModelToPorts(virDomainControllerDefPtr cont)
} }
static virDomainUSBAddressHubPtr static virDomainUSBAddressHub *
virDomainUSBAddressHubNew(size_t nports) virDomainUSBAddressHubNew(size_t nports)
{ {
virDomainUSBAddressHubPtr hub; virDomainUSBAddressHub *hub;
hub = g_new0(virDomainUSBAddressHub, 1); hub = g_new0(virDomainUSBAddressHub, 1);
hub->portmap = virBitmapNew(nports); hub->portmap = virBitmapNew(nports);
hub->ports = g_new0(virDomainUSBAddressHubPtr, nports); hub->ports = g_new0(virDomainUSBAddressHub *, nports);
hub->nports = nports; hub->nports = nports;
return hub; return hub;
@ -1968,11 +1968,11 @@ virDomainUSBAddressHubNew(size_t nports)
static int static int
virDomainUSBAddressSetAddController(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressSetAddController(virDomainUSBAddressSet *addrs,
virDomainControllerDefPtr cont) virDomainControllerDef *cont)
{ {
size_t nports = virDomainUSBAddressControllerModelToPorts(cont); size_t nports = virDomainUSBAddressControllerModelToPorts(cont);
virDomainUSBAddressHubPtr hub = NULL; virDomainUSBAddressHub *hub = NULL;
int ret = -1; int ret = -1;
VIR_DEBUG("Adding a USB controller model=%s with %zu ports", VIR_DEBUG("Adding a USB controller model=%s with %zu ports",
@ -2005,7 +2005,7 @@ virDomainUSBAddressSetAddController(virDomainUSBAddressSetPtr addrs,
static ssize_t static ssize_t
virDomainUSBAddressGetLastIdx(virDomainDeviceInfoPtr info) virDomainUSBAddressGetLastIdx(virDomainDeviceInfo *info)
{ {
ssize_t i; ssize_t i;
for (i = VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH - 1; i > 0; i--) { for (i = VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH - 1; i > 0; i--) {
@ -2020,13 +2020,13 @@ virDomainUSBAddressGetLastIdx(virDomainDeviceInfoPtr info)
* that corresponds to the bus/port path specified by info. * that corresponds to the bus/port path specified by info.
* Returns the index of the requested port in targetIdx. * Returns the index of the requested port in targetIdx.
*/ */
static virDomainUSBAddressHubPtr static virDomainUSBAddressHub *
virDomainUSBAddressFindPort(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressFindPort(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
int *targetIdx, int *targetIdx,
const char *portStr) const char *portStr)
{ {
virDomainUSBAddressHubPtr hub = NULL; virDomainUSBAddressHub *hub = NULL;
ssize_t i, lastIdx, targetPort; ssize_t i, lastIdx, targetPort;
if (info->addr.usb.bus >= addrs->nbuses || if (info->addr.usb.bus >= addrs->nbuses ||
@ -2076,11 +2076,11 @@ virDomainUSBAddressFindPort(virDomainUSBAddressSetPtr addrs,
int int
virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressSetAddHub(virDomainUSBAddressSet *addrs,
virDomainHubDefPtr hub) virDomainHubDef *hub)
{ {
virDomainUSBAddressHubPtr targetHub = NULL; virDomainUSBAddressHub *targetHub = NULL;
virDomainUSBAddressHubPtr newHub = NULL; virDomainUSBAddressHub *newHub = NULL;
int ret = -1; int ret = -1;
int targetPort; int targetPort;
g_autofree char *portStr = NULL; g_autofree char *portStr = NULL;
@ -2121,13 +2121,13 @@ virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs,
int int
virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressSetAddControllers(virDomainUSBAddressSet *addrs,
virDomainDefPtr def) virDomainDef *def)
{ {
size_t i; size_t i;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
virDomainControllerDefPtr cont = def->controllers[i]; virDomainControllerDef *cont = def->controllers[i];
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) { if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
if (virDomainUSBAddressSetAddController(addrs, cont) < 0) if (virDomainUSBAddressSetAddController(addrs, cont) < 0)
return -1; return -1;
@ -2135,7 +2135,7 @@ virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
} }
for (i = 0; i < def->nhubs; i++) { for (i = 0; i < def->nhubs; i++) {
virDomainHubDefPtr hub = def->hubs[i]; virDomainHubDef *hub = def->hubs[i];
if (hub->type == VIR_DOMAIN_HUB_TYPE_USB && if (hub->type == VIR_DOMAIN_HUB_TYPE_USB &&
hub->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB && hub->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB &&
virDomainUSBAddressPortIsValid(hub->info.addr.usb.port)) { virDomainUSBAddressPortIsValid(hub->info.addr.usb.port)) {
@ -2150,7 +2150,7 @@ virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
static int static int
virDomainUSBAddressFindFreePort(virDomainUSBAddressHubPtr hub, virDomainUSBAddressFindFreePort(virDomainUSBAddressHub *hub,
unsigned int *portpath, unsigned int *portpath,
unsigned int level) unsigned int level)
{ {
@ -2190,18 +2190,18 @@ virDomainUSBAddressFindFreePort(virDomainUSBAddressHubPtr hub,
size_t size_t
virDomainUSBAddressCountAllPorts(virDomainDefPtr def) virDomainUSBAddressCountAllPorts(virDomainDef *def)
{ {
size_t i, ret = 0; size_t i, ret = 0;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
virDomainControllerDefPtr cont = def->controllers[i]; virDomainControllerDef *cont = def->controllers[i];
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB)
ret += virDomainUSBAddressControllerModelToPorts(cont); ret += virDomainUSBAddressControllerModelToPorts(cont);
} }
for (i = 0; i < def->nhubs; i++) { for (i = 0; i < def->nhubs; i++) {
virDomainHubDefPtr hub = def->hubs[i]; virDomainHubDef *hub = def->hubs[i];
if (hub->type == VIR_DOMAIN_HUB_TYPE_USB) if (hub->type == VIR_DOMAIN_HUB_TYPE_USB)
ret += VIR_DOMAIN_USB_HUB_PORTS; ret += VIR_DOMAIN_USB_HUB_PORTS;
} }
@ -2216,12 +2216,12 @@ virDomainUSBAddressCountAllPorts(virDomainDefPtr def)
* -2 if there is no bus at @bus or no free port on this bus * -2 if there is no bus at @bus or no free port on this bus
*/ */
static int static int
virDomainUSBAddressAssignFromBus(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressAssignFromBus(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
size_t bus) size_t bus)
{ {
unsigned int portpath[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH] = { 0 }; unsigned int portpath[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH] = { 0 };
virDomainUSBAddressHubPtr hub = addrs->buses[bus]; virDomainUSBAddressHub *hub = addrs->buses[bus];
g_autofree char *portStr = NULL; g_autofree char *portStr = NULL;
if (!hub) if (!hub)
@ -2247,8 +2247,8 @@ virDomainUSBAddressAssignFromBus(virDomainUSBAddressSetPtr addrs,
int int
virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressAssign(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
{ {
size_t i; size_t i;
int rc; int rc;
@ -2280,7 +2280,7 @@ virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs,
int int
virDomainUSBAddressPresent(virDomainDeviceInfoPtr info, virDomainUSBAddressPresent(virDomainDeviceInfo *info,
void *data G_GNUC_UNUSED) void *data G_GNUC_UNUSED)
{ {
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB && if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB &&
@ -2292,11 +2292,11 @@ virDomainUSBAddressPresent(virDomainDeviceInfoPtr info,
int int
virDomainUSBAddressReserve(virDomainDeviceInfoPtr info, virDomainUSBAddressReserve(virDomainDeviceInfo *info,
void *data) void *data)
{ {
virDomainUSBAddressSetPtr addrs = data; virDomainUSBAddressSet *addrs = data;
virDomainUSBAddressHubPtr targetHub = NULL; virDomainUSBAddressHub *targetHub = NULL;
g_autofree char *portStr = NULL; g_autofree char *portStr = NULL;
int targetPort; int targetPort;
@ -2329,8 +2329,8 @@ virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
int int
virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressEnsure(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
{ {
if (!addrs) if (!addrs)
return 0; return 0;
@ -2350,10 +2350,10 @@ virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs,
int int
virDomainUSBAddressRelease(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressRelease(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
{ {
virDomainUSBAddressHubPtr targetHub = NULL; virDomainUSBAddressHub *targetHub = NULL;
g_autofree char *portStr = NULL; g_autofree char *portStr = NULL;
int targetPort; int targetPort;

View File

@ -112,13 +112,11 @@ typedef struct {
/* See virDomainDeviceInfo::isolationGroupLocked */ /* See virDomainDeviceInfo::isolationGroupLocked */
bool isolationGroupLocked; bool isolationGroupLocked;
} virDomainPCIAddressBus; } virDomainPCIAddressBus;
typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr;
typedef struct { typedef struct {
GHashTable *uids; GHashTable *uids;
GHashTable *fids; GHashTable *fids;
} virDomainZPCIAddressIds; } virDomainZPCIAddressIds;
typedef virDomainZPCIAddressIds *virDomainZPCIAddressIdsPtr;
struct _virDomainPCIAddressSet { struct _virDomainPCIAddressSet {
virDomainPCIAddressBus *buses; virDomainPCIAddressBus *buses;
@ -129,70 +127,70 @@ struct _virDomainPCIAddressSet {
bool areMultipleRootsSupported; bool areMultipleRootsSupported;
/* If true, the guest can use the pcie-to-pci-bridge controller */ /* If true, the guest can use the pcie-to-pci-bridge controller */
bool isPCIeToPCIBridgeSupported; bool isPCIeToPCIBridgeSupported;
virDomainZPCIAddressIdsPtr zpciIds; virDomainZPCIAddressIds *zpciIds;
}; };
typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet; typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses, virDomainPCIAddressSet *
virPCIDeviceAddressExtensionFlags extFlags); virDomainPCIAddressSetAlloc(unsigned int nbuses,
virPCIDeviceAddressExtensionFlags extFlags);
void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs); void virDomainPCIAddressSetFree(virDomainPCIAddressSet *addrs);
bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs, bool virDomainPCIAddressValidate(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
const char *addrStr, const char *addrStr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
bool fromConfig) bool fromConfig)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus, int virDomainPCIAddressBusSetModel(virDomainPCIAddressBus *bus,
virDomainControllerModelPCI model, virDomainControllerModelPCI model,
bool allowHotplug) bool allowHotplug)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus) bool virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBus *bus)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressReserveAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr, virPCIDeviceAddress *addr,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
unsigned int isolationGroup) unsigned int isolationGroup)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSet *addrs,
virDomainDeviceInfoPtr dev, virDomainDeviceInfo *dev,
virDomainPCIConnectFlags flags, virDomainPCIConnectFlags flags,
int function) int function)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSet *addrs,
virDomainDeviceInfoPtr dev, virDomainDeviceInfo *dev,
virDomainPCIConnectFlags flags) virDomainPCIConnectFlags flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, void virDomainPCIAddressReleaseAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs, void virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSet *addrs,
virPCIDeviceAddressPtr addr) virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainPCIAddressSetAllMulti(virDomainDefPtr def) void virDomainPCIAddressSetAllMulti(virDomainDef *def)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
struct _virDomainCCWAddressSet { struct _virDomainCCWAddressSet {
@ -200,53 +198,50 @@ struct _virDomainCCWAddressSet {
virDomainDeviceCCWAddress next; virDomainDeviceCCWAddress next;
}; };
typedef struct _virDomainCCWAddressSet virDomainCCWAddressSet; typedef struct _virDomainCCWAddressSet virDomainCCWAddressSet;
typedef virDomainCCWAddressSet *virDomainCCWAddressSetPtr;
int virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev, int virDomainCCWAddressAssign(virDomainDeviceInfo *dev,
virDomainCCWAddressSetPtr addrs, virDomainCCWAddressSet *addrs,
bool autoassign) bool autoassign)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs); void virDomainCCWAddressSetFree(virDomainCCWAddressSet *addrs);
char* virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr) char* virDomainCCWAddressAsString(virDomainDeviceCCWAddress *addr)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virDomainCCWAddressSetPtr virDomainCCWAddressSet *
virDomainCCWAddressSetCreateFromDomain(virDomainDefPtr def) virDomainCCWAddressSetCreateFromDomain(virDomainDef *def)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
struct _virDomainVirtioSerialController { struct _virDomainVirtioSerialController {
unsigned int idx; unsigned int idx;
virBitmapPtr ports; virBitmap *ports;
}; };
typedef struct _virDomainVirtioSerialController virDomainVirtioSerialController; typedef struct _virDomainVirtioSerialController virDomainVirtioSerialController;
typedef virDomainVirtioSerialController *virDomainVirtioSerialControllerPtr;
struct _virDomainVirtioSerialAddrSet { struct _virDomainVirtioSerialAddrSet {
virDomainVirtioSerialControllerPtr *controllers; virDomainVirtioSerialController **controllers;
size_t ncontrollers; size_t ncontrollers;
}; };
typedef struct _virDomainVirtioSerialAddrSet virDomainVirtioSerialAddrSet; typedef struct _virDomainVirtioSerialAddrSet virDomainVirtioSerialAddrSet;
typedef virDomainVirtioSerialAddrSet *virDomainVirtioSerialAddrSetPtr;
void void
virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs); virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSet *addrs);
virDomainVirtioSerialAddrSetPtr virDomainVirtioSerialAddrSet *
virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def) virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDef *def)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool bool
virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfoPtr info); virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfo *info);
int int
virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def, virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDef *def,
virDomainVirtioSerialAddrSetPtr addrs, virDomainVirtioSerialAddrSet *addrs,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
bool allowZero) bool allowZero)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int int
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def, virDomainVirtioSerialAddrAutoAssign(virDomainDef *def,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
bool allowZero) bool allowZero)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
@ -255,64 +250,62 @@ virDomainUSBAddressPortIsValid(unsigned int *port)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void void
virDomainUSBAddressPortFormatBuf(virBufferPtr buf, virDomainUSBAddressPortFormatBuf(virBuffer *buf,
unsigned int *port) unsigned int *port)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
#define VIR_DOMAIN_USB_HUB_PORTS 8 #define VIR_DOMAIN_USB_HUB_PORTS 8
typedef struct _virDomainUSBAddressHub virDomainUSBAddressHub; typedef struct _virDomainUSBAddressHub virDomainUSBAddressHub;
typedef virDomainUSBAddressHub *virDomainUSBAddressHubPtr;
struct _virDomainUSBAddressHub { struct _virDomainUSBAddressHub {
/* indexes are shifted by one: /* indexes are shifted by one:
* ports[0] represents port 1, because ports are numbered from 1 */ * ports[0] represents port 1, because ports are numbered from 1 */
virBitmapPtr portmap; virBitmap *portmap;
size_t nports; size_t nports;
virDomainUSBAddressHubPtr *ports; virDomainUSBAddressHub **ports;
}; };
struct _virDomainUSBAddressSet { struct _virDomainUSBAddressSet {
/* every <controller type='usb' index='i'> is represented /* every <controller type='usb' index='i'> is represented
* as a hub at buses[i] */ * as a hub at buses[i] */
virDomainUSBAddressHubPtr *buses; virDomainUSBAddressHub **buses;
size_t nbuses; size_t nbuses;
}; };
typedef struct _virDomainUSBAddressSet virDomainUSBAddressSet; typedef struct _virDomainUSBAddressSet virDomainUSBAddressSet;
typedef virDomainUSBAddressSet *virDomainUSBAddressSetPtr;
virDomainUSBAddressSetPtr virDomainUSBAddressSetCreate(void); virDomainUSBAddressSet *virDomainUSBAddressSetCreate(void);
int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs, int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSet *addrs,
virDomainDefPtr def) virDomainDef *def)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int int
virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressSetAddHub(virDomainUSBAddressSet *addrs,
virDomainHubDefPtr hub) virDomainHubDef *hub)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
size_t size_t
virDomainUSBAddressCountAllPorts(virDomainDefPtr def); virDomainUSBAddressCountAllPorts(virDomainDef *def);
void virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs); void virDomainUSBAddressSetFree(virDomainUSBAddressSet *addrs);
int int
virDomainUSBAddressPresent(virDomainDeviceInfoPtr info, virDomainUSBAddressPresent(virDomainDeviceInfo *info,
void *data) void *data)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int int
virDomainUSBAddressReserve(virDomainDeviceInfoPtr info, virDomainUSBAddressReserve(virDomainDeviceInfo *info,
void *data) void *data)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int int
virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressAssign(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int int
virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressEnsure(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);
int int
virDomainUSBAddressRelease(virDomainUSBAddressSetPtr addrs, virDomainUSBAddressRelease(virDomainUSBAddressSet *addrs,
virDomainDeviceInfoPtr info) virDomainDeviceInfo *info)
ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(2);

View File

@ -65,7 +65,7 @@ virDomainAuditGetRdev(const char *path G_GNUC_UNUSED)
static const char * static const char *
virDomainAuditGetVirtType(virDomainDefPtr def) virDomainAuditGetVirtType(virDomainDef *def)
{ {
const char *virt; const char *virt;
@ -80,7 +80,7 @@ virDomainAuditGetVirtType(virDomainDefPtr def)
static void static void
virDomainAuditGenericDev(virDomainObjPtr vm, virDomainAuditGenericDev(virDomainObj *vm,
const char *type, const char *type,
const char *oldsrcpath, const char *oldsrcpath,
const char *newsrcpath, const char *newsrcpath,
@ -120,14 +120,14 @@ virDomainAuditGenericDev(virDomainObjPtr vm,
void void
virDomainAuditChardev(virDomainObjPtr vm, virDomainAuditChardev(virDomainObj *vm,
virDomainChrDefPtr oldDef, virDomainChrDef *oldDef,
virDomainChrDefPtr newDef, virDomainChrDef *newDef,
const char *reason, const char *reason,
bool success) bool success)
{ {
virDomainChrSourceDefPtr oldsrc = NULL; virDomainChrSourceDef *oldsrc = NULL;
virDomainChrSourceDefPtr newsrc = NULL; virDomainChrSourceDef *newsrc = NULL;
if (oldDef) if (oldDef)
oldsrc = oldDef->source; oldsrc = oldDef->source;
@ -143,8 +143,8 @@ virDomainAuditChardev(virDomainObjPtr vm,
static void static void
virDomainAuditSmartcard(virDomainObjPtr vm, virDomainAuditSmartcard(virDomainObj *vm,
virDomainSmartcardDefPtr def, virDomainSmartcardDef *def,
const char *reason, const char *reason,
bool success) bool success)
{ {
@ -188,9 +188,9 @@ virDomainAuditSmartcard(virDomainObjPtr vm,
void void
virDomainAuditDisk(virDomainObjPtr vm, virDomainAuditDisk(virDomainObj *vm,
virStorageSourcePtr oldDef, virStorageSource *oldDef,
virStorageSourcePtr newDef, virStorageSource *newDef,
const char *reason, const char *reason,
bool success) bool success)
{ {
@ -208,8 +208,8 @@ virDomainAuditDisk(virDomainObjPtr vm,
void void
virDomainAuditRNG(virDomainObjPtr vm, virDomainAuditRNG(virDomainObj *vm,
virDomainRNGDefPtr oldDef, virDomainRNGDefPtr newDef, virDomainRNGDef *oldDef, virDomainRNGDef *newDef,
const char *reason, bool success) const char *reason, bool success)
{ {
const char *newsrcpath = NULL; const char *newsrcpath = NULL;
@ -252,8 +252,8 @@ virDomainAuditRNG(virDomainObjPtr vm,
void void
virDomainAuditFS(virDomainObjPtr vm, virDomainAuditFS(virDomainObj *vm,
virDomainFSDefPtr oldDef, virDomainFSDefPtr newDef, virDomainFSDef *oldDef, virDomainFSDef *newDef,
const char *reason, bool success) const char *reason, bool success)
{ {
virDomainAuditGenericDev(vm, "fs", virDomainAuditGenericDev(vm, "fs",
@ -264,8 +264,8 @@ virDomainAuditFS(virDomainObjPtr vm,
void void
virDomainAuditNet(virDomainObjPtr vm, virDomainAuditNet(virDomainObj *vm,
virDomainNetDefPtr oldDef, virDomainNetDefPtr newDef, virDomainNetDef *oldDef, virDomainNetDef *newDef,
const char *reason, bool success) const char *reason, bool success)
{ {
char newMacstr[VIR_MAC_STRING_BUFLEN]; char newMacstr[VIR_MAC_STRING_BUFLEN];
@ -296,7 +296,7 @@ virDomainAuditNet(virDomainObjPtr vm,
* Log an audit message about an attempted network device open. * Log an audit message about an attempted network device open.
*/ */
void void
virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef, virDomainAuditNetDevice(virDomainDef *vmDef, virDomainNetDef *netDef,
const char *device, bool success) const char *device, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -336,7 +336,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
* Log an audit message about an attempted device passthrough change. * Log an audit message about an attempted device passthrough change.
*/ */
void void
virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef *hostdev,
const char *reason, bool success) const char *reason, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -345,11 +345,11 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
char *device = NULL; char *device = NULL;
const char *virt = virDomainAuditGetVirtType(vm->def); const char *virt = virDomainAuditGetVirtType(vm->def);
virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb; virDomainHostdevSubsysUSB *usbsrc = &hostdev->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci; virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &hostdev->source.subsys.u.scsi_host; virDomainHostdevSubsysSCSIVHost *hostsrc = &hostdev->source.subsys.u.scsi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &hostdev->source.subsys.u.mdev; virDomainHostdevSubsysMediatedDev *mdevsrc = &hostdev->source.subsys.u.mdev;
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) { if (!(vmname = virAuditEncode("vm", vm->def->name))) {
@ -374,8 +374,8 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
*/ */
goto cleanup; goto cleanup;
} else { } else {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
&scsisrc->u.host;
address = g_strdup_printf("%s:%u:%u:%llu", address = g_strdup_printf("%s:%u:%u:%llu",
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->target,
@ -465,7 +465,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
* Log an audit message about an attempted device passthrough change. * Log an audit message about an attempted device passthrough change.
*/ */
void void
virDomainAuditRedirdev(virDomainObjPtr vm, virDomainRedirdevDefPtr redirdev, virDomainAuditRedirdev(virDomainObj *vm, virDomainRedirdevDef *redirdev,
const char *reason, bool success) const char *reason, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -519,7 +519,7 @@ virDomainAuditRedirdev(virDomainObjPtr vm, virDomainRedirdevDefPtr redirdev,
* change. * change.
*/ */
static void static void
virDomainAuditTPM(virDomainObjPtr vm, virDomainTPMDefPtr tpm, virDomainAuditTPM(virDomainObj *vm, virDomainTPMDef *tpm,
const char *reason, bool success) const char *reason, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -582,7 +582,7 @@ virDomainAuditTPM(virDomainObjPtr vm, virDomainTPMDefPtr tpm,
* Log an audit message about an attempted cgroup device ACL change. * Log an audit message about an attempted cgroup device ACL change.
*/ */
void void
virDomainAuditCgroup(virDomainObjPtr vm, virCgroupPtr cgroup, virDomainAuditCgroup(virDomainObj *vm, virCgroup *cgroup,
const char *reason, const char *extra, bool success) const char *reason, const char *extra, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -625,7 +625,7 @@ virDomainAuditCgroup(virDomainObjPtr vm, virCgroupPtr cgroup,
* Log an audit message about an attempted cgroup device ACL change. * Log an audit message about an attempted cgroup device ACL change.
*/ */
void void
virDomainAuditCgroupMajor(virDomainObjPtr vm, virCgroupPtr cgroup, virDomainAuditCgroupMajor(virDomainObj *vm, virCgroup *cgroup,
const char *reason, int maj, const char *name, const char *reason, int maj, const char *name,
const char *perms, bool success) const char *perms, bool success)
{ {
@ -652,7 +652,7 @@ virDomainAuditCgroupMajor(virDomainObjPtr vm, virCgroupPtr cgroup,
* a specific device. * a specific device.
*/ */
void void
virDomainAuditCgroupPath(virDomainObjPtr vm, virCgroupPtr cgroup, virDomainAuditCgroupPath(virDomainObj *vm, virCgroup *cgroup,
const char *reason, const char *path, const char *perms, const char *reason, const char *path, const char *perms,
int rc) int rc)
{ {
@ -694,7 +694,7 @@ virDomainAuditCgroupPath(virDomainObjPtr vm, virCgroupPtr cgroup,
* Log an audit message about an attempted resource change. * Log an audit message about an attempted resource change.
*/ */
static void static void
virDomainAuditResource(virDomainObjPtr vm, const char *resource, virDomainAuditResource(virDomainObj *vm, const char *resource,
unsigned long long oldval, unsigned long long newval, unsigned long long oldval, unsigned long long newval,
const char *reason, bool success) const char *reason, bool success)
{ {
@ -717,7 +717,7 @@ virDomainAuditResource(virDomainObjPtr vm, const char *resource,
} }
void void
virDomainAuditMemory(virDomainObjPtr vm, virDomainAuditMemory(virDomainObj *vm,
unsigned long long oldmem, unsigned long long newmem, unsigned long long oldmem, unsigned long long newmem,
const char *reason, bool success) const char *reason, bool success)
{ {
@ -725,7 +725,7 @@ virDomainAuditMemory(virDomainObjPtr vm,
} }
void void
virDomainAuditVcpu(virDomainObjPtr vm, virDomainAuditVcpu(virDomainObj *vm,
unsigned int oldvcpu, unsigned int newvcpu, unsigned int oldvcpu, unsigned int newvcpu,
const char *reason, bool success) const char *reason, bool success)
{ {
@ -733,7 +733,7 @@ virDomainAuditVcpu(virDomainObjPtr vm,
} }
void void
virDomainAuditIOThread(virDomainObjPtr vm, virDomainAuditIOThread(virDomainObj *vm,
unsigned int oldiothread, unsigned int newiothread, unsigned int oldiothread, unsigned int newiothread,
const char *reason, bool success) const char *reason, bool success)
{ {
@ -742,7 +742,7 @@ virDomainAuditIOThread(virDomainObjPtr vm,
} }
static void static void
virDomainAuditLifecycle(virDomainObjPtr vm, const char *op, virDomainAuditLifecycle(virDomainObj *vm, const char *op,
const char *reason, bool success) const char *reason, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -765,7 +765,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op,
void void
virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success) virDomainAuditStart(virDomainObj *vm, const char *reason, bool success)
{ {
size_t i; size_t i;
@ -773,22 +773,22 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
virDomainAuditDisk(vm, NULL, vm->def->disks[i]->src, "start", true); virDomainAuditDisk(vm, NULL, vm->def->disks[i]->src, "start", true);
for (i = 0; i < vm->def->nfss; i++) { for (i = 0; i < vm->def->nfss; i++) {
virDomainFSDefPtr fs = vm->def->fss[i]; virDomainFSDef *fs = vm->def->fss[i];
virDomainAuditFS(vm, NULL, fs, "start", true); virDomainAuditFS(vm, NULL, fs, "start", true);
} }
for (i = 0; i < vm->def->nnets; i++) { for (i = 0; i < vm->def->nnets; i++) {
virDomainNetDefPtr net = vm->def->nets[i]; virDomainNetDef *net = vm->def->nets[i];
virDomainAuditNet(vm, NULL, net, "start", true); virDomainAuditNet(vm, NULL, net, "start", true);
} }
for (i = 0; i < vm->def->nhostdevs; i++) { for (i = 0; i < vm->def->nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = vm->def->hostdevs[i]; virDomainHostdevDef *hostdev = vm->def->hostdevs[i];
virDomainAuditHostdev(vm, hostdev, "start", true); virDomainAuditHostdev(vm, hostdev, "start", true);
} }
for (i = 0; i < vm->def->nredirdevs; i++) { for (i = 0; i < vm->def->nredirdevs; i++) {
virDomainRedirdevDefPtr redirdev = vm->def->redirdevs[i]; virDomainRedirdevDef *redirdev = vm->def->redirdevs[i];
virDomainAuditRedirdev(vm, redirdev, "start", true); virDomainAuditRedirdev(vm, redirdev, "start", true);
} }
@ -836,7 +836,7 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
} }
void void
virDomainAuditInit(virDomainObjPtr vm, virDomainAuditInit(virDomainObj *vm,
pid_t initpid, pid_t initpid,
ino_t pidns) ino_t pidns)
{ {
@ -860,13 +860,13 @@ virDomainAuditInit(virDomainObjPtr vm,
} }
void void
virDomainAuditStop(virDomainObjPtr vm, const char *reason) virDomainAuditStop(virDomainObj *vm, const char *reason)
{ {
virDomainAuditLifecycle(vm, "stop", reason, true); virDomainAuditLifecycle(vm, "stop", reason, true);
} }
void void
virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success) virDomainAuditSecurityLabel(virDomainObj *vm, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
char *vmname; char *vmname;
@ -892,8 +892,8 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success)
} }
void void
virDomainAuditShmem(virDomainObjPtr vm, virDomainAuditShmem(virDomainObj *vm,
virDomainShmemDefPtr def, virDomainShmemDef *def,
const char *reason, bool success) const char *reason, bool success)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -935,8 +935,8 @@ virDomainAuditShmem(virDomainObjPtr vm,
void void
virDomainAuditInput(virDomainObjPtr vm, virDomainAuditInput(virDomainObj *vm,
virDomainInputDefPtr input, virDomainInputDef *input,
const char *reason, const char *reason,
bool success) bool success)
{ {

View File

@ -24,54 +24,54 @@
#include "domain_conf.h" #include "domain_conf.h"
#include "vircgroup.h" #include "vircgroup.h"
void virDomainAuditStart(virDomainObjPtr vm, void virDomainAuditStart(virDomainObj *vm,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainAuditInit(virDomainObjPtr vm, void virDomainAuditInit(virDomainObj *vm,
pid_t pid, pid_t pid,
ino_t pidns) ino_t pidns)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void virDomainAuditStop(virDomainObjPtr vm, void virDomainAuditStop(virDomainObj *vm,
const char *reason) const char *reason)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void virDomainAuditDisk(virDomainObjPtr vm, void virDomainAuditDisk(virDomainObj *vm,
virStorageSourcePtr oldDef, virStorageSource *oldDef,
virStorageSourcePtr newDef, virStorageSource *newDef,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditFS(virDomainObjPtr vm, void virDomainAuditFS(virDomainObj *vm,
virDomainFSDefPtr oldDef, virDomainFSDef *oldDef,
virDomainFSDefPtr newDef, virDomainFSDef *newDef,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditNet(virDomainObjPtr vm, void virDomainAuditNet(virDomainObj *vm,
virDomainNetDefPtr oldDef, virDomainNetDef *oldDef,
virDomainNetDefPtr newDef, virDomainNetDef *newDef,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditNetDevice(virDomainDefPtr vmDef, void virDomainAuditNetDevice(virDomainDef *vmDef,
virDomainNetDefPtr netDef, virDomainNetDef *netDef,
const char *device, const char *device,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
void virDomainAuditHostdev(virDomainObjPtr vm, void virDomainAuditHostdev(virDomainObj *vm,
virDomainHostdevDefPtr def, virDomainHostdevDef *def,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
void virDomainAuditCgroup(virDomainObjPtr vm, void virDomainAuditCgroup(virDomainObj *vm,
virCgroupPtr group, virCgroup *group,
const char *reason, const char *reason,
const char *extra, const char *extra,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(4);
void virDomainAuditCgroupMajor(virDomainObjPtr vm, void virDomainAuditCgroupMajor(virDomainObj *vm,
virCgroupPtr group, virCgroup *group,
const char *reason, const char *reason,
int maj, int maj,
const char *name, const char *name,
@ -79,59 +79,59 @@ void virDomainAuditCgroupMajor(virDomainObjPtr vm,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6); ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6);
void virDomainAuditCgroupPath(virDomainObjPtr vm, void virDomainAuditCgroupPath(virDomainObj *vm,
virCgroupPtr group, virCgroup *group,
const char *reason, const char *reason,
const char *path, const char *path,
const char *perms, const char *perms,
int rc) int rc)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
void virDomainAuditMemory(virDomainObjPtr vm, void virDomainAuditMemory(virDomainObj *vm,
unsigned long long oldmem, unsigned long long oldmem,
unsigned long long newmem, unsigned long long newmem,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditVcpu(virDomainObjPtr vm, void virDomainAuditVcpu(virDomainObj *vm,
unsigned int oldvcpu, unsigned int oldvcpu,
unsigned int newvcpu, unsigned int newvcpu,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditIOThread(virDomainObjPtr vm, void virDomainAuditIOThread(virDomainObj *vm,
unsigned int oldiothread, unsigned int oldiothread,
unsigned int newiothread, unsigned int newiothread,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditSecurityLabel(virDomainObjPtr vm, void virDomainAuditSecurityLabel(virDomainObj *vm,
bool success) bool success)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void virDomainAuditRedirdev(virDomainObjPtr vm, void virDomainAuditRedirdev(virDomainObj *vm,
virDomainRedirdevDefPtr def, virDomainRedirdevDef *def,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
void virDomainAuditChardev(virDomainObjPtr vm, void virDomainAuditChardev(virDomainObj *vm,
virDomainChrDefPtr oldDef, virDomainChrDef *oldDef,
virDomainChrDefPtr newDef, virDomainChrDef *newDef,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditRNG(virDomainObjPtr vm, void virDomainAuditRNG(virDomainObj *vm,
virDomainRNGDefPtr oldDef, virDomainRNGDef *oldDef,
virDomainRNGDefPtr newDef, virDomainRNGDef *newDef,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
void virDomainAuditShmem(virDomainObjPtr vm, void virDomainAuditShmem(virDomainObj *vm,
virDomainShmemDefPtr def, virDomainShmemDef *def,
const char *reason, bool success) const char *reason, bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
void virDomainAuditInput(virDomainObjPtr vm, void virDomainAuditInput(virDomainObj *vm,
virDomainInputDefPtr input, virDomainInputDef *input,
const char *reason, const char *reason,
bool success) bool success)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);

View File

@ -44,8 +44,8 @@ VIR_ENUM_IMPL(virDomainCapsFeature,
"backup", "backup",
); );
static virClassPtr virDomainCapsClass; static virClass *virDomainCapsClass;
static virClassPtr virDomainCapsCPUModelsClass; static virClass *virDomainCapsCPUModelsClass;
static void virDomainCapsDispose(void *obj); static void virDomainCapsDispose(void *obj);
static void virDomainCapsCPUModelsDispose(void *obj); static void virDomainCapsCPUModelsDispose(void *obj);
@ -80,8 +80,8 @@ virSEVCapabilitiesFree(virSEVCapability *cap)
static void static void
virDomainCapsDispose(void *obj) virDomainCapsDispose(void *obj)
{ {
virDomainCapsPtr caps = obj; virDomainCaps *caps = obj;
virDomainCapsStringValuesPtr values; virDomainCapsStringValues *values;
size_t i; size_t i;
g_free(caps->path); g_free(caps->path);
@ -100,7 +100,7 @@ virDomainCapsDispose(void *obj)
static void static void
virDomainCapsCPUModelsDispose(void *obj) virDomainCapsCPUModelsDispose(void *obj)
{ {
virDomainCapsCPUModelsPtr cpuModels = obj; virDomainCapsCPUModels *cpuModels = obj;
size_t i; size_t i;
for (i = 0; i < cpuModels->nmodels; i++) { for (i = 0; i < cpuModels->nmodels; i++) {
@ -112,13 +112,13 @@ virDomainCapsCPUModelsDispose(void *obj)
} }
virDomainCapsPtr virDomainCaps *
virDomainCapsNew(const char *path, virDomainCapsNew(const char *path,
const char *machine, const char *machine,
virArch arch, virArch arch,
virDomainVirtType virttype) virDomainVirtType virttype)
{ {
virDomainCapsPtr caps = NULL; virDomainCaps *caps = NULL;
if (virDomainCapsInitialize() < 0) if (virDomainCapsInitialize() < 0)
return NULL; return NULL;
@ -135,10 +135,10 @@ virDomainCapsNew(const char *path,
} }
virDomainCapsCPUModelsPtr virDomainCapsCPUModels *
virDomainCapsCPUModelsNew(size_t nmodels) virDomainCapsCPUModelsNew(size_t nmodels)
{ {
virDomainCapsCPUModelsPtr cpuModels = NULL; virDomainCapsCPUModels *cpuModels = NULL;
if (virDomainCapsInitialize() < 0) if (virDomainCapsInitialize() < 0)
return NULL; return NULL;
@ -153,10 +153,10 @@ virDomainCapsCPUModelsNew(size_t nmodels)
} }
virDomainCapsCPUModelsPtr virDomainCapsCPUModels *
virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old) virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old)
{ {
virDomainCapsCPUModelsPtr cpuModels; virDomainCapsCPUModels *cpuModels;
size_t i; size_t i;
if (!(cpuModels = virDomainCapsCPUModelsNew(old->nmodels))) if (!(cpuModels = virDomainCapsCPUModelsNew(old->nmodels)))
@ -180,14 +180,14 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
int int
virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuModels,
const char *name, const char *name,
virDomainCapsCPUUsable usable, virDomainCapsCPUUsable usable,
char **blockers, char **blockers,
bool deprecated) bool deprecated)
{ {
g_autofree char * nameCopy = NULL; g_autofree char * nameCopy = NULL;
virDomainCapsCPUModelPtr cpu; virDomainCapsCPUModel *cpu;
nameCopy = g_strdup(name); nameCopy = g_strdup(name);
@ -206,8 +206,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
} }
virDomainCapsCPUModelPtr virDomainCapsCPUModel *
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels, virDomainCapsCPUModelsGet(virDomainCapsCPUModels *cpuModels,
const char *name) const char *name)
{ {
size_t i; size_t i;
@ -225,7 +225,7 @@ virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
int int
virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum, virDomainCapsEnumSet(virDomainCapsEnum *capsEnum,
const char *capsEnumName, const char *capsEnumName,
size_t nvalues, size_t nvalues,
unsigned int *values) unsigned int *values)
@ -252,14 +252,14 @@ virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
void void
virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum) virDomainCapsEnumClear(virDomainCapsEnum *capsEnum)
{ {
capsEnum->values = 0; capsEnum->values = 0;
} }
static int static int
virDomainCapsEnumFormat(virBufferPtr buf, virDomainCapsEnumFormat(virBuffer *buf,
const virDomainCapsEnum *capsEnum, const virDomainCapsEnum *capsEnum,
const char *capsEnumName, const char *capsEnumName,
virDomainCapsValToStr valToStr) virDomainCapsValToStr valToStr)
@ -294,7 +294,7 @@ virDomainCapsEnumFormat(virBufferPtr buf,
static void static void
virDomainCapsStringValuesFormat(virBufferPtr buf, virDomainCapsStringValuesFormat(virBuffer *buf,
const virDomainCapsStringValues *values) const virDomainCapsStringValues *values)
{ {
size_t i; size_t i;
@ -330,7 +330,7 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
static void static void
qemuDomainCapsFeatureFormatSimple(virBufferPtr buf, qemuDomainCapsFeatureFormatSimple(virBuffer *buf,
const char *featurename, const char *featurename,
virTristateBool supported) virTristateBool supported)
{ {
@ -343,7 +343,7 @@ qemuDomainCapsFeatureFormatSimple(virBufferPtr buf,
static void static void
virDomainCapsLoaderFormat(virBufferPtr buf, virDomainCapsLoaderFormat(virBuffer *buf,
const virDomainCapsLoader *loader) const virDomainCapsLoader *loader)
{ {
FORMAT_PROLOGUE(loader); FORMAT_PROLOGUE(loader);
@ -357,7 +357,7 @@ virDomainCapsLoaderFormat(virBufferPtr buf,
} }
static void static void
virDomainCapsOSFormat(virBufferPtr buf, virDomainCapsOSFormat(virBuffer *buf,
const virDomainCapsOS *os) const virDomainCapsOS *os)
{ {
const virDomainCapsLoader *loader = &os->loader; const virDomainCapsLoader *loader = &os->loader;
@ -372,15 +372,15 @@ virDomainCapsOSFormat(virBufferPtr buf,
} }
static void static void
virDomainCapsCPUCustomFormat(virBufferPtr buf, virDomainCapsCPUCustomFormat(virBuffer *buf,
virDomainCapsCPUModelsPtr custom) virDomainCapsCPUModels *custom)
{ {
size_t i; size_t i;
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (i = 0; i < custom->nmodels; i++) { for (i = 0; i < custom->nmodels; i++) {
virDomainCapsCPUModelPtr model = custom->models + i; virDomainCapsCPUModel *model = custom->models + i;
virBufferAsprintf(buf, "<model usable='%s'", virBufferAsprintf(buf, "<model usable='%s'",
virDomainCapsCPUUsableTypeToString(model->usable)); virDomainCapsCPUUsableTypeToString(model->usable));
if (model->deprecated) if (model->deprecated)
@ -393,7 +393,7 @@ virDomainCapsCPUCustomFormat(virBufferPtr buf,
} }
static void static void
virDomainCapsCPUFormat(virBufferPtr buf, virDomainCapsCPUFormat(virBuffer *buf,
const virDomainCapsCPU *cpu) const virDomainCapsCPU *cpu)
{ {
virBufferAddLit(buf, "<cpu>\n"); virBufferAddLit(buf, "<cpu>\n");
@ -458,7 +458,7 @@ virDomainCapsCPUFormat(virBufferPtr buf,
} }
static void static void
virDomainCapsDeviceDiskFormat(virBufferPtr buf, virDomainCapsDeviceDiskFormat(virBuffer *buf,
const virDomainCapsDeviceDisk *disk) const virDomainCapsDeviceDisk *disk)
{ {
FORMAT_PROLOGUE(disk); FORMAT_PROLOGUE(disk);
@ -472,7 +472,7 @@ virDomainCapsDeviceDiskFormat(virBufferPtr buf,
static void static void
virDomainCapsDeviceGraphicsFormat(virBufferPtr buf, virDomainCapsDeviceGraphicsFormat(virBuffer *buf,
const virDomainCapsDeviceGraphics *graphics) const virDomainCapsDeviceGraphics *graphics)
{ {
FORMAT_PROLOGUE(graphics); FORMAT_PROLOGUE(graphics);
@ -484,7 +484,7 @@ virDomainCapsDeviceGraphicsFormat(virBufferPtr buf,
static void static void
virDomainCapsDeviceVideoFormat(virBufferPtr buf, virDomainCapsDeviceVideoFormat(virBuffer *buf,
const virDomainCapsDeviceVideo *video) const virDomainCapsDeviceVideo *video)
{ {
FORMAT_PROLOGUE(video); FORMAT_PROLOGUE(video);
@ -496,7 +496,7 @@ virDomainCapsDeviceVideoFormat(virBufferPtr buf,
static void static void
virDomainCapsDeviceHostdevFormat(virBufferPtr buf, virDomainCapsDeviceHostdevFormat(virBuffer *buf,
const virDomainCapsDeviceHostdev *hostdev) const virDomainCapsDeviceHostdev *hostdev)
{ {
FORMAT_PROLOGUE(hostdev); FORMAT_PROLOGUE(hostdev);
@ -512,7 +512,7 @@ virDomainCapsDeviceHostdevFormat(virBufferPtr buf,
static void static void
virDomainCapsDeviceRNGFormat(virBufferPtr buf, virDomainCapsDeviceRNGFormat(virBuffer *buf,
const virDomainCapsDeviceRNG *rng) const virDomainCapsDeviceRNG *rng)
{ {
FORMAT_PROLOGUE(rng); FORMAT_PROLOGUE(rng);
@ -541,7 +541,7 @@ virDomainCapsDeviceRNGFormat(virBufferPtr buf,
* </gic> * </gic>
*/ */
static void static void
virDomainCapsFeatureGICFormat(virBufferPtr buf, virDomainCapsFeatureGICFormat(virBuffer *buf,
const virDomainCapsFeatureGIC *gic) const virDomainCapsFeatureGIC *gic)
{ {
FORMAT_PROLOGUE(gic); FORMAT_PROLOGUE(gic);
@ -552,7 +552,7 @@ virDomainCapsFeatureGICFormat(virBufferPtr buf,
} }
static void static void
virDomainCapsFeatureSEVFormat(virBufferPtr buf, virDomainCapsFeatureSEVFormat(virBuffer *buf,
const virSEVCapability *sev) const virSEVCapability *sev)
{ {
if (!sev) { if (!sev) {
@ -573,7 +573,7 @@ virDomainCapsFeatureSEVFormat(virBufferPtr buf,
static void static void
virDomainCapsFormatFeatures(const virDomainCaps *caps, virDomainCapsFormatFeatures(const virDomainCaps *caps,
virBufferPtr buf) virBuffer *buf)
{ {
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
size_t i; size_t i;

View File

@ -27,10 +27,8 @@
typedef const char * (*virDomainCapsValToStr)(int value); typedef const char * (*virDomainCapsValToStr)(int value);
typedef struct _virDomainCaps virDomainCaps; typedef struct _virDomainCaps virDomainCaps;
typedef virDomainCaps *virDomainCapsPtr;
typedef struct _virDomainCapsEnum virDomainCapsEnum; typedef struct _virDomainCapsEnum virDomainCapsEnum;
typedef virDomainCapsEnum *virDomainCapsEnumPtr;
struct _virDomainCapsEnum { struct _virDomainCapsEnum {
bool report; /* Whether the format the enum at all */ bool report; /* Whether the format the enum at all */
unsigned int values; /* Bitmask of values supported in the corresponding enum */ unsigned int values; /* Bitmask of values supported in the corresponding enum */
@ -40,7 +38,6 @@ struct _virDomainCapsEnum {
G_STATIC_ASSERT(last <= sizeof(unsigned int) * CHAR_BIT) G_STATIC_ASSERT(last <= sizeof(unsigned int) * CHAR_BIT)
typedef struct _virDomainCapsStringValues virDomainCapsStringValues; typedef struct _virDomainCapsStringValues virDomainCapsStringValues;
typedef virDomainCapsStringValues *virDomainCapsStringValuesPtr;
struct _virDomainCapsStringValues { struct _virDomainCapsStringValues {
char **values; /* raw string values */ char **values; /* raw string values */
size_t nvalues; /* number of strings */ size_t nvalues; /* number of strings */
@ -49,7 +46,6 @@ struct _virDomainCapsStringValues {
STATIC_ASSERT_ENUM(VIR_DOMAIN_LOADER_TYPE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_LOADER_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_TRISTATE_BOOL_LAST); STATIC_ASSERT_ENUM(VIR_TRISTATE_BOOL_LAST);
typedef struct _virDomainCapsLoader virDomainCapsLoader; typedef struct _virDomainCapsLoader virDomainCapsLoader;
typedef virDomainCapsLoader *virDomainCapsLoaderPtr;
struct _virDomainCapsLoader { struct _virDomainCapsLoader {
virTristateBool supported; virTristateBool supported;
virDomainCapsStringValues values; /* Info about values for the element */ virDomainCapsStringValues values; /* Info about values for the element */
@ -60,7 +56,6 @@ struct _virDomainCapsLoader {
STATIC_ASSERT_ENUM(VIR_DOMAIN_OS_DEF_FIRMWARE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_OS_DEF_FIRMWARE_LAST);
typedef struct _virDomainCapsOS virDomainCapsOS; typedef struct _virDomainCapsOS virDomainCapsOS;
typedef virDomainCapsOS *virDomainCapsOSPtr;
struct _virDomainCapsOS { struct _virDomainCapsOS {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum firmware; /* Info about virDomainOsDefFirmware */ virDomainCapsEnum firmware; /* Info about virDomainOsDefFirmware */
@ -71,7 +66,6 @@ STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_DEVICE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_BUS_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_BUS_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_MODEL_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_DISK_MODEL_LAST);
typedef struct _virDomainCapsDeviceDisk virDomainCapsDeviceDisk; typedef struct _virDomainCapsDeviceDisk virDomainCapsDeviceDisk;
typedef virDomainCapsDeviceDisk *virDomainCapsDeviceDiskPtr;
struct _virDomainCapsDeviceDisk { struct _virDomainCapsDeviceDisk {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum diskDevice; /* Info about virDomainDiskDevice enum values */ virDomainCapsEnum diskDevice; /* Info about virDomainDiskDevice enum values */
@ -82,7 +76,6 @@ struct _virDomainCapsDeviceDisk {
STATIC_ASSERT_ENUM(VIR_DOMAIN_GRAPHICS_TYPE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_GRAPHICS_TYPE_LAST);
typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics; typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics;
typedef virDomainCapsDeviceGraphics *virDomainCapsDeviceGraphicsPtr;
struct _virDomainCapsDeviceGraphics { struct _virDomainCapsDeviceGraphics {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum type; /* virDomainGraphicsType */ virDomainCapsEnum type; /* virDomainGraphicsType */
@ -90,7 +83,6 @@ struct _virDomainCapsDeviceGraphics {
STATIC_ASSERT_ENUM(VIR_DOMAIN_VIDEO_TYPE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_VIDEO_TYPE_LAST);
typedef struct _virDomainCapsDeviceVideo virDomainCapsDeviceVideo; typedef struct _virDomainCapsDeviceVideo virDomainCapsDeviceVideo;
typedef virDomainCapsDeviceVideo *virDomainCapsDeviceVideoPtr;
struct _virDomainCapsDeviceVideo { struct _virDomainCapsDeviceVideo {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum modelType; /* virDomainVideoType */ virDomainCapsEnum modelType; /* virDomainVideoType */
@ -102,7 +94,6 @@ STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST);
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev; typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr;
struct _virDomainCapsDeviceHostdev { struct _virDomainCapsDeviceHostdev {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum mode; /* Info about virDomainHostdevMode */ virDomainCapsEnum mode; /* Info about virDomainHostdevMode */
@ -116,7 +107,6 @@ struct _virDomainCapsDeviceHostdev {
STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_MODEL_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_MODEL_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_BACKEND_LAST); STATIC_ASSERT_ENUM(VIR_DOMAIN_RNG_BACKEND_LAST);
typedef struct _virDomainCapsDeviceRNG virDomainCapsDeviceRNG; typedef struct _virDomainCapsDeviceRNG virDomainCapsDeviceRNG;
typedef virDomainCapsDeviceRNG *virDomainCapsDeviceRNGPtr;
struct _virDomainCapsDeviceRNG { struct _virDomainCapsDeviceRNG {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum model; /* virDomainRNGModel */ virDomainCapsEnum model; /* virDomainRNGModel */
@ -125,7 +115,6 @@ struct _virDomainCapsDeviceRNG {
STATIC_ASSERT_ENUM(VIR_GIC_VERSION_LAST); STATIC_ASSERT_ENUM(VIR_GIC_VERSION_LAST);
typedef struct _virDomainCapsFeatureGIC virDomainCapsFeatureGIC; typedef struct _virDomainCapsFeatureGIC virDomainCapsFeatureGIC;
typedef virDomainCapsFeatureGIC *virDomainCapsFeatureGICPtr;
struct _virDomainCapsFeatureGIC { struct _virDomainCapsFeatureGIC {
virTristateBool supported; virTristateBool supported;
virDomainCapsEnum version; /* Info about virGICVersion */ virDomainCapsEnum version; /* Info about virGICVersion */
@ -141,7 +130,6 @@ typedef enum {
VIR_ENUM_DECL(virDomainCapsCPUUsable); VIR_ENUM_DECL(virDomainCapsCPUUsable);
typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel; typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
struct _virDomainCapsCPUModel { struct _virDomainCapsCPUModel {
char *name; char *name;
virDomainCapsCPUUsable usable; virDomainCapsCPUUsable usable;
@ -150,30 +138,27 @@ struct _virDomainCapsCPUModel {
}; };
typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels; typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
typedef virDomainCapsCPUModels *virDomainCapsCPUModelsPtr;
struct _virDomainCapsCPUModels { struct _virDomainCapsCPUModels {
virObject parent; virObject parent;
size_t nmodels_max; size_t nmodels_max;
size_t nmodels; size_t nmodels;
virDomainCapsCPUModelPtr models; virDomainCapsCPUModel *models;
}; };
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCapsCPUModels, virObjectUnref); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCapsCPUModels, virObjectUnref);
typedef struct _virDomainCapsCPU virDomainCapsCPU; typedef struct _virDomainCapsCPU virDomainCapsCPU;
typedef virDomainCapsCPU *virDomainCapsCPUPtr;
struct _virDomainCapsCPU { struct _virDomainCapsCPU {
bool hostPassthrough; bool hostPassthrough;
virDomainCapsEnum hostPassthroughMigratable; virDomainCapsEnum hostPassthroughMigratable;
bool maximum; bool maximum;
virDomainCapsEnum maximumMigratable; virDomainCapsEnum maximumMigratable;
virCPUDefPtr hostModel; virCPUDef *hostModel;
virDomainCapsCPUModelsPtr custom; virDomainCapsCPUModels *custom;
}; };
typedef struct _virSEVCapability virSEVCapability; typedef struct _virSEVCapability virSEVCapability;
typedef virSEVCapability *virSEVCapabilityPtr;
struct _virSEVCapability { struct _virSEVCapability {
char *pdh; char *pdh;
char *cert_chain; char *cert_chain;
@ -212,7 +197,7 @@ struct _virDomainCaps {
/* add new domain devices here */ /* add new domain devices here */
virDomainCapsFeatureGIC gic; virDomainCapsFeatureGIC gic;
virSEVCapabilityPtr sev; virSEVCapability *sev;
/* add new domain features here */ /* add new domain features here */
virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST]; virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST];
@ -221,20 +206,20 @@ struct _virDomainCaps {
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCaps, virObjectUnref); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCaps, virObjectUnref);
virDomainCapsPtr virDomainCapsNew(const char *path, virDomainCaps *virDomainCapsNew(const char *path,
const char *machine, const char *machine,
virArch arch, virArch arch,
virDomainVirtType virttype); virDomainVirtType virttype);
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels); virDomainCapsCPUModels *virDomainCapsCPUModelsNew(size_t nmodels);
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old); virDomainCapsCPUModels *virDomainCapsCPUModelsCopy(virDomainCapsCPUModels *old);
int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, int virDomainCapsCPUModelsAdd(virDomainCapsCPUModels *cpuModels,
const char *name, const char *name,
virDomainCapsCPUUsable usable, virDomainCapsCPUUsable usable,
char **blockers, char **blockers,
bool deprecated); bool deprecated);
virDomainCapsCPUModelPtr virDomainCapsCPUModel *
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels, virDomainCapsCPUModelsGet(virDomainCapsCPUModels *cpuModels,
const char *name); const char *name);
#define VIR_DOMAIN_CAPS_ENUM_IS_SET(capsEnum, value) \ #define VIR_DOMAIN_CAPS_ENUM_IS_SET(capsEnum, value) \
@ -249,11 +234,11 @@ virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
} while (0) } while (0)
int virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum, int virDomainCapsEnumSet(virDomainCapsEnum *capsEnum,
const char *capsEnumName, const char *capsEnumName,
size_t nvalues, size_t nvalues,
unsigned int *values); unsigned int *values);
void virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum); void virDomainCapsEnumClear(virDomainCapsEnum *capsEnum);
char * virDomainCapsFormat(const virDomainCaps *caps); char * virDomainCapsFormat(const virDomainCaps *caps);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,241 +27,241 @@
#include "domain_conf.h" #include "domain_conf.h"
virObjectEventPtr virObjectEvent *
virDomainEventLifecycleNew(int id, virDomainEventLifecycleNew(int id,
const char *name, const char *name,
const unsigned char *uuid, const unsigned char *uuid,
int type, int type,
int detail); int detail);
virObjectEventPtr virObjectEvent *
virDomainEventLifecycleNewFromDom(virDomainPtr dom, virDomainEventLifecycleNewFromDom(virDomainPtr dom,
int type, int type,
int detail); int detail);
virObjectEventPtr virObjectEvent *
virDomainEventLifecycleNewFromObj(virDomainObjPtr obj, virDomainEventLifecycleNewFromObj(virDomainObj *obj,
int type, int type,
int detail); int detail);
virObjectEventPtr virObjectEvent *
virDomainEventLifecycleNewFromDef(virDomainDefPtr def, virDomainEventLifecycleNewFromDef(virDomainDef *def,
int type, int type,
int detail); int detail);
virObjectEventPtr virObjectEvent *
virDomainEventRebootNew(int id, virDomainEventRebootNew(int id,
const char *name, const char *name,
const unsigned char *uuid); const unsigned char *uuid);
virObjectEventPtr virObjectEvent *
virDomainEventRebootNewFromDom(virDomainPtr dom); virDomainEventRebootNewFromDom(virDomainPtr dom);
virObjectEventPtr virObjectEvent *
virDomainEventRebootNewFromObj(virDomainObjPtr obj); virDomainEventRebootNewFromObj(virDomainObj *obj);
virObjectEventPtr virObjectEvent *
virDomainEventRTCChangeNewFromDom(virDomainPtr dom, virDomainEventRTCChangeNewFromDom(virDomainPtr dom,
long long offset); long long offset);
virObjectEventPtr virObjectEvent *
virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, virDomainEventRTCChangeNewFromObj(virDomainObj *obj,
long long offset); long long offset);
virObjectEventPtr virObjectEvent *
virDomainEventWatchdogNewFromDom(virDomainPtr dom, virDomainEventWatchdogNewFromDom(virDomainPtr dom,
int action); int action);
virObjectEventPtr virObjectEvent *
virDomainEventWatchdogNewFromObj(virDomainObjPtr obj, virDomainEventWatchdogNewFromObj(virDomainObj *obj,
int action); int action);
virObjectEventPtr virObjectEvent *
virDomainEventIOErrorNewFromDom(virDomainPtr dom, virDomainEventIOErrorNewFromDom(virDomainPtr dom,
const char *srcPath, const char *srcPath,
const char *devAlias, const char *devAlias,
int action); int action);
virObjectEventPtr virObjectEvent *
virDomainEventIOErrorNewFromObj(virDomainObjPtr obj, virDomainEventIOErrorNewFromObj(virDomainObj *obj,
const char *srcPath, const char *srcPath,
const char *devAlias, const char *devAlias,
int action); int action);
virObjectEventPtr virObjectEvent *
virDomainEventIOErrorReasonNewFromDom(virDomainPtr dom, virDomainEventIOErrorReasonNewFromDom(virDomainPtr dom,
const char *srcPath, const char *srcPath,
const char *devAlias, const char *devAlias,
int action, int action,
const char *reason); const char *reason);
virObjectEventPtr virObjectEvent *
virDomainEventIOErrorReasonNewFromObj(virDomainObjPtr obj, virDomainEventIOErrorReasonNewFromObj(virDomainObj *obj,
const char *srcPath, const char *srcPath,
const char *devAlias, const char *devAlias,
int action, int action,
const char *reason); const char *reason);
virObjectEventPtr virObjectEvent *
virDomainEventGraphicsNewFromDom(virDomainPtr dom, virDomainEventGraphicsNewFromDom(virDomainPtr dom,
int phase, int phase,
virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote, virDomainEventGraphicsAddressPtr remote,
const char *authScheme, const char *authScheme,
virDomainEventGraphicsSubjectPtr subject); virDomainEventGraphicsSubjectPtr subject);
virObjectEventPtr virObjectEvent *
virDomainEventGraphicsNewFromObj(virDomainObjPtr obj, virDomainEventGraphicsNewFromObj(virDomainObj *obj,
int phase, int phase,
virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote, virDomainEventGraphicsAddressPtr remote,
const char *authScheme, const char *authScheme,
virDomainEventGraphicsSubjectPtr subject); virDomainEventGraphicsSubjectPtr subject);
virObjectEventPtr virObjectEvent *
virDomainEventControlErrorNewFromDom(virDomainPtr dom); virDomainEventControlErrorNewFromDom(virDomainPtr dom);
virObjectEventPtr virObjectEvent *
virDomainEventControlErrorNewFromObj(virDomainObjPtr obj); virDomainEventControlErrorNewFromObj(virDomainObj *obj);
virObjectEventPtr virObjectEvent *
virDomainEventBlockJobNewFromObj(virDomainObjPtr obj, virDomainEventBlockJobNewFromObj(virDomainObj *obj,
const char *path, const char *path,
int type, int type,
int status); int status);
virObjectEventPtr virObjectEvent *
virDomainEventBlockJobNewFromDom(virDomainPtr dom, virDomainEventBlockJobNewFromDom(virDomainPtr dom,
const char *path, const char *path,
int type, int type,
int status); int status);
virObjectEventPtr virObjectEvent *
virDomainEventBlockJob2NewFromObj(virDomainObjPtr obj, virDomainEventBlockJob2NewFromObj(virDomainObj *obj,
const char *dst, const char *dst,
int type, int type,
int status); int status);
virObjectEventPtr virObjectEvent *
virDomainEventBlockJob2NewFromDom(virDomainPtr dom, virDomainEventBlockJob2NewFromDom(virDomainPtr dom,
const char *dst, const char *dst,
int type, int type,
int status); int status);
virObjectEventPtr virObjectEvent *
virDomainEventDiskChangeNewFromObj(virDomainObjPtr obj, virDomainEventDiskChangeNewFromObj(virDomainObj *obj,
const char *oldSrcPath, const char *oldSrcPath,
const char *newSrcPath, const char *newSrcPath,
const char *devAlias, const char *devAlias,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventDiskChangeNewFromDom(virDomainPtr dom, virDomainEventDiskChangeNewFromDom(virDomainPtr dom,
const char *oldSrcPath, const char *oldSrcPath,
const char *newSrcPath, const char *newSrcPath,
const char *devAlias, const char *devAlias,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventTrayChangeNewFromObj(virDomainObjPtr obj, virDomainEventTrayChangeNewFromObj(virDomainObj *obj,
const char *devAlias, const char *devAlias,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventTrayChangeNewFromDom(virDomainPtr dom, virDomainEventTrayChangeNewFromDom(virDomainPtr dom,
const char *devAlias, const char *devAlias,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventPMWakeupNewFromObj(virDomainObjPtr obj); virDomainEventPMWakeupNewFromObj(virDomainObj *obj);
virObjectEventPtr virObjectEvent *
virDomainEventPMWakeupNewFromDom(virDomainPtr dom, int reason); virDomainEventPMWakeupNewFromDom(virDomainPtr dom, int reason);
virObjectEventPtr virObjectEvent *
virDomainEventPMSuspendNewFromObj(virDomainObjPtr obj); virDomainEventPMSuspendNewFromObj(virDomainObj *obj);
virObjectEventPtr virObjectEvent *
virDomainEventPMSuspendNewFromDom(virDomainPtr dom, int reason); virDomainEventPMSuspendNewFromDom(virDomainPtr dom, int reason);
virObjectEventPtr virObjectEvent *
virDomainEventBalloonChangeNewFromDom(virDomainPtr dom, virDomainEventBalloonChangeNewFromDom(virDomainPtr dom,
unsigned long long actual); unsigned long long actual);
virObjectEventPtr virObjectEvent *
virDomainEventBalloonChangeNewFromObj(virDomainObjPtr obj, virDomainEventBalloonChangeNewFromObj(virDomainObj *obj,
unsigned long long actual); unsigned long long actual);
virObjectEventPtr virObjectEvent *
virDomainEventPMSuspendDiskNewFromObj(virDomainObjPtr obj); virDomainEventPMSuspendDiskNewFromObj(virDomainObj *obj);
virObjectEventPtr virObjectEvent *
virDomainEventPMSuspendDiskNewFromDom(virDomainPtr dom, int reason); virDomainEventPMSuspendDiskNewFromDom(virDomainPtr dom, int reason);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceRemovedNewFromObj(virDomainObjPtr obj, virDomainEventDeviceRemovedNewFromObj(virDomainObj *obj,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceRemovedNewFromDom(virDomainPtr dom, virDomainEventDeviceRemovedNewFromDom(virDomainPtr dom,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceAddedNewFromObj(virDomainObjPtr obj, virDomainEventDeviceAddedNewFromObj(virDomainObj *obj,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceAddedNewFromDom(virDomainPtr dom, virDomainEventDeviceAddedNewFromDom(virDomainPtr dom,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceRemovalFailedNewFromObj(virDomainObjPtr obj, virDomainEventDeviceRemovalFailedNewFromObj(virDomainObj *obj,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventDeviceRemovalFailedNewFromDom(virDomainPtr dom, virDomainEventDeviceRemovalFailedNewFromDom(virDomainPtr dom,
const char *devAlias); const char *devAlias);
virObjectEventPtr virObjectEvent *
virDomainEventTunableNewFromObj(virDomainObjPtr obj, virDomainEventTunableNewFromObj(virDomainObj *obj,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams); int nparams);
virObjectEventPtr virObjectEvent *
virDomainEventTunableNewFromDom(virDomainPtr dom, virDomainEventTunableNewFromDom(virDomainPtr dom,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams); int nparams);
virObjectEventPtr virObjectEvent *
virDomainEventAgentLifecycleNewFromObj(virDomainObjPtr obj, virDomainEventAgentLifecycleNewFromObj(virDomainObj *obj,
int state, int state,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventAgentLifecycleNewFromDom(virDomainPtr dom, virDomainEventAgentLifecycleNewFromDom(virDomainPtr dom,
int state, int state,
int reason); int reason);
virObjectEventPtr virObjectEvent *
virDomainEventMigrationIterationNewFromObj(virDomainObjPtr obj, virDomainEventMigrationIterationNewFromObj(virDomainObj *obj,
int iteration); int iteration);
virObjectEventPtr virObjectEvent *
virDomainEventMigrationIterationNewFromDom(virDomainPtr dom, virDomainEventMigrationIterationNewFromDom(virDomainPtr dom,
int iteration); int iteration);
virObjectEventPtr virObjectEvent *
virDomainEventJobCompletedNewFromObj(virDomainObjPtr obj, virDomainEventJobCompletedNewFromObj(virDomainObj *obj,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams); int nparams);
virObjectEventPtr virObjectEvent *
virDomainEventJobCompletedNewFromDom(virDomainPtr dom, virDomainEventJobCompletedNewFromDom(virDomainPtr dom,
virTypedParameterPtr params, virTypedParameterPtr params,
int nparams); int nparams);
virObjectEventPtr virObjectEvent *
virDomainEventMetadataChangeNewFromObj(virDomainObjPtr obj, virDomainEventMetadataChangeNewFromObj(virDomainObj *obj,
int type, int type,
const char *nsuri); const char *nsuri);
virObjectEventPtr virObjectEvent *
virDomainEventMetadataChangeNewFromDom(virDomainPtr dom, virDomainEventMetadataChangeNewFromDom(virDomainPtr dom,
int type, int type,
const char *nsuri); const char *nsuri);
virObjectEventPtr virObjectEvent *
virDomainEventBlockThresholdNewFromObj(virDomainObjPtr obj, virDomainEventBlockThresholdNewFromObj(virDomainObj *obj,
const char *dev, const char *dev,
const char *path, const char *path,
unsigned long long threshold, unsigned long long threshold,
unsigned long long excess); unsigned long long excess);
virObjectEventPtr virObjectEvent *
virDomainEventBlockThresholdNewFromDom(virDomainPtr dom, virDomainEventBlockThresholdNewFromDom(virDomainPtr dom,
const char *dev, const char *dev,
const char *path, const char *path,
unsigned long long threshold, unsigned long long threshold,
unsigned long long excess); unsigned long long excess);
virObjectEventPtr virObjectEvent *
virDomainEventMemoryFailureNewFromObj(virDomainObjPtr obj, virDomainEventMemoryFailureNewFromObj(virDomainObj *obj,
int recipient, int recipient,
int action, int action,
unsigned int flags); unsigned int flags);
virObjectEventPtr virObjectEvent *
virDomainEventMemoryFailureNewFromDom(virDomainPtr dom, virDomainEventMemoryFailureNewFromDom(virDomainPtr dom,
int recipient, int recipient,
int action, int action,
@ -269,14 +269,14 @@ virDomainEventMemoryFailureNewFromDom(virDomainPtr dom,
int int
virDomainEventStateRegister(virConnectPtr conn, virDomainEventStateRegister(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virConnectDomainEventCallback callback, virConnectDomainEventCallback callback,
void *opaque, void *opaque,
virFreeCallback freecb) virFreeCallback freecb)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int int
virDomainEventStateRegisterID(virConnectPtr conn, virDomainEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virDomainPtr dom, virDomainPtr dom,
int eventID, int eventID,
virConnectDomainEventGenericCallback cb, virConnectDomainEventGenericCallback cb,
@ -286,7 +286,7 @@ virDomainEventStateRegisterID(virConnectPtr conn,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
int int
virDomainEventStateRegisterClient(virConnectPtr conn, virDomainEventStateRegisterClient(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virDomainPtr dom, virDomainPtr dom,
int eventID, int eventID,
virConnectDomainEventGenericCallback cb, virConnectDomainEventGenericCallback cb,
@ -300,7 +300,7 @@ virDomainEventStateRegisterClient(virConnectPtr conn,
int int
virDomainEventStateCallbackID(virConnectPtr conn, virDomainEventStateCallbackID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virConnectDomainEventCallback callback, virConnectDomainEventCallback callback,
int *remoteID) int *remoteID)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
@ -308,13 +308,13 @@ virDomainEventStateCallbackID(virConnectPtr conn,
int int
virDomainEventStateDeregister(virConnectPtr conn, virDomainEventStateDeregister(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virConnectDomainEventCallback callback) virConnectDomainEventCallback callback)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int int
virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn, virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virDomainPtr dom, virDomainPtr dom,
const char *event, const char *event,
virConnectDomainQemuMonitorEventCallback cb, virConnectDomainQemuMonitorEventCallback cb,
@ -325,7 +325,7 @@ virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(9); ATTRIBUTE_NONNULL(9);
virObjectEventPtr virObjectEvent *
virDomainQemuMonitorEventNew(int id, virDomainQemuMonitorEventNew(int id,
const char *name, const char *name,
const unsigned char *uuid, const unsigned char *uuid,

View File

@ -37,12 +37,12 @@ VIR_LOG_INIT("conf.domain_nwfilter");
#define VIR_FROM_THIS VIR_FROM_NWFILTER #define VIR_FROM_THIS VIR_FROM_NWFILTER
static virNWFilterBindingDefPtr static virNWFilterBindingDef *
virNWFilterBindingDefForNet(const char *vmname, virNWFilterBindingDefForNet(const char *vmname,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virDomainNetDefPtr net) virDomainNetDef *net)
{ {
virNWFilterBindingDefPtr ret; virNWFilterBindingDef *ret;
ret = g_new0(virNWFilterBindingDef, 1); ret = g_new0(virNWFilterBindingDef, 1);
@ -77,11 +77,11 @@ virNWFilterBindingDefForNet(const char *vmname,
int int
virDomainConfNWFilterInstantiate(const char *vmname, virDomainConfNWFilterInstantiate(const char *vmname,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virDomainNetDefPtr net, virDomainNetDef *net,
bool ignoreExists) bool ignoreExists)
{ {
virConnectPtr conn = virGetConnectNWFilter(); virConnectPtr conn = virGetConnectNWFilter();
virNWFilterBindingDefPtr def = NULL; virNWFilterBindingDef *def = NULL;
virNWFilterBindingPtr binding = NULL; virNWFilterBindingPtr binding = NULL;
char *xml = NULL; char *xml = NULL;
int ret = -1; int ret = -1;
@ -122,7 +122,7 @@ virDomainConfNWFilterInstantiate(const char *vmname,
static void static void
virDomainConfNWFilterTeardownImpl(virConnectPtr conn, virDomainConfNWFilterTeardownImpl(virConnectPtr conn,
virDomainNetDefPtr net) virDomainNetDef *net)
{ {
virNWFilterBindingPtr binding; virNWFilterBindingPtr binding;
@ -140,7 +140,7 @@ virDomainConfNWFilterTeardownImpl(virConnectPtr conn,
void void
virDomainConfNWFilterTeardown(virDomainNetDefPtr net) virDomainConfNWFilterTeardown(virDomainNetDef *net)
{ {
virConnectPtr conn; virConnectPtr conn;
@ -156,13 +156,13 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net)
} }
void void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) virDomainConfVMNWFilterTeardown(virDomainObj *vm)
{ {
size_t i; size_t i;
virConnectPtr conn = NULL; virConnectPtr conn = NULL;
for (i = 0; i < vm->def->nnets; i++) { for (i = 0; i < vm->def->nnets; i++) {
virDomainNetDefPtr net = vm->def->nets[i]; virDomainNetDef *net = vm->def->nets[i];
if (!net->filter) if (!net->filter)
continue; continue;

View File

@ -23,7 +23,7 @@
int virDomainConfNWFilterInstantiate(const char *vmname, int virDomainConfNWFilterInstantiate(const char *vmname,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virDomainNetDefPtr net, virDomainNetDef *net,
bool ignoreExists); bool ignoreExists);
void virDomainConfNWFilterTeardown(virDomainNetDefPtr net); void virDomainConfNWFilterTeardown(virDomainNetDef *net);
void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm); void virDomainConfVMNWFilterTeardown(virDomainObj *vm);

View File

@ -79,7 +79,7 @@ virDomainDefVideoValidate(const virDomainDef *def)
static int static int
virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptionsPtr virtio) virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptions *virtio)
{ {
if (!virtio) if (!virtio)
return 0; return 0;
@ -238,12 +238,12 @@ virDomainDiskAddressDiskBusCompatibility(virDomainDiskBus bus,
static int static int
virSecurityDeviceLabelDefValidate(virSecurityDeviceLabelDefPtr *seclabels, virSecurityDeviceLabelDefValidate(virSecurityDeviceLabelDef **seclabels,
size_t nseclabels, size_t nseclabels,
virSecurityLabelDefPtr *vmSeclabels, virSecurityLabelDef **vmSeclabels,
size_t nvmSeclabels) size_t nvmSeclabels)
{ {
virSecurityDeviceLabelDefPtr seclabel; virSecurityDeviceLabelDef *seclabel;
size_t i; size_t i;
size_t j; size_t j;
@ -437,7 +437,7 @@ static int
virDomainDiskDefValidate(const virDomainDef *def, virDomainDiskDefValidate(const virDomainDef *def,
const virDomainDiskDef *disk) const virDomainDiskDef *disk)
{ {
virStorageSourcePtr next; virStorageSource *next;
/* Validate LUN configuration */ /* Validate LUN configuration */
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
@ -884,15 +884,15 @@ virDomainDefDuplicateDriveAddressesValidate(const virDomainDef *def)
size_t j; size_t j;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
virDomainDiskDefPtr disk_i = def->disks[i]; virDomainDiskDef *disk_i = def->disks[i];
virDomainDeviceInfoPtr disk_info_i = &disk_i->info; virDomainDeviceInfo *disk_info_i = &disk_i->info;
if (disk_info_i->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) if (disk_info_i->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE)
continue; continue;
for (j = i + 1; j < def->ndisks; j++) { for (j = i + 1; j < def->ndisks; j++) {
virDomainDiskDefPtr disk_j = def->disks[j]; virDomainDiskDef *disk_j = def->disks[j];
virDomainDeviceInfoPtr disk_info_j = &disk_j->info; virDomainDeviceInfo *disk_info_j = &disk_j->info;
if (disk_i->bus != disk_j->bus) if (disk_i->bus != disk_j->bus)
continue; continue;
@ -921,9 +921,9 @@ virDomainDefDuplicateDriveAddressesValidate(const virDomainDef *def)
} }
for (i = 0; i < def->nhostdevs; i++) { for (i = 0; i < def->nhostdevs; i++) {
virDomainHostdevDefPtr hdev_i = def->hostdevs[i]; virDomainHostdevDef *hdev_i = def->hostdevs[i];
virDomainDeviceInfoPtr hdev_info_i = hdev_i->info; virDomainDeviceInfo *hdev_info_i = hdev_i->info;
virDomainDeviceDriveAddressPtr hdev_addr_i; virDomainDeviceDriveAddress *hdev_addr_i;
if (!virHostdevIsSCSIDevice(hdev_i)) if (!virHostdevIsSCSIDevice(hdev_i))
continue; continue;
@ -933,8 +933,8 @@ virDomainDefDuplicateDriveAddressesValidate(const virDomainDef *def)
hdev_addr_i = &hdev_info_i->addr.drive; hdev_addr_i = &hdev_info_i->addr.drive;
for (j = i + 1; j < def->nhostdevs; j++) { for (j = i + 1; j < def->nhostdevs; j++) {
virDomainHostdevDefPtr hdev_j = def->hostdevs[j]; virDomainHostdevDef *hdev_j = def->hostdevs[j];
virDomainDeviceInfoPtr hdev_info_j = hdev_j->info; virDomainDeviceInfo *hdev_info_j = hdev_j->info;
if (!virHostdevIsSCSIDevice(hdev_j)) if (!virHostdevIsSCSIDevice(hdev_j))
continue; continue;
@ -980,9 +980,9 @@ struct virDomainDefValidateAliasesData {
static int static int
virDomainDeviceDefValidateAliasesIterator(virDomainDefPtr def, virDomainDeviceDefValidateAliasesIterator(virDomainDef *def,
virDomainDeviceDefPtr dev, virDomainDeviceDef *dev,
virDomainDeviceInfoPtr info, virDomainDeviceInfo *info,
void *opaque) void *opaque)
{ {
struct virDomainDefValidateAliasesData *data = opaque; struct virDomainDefValidateAliasesData *data = opaque;
@ -1043,7 +1043,7 @@ virDomainDefValidateAliases(const virDomainDef *def,
if (!(data.aliases = virHashNew(NULL))) if (!(data.aliases = virHashNew(NULL)))
goto cleanup; goto cleanup;
if (virDomainDeviceInfoIterateFlags((virDomainDefPtr) def, if (virDomainDeviceInfoIterateFlags((virDomainDef *) def,
virDomainDeviceDefValidateAliasesIterator, virDomainDeviceDefValidateAliasesIterator,
DOMAIN_DEVICE_ITERATE_ALL_CONSOLES, DOMAIN_DEVICE_ITERATE_ALL_CONSOLES,
&data) < 0) &data) < 0)
@ -1061,10 +1061,10 @@ virDomainDefValidateAliases(const virDomainDef *def,
static int static int
virDomainDeviceValidateAliasImpl(const virDomainDef *def, virDomainDeviceValidateAliasImpl(const virDomainDef *def,
virDomainDeviceDefPtr dev) virDomainDeviceDef *dev)
{ {
GHashTable *aliases = NULL; GHashTable *aliases = NULL;
virDomainDeviceInfoPtr info = virDomainDeviceGetInfo(dev); virDomainDeviceInfo *info = virDomainDeviceGetInfo(dev);
int ret = -1; int ret = -1;
if (!info || !info->alias) if (!info || !info->alias)
@ -1089,12 +1089,12 @@ virDomainDeviceValidateAliasImpl(const virDomainDef *def,
int int
virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm, virDomainDeviceValidateAliasForHotplug(virDomainObj *vm,
virDomainDeviceDefPtr dev, virDomainDeviceDef *dev,
unsigned int flags) unsigned int flags)
{ {
virDomainDefPtr persDef = NULL; virDomainDef *persDef = NULL;
virDomainDefPtr liveDef = NULL; virDomainDef *liveDef = NULL;
if (virDomainObjGetDefs(vm, flags, &liveDef, &persDef) < 0) if (virDomainObjGetDefs(vm, flags, &liveDef, &persDef) < 0)
return -1; return -1;
@ -1187,7 +1187,7 @@ virDomainDefMemtuneValidate(const virDomainDef *def)
static int static int
virDomainDefOSValidate(const virDomainDef *def, virDomainDefOSValidate(const virDomainDef *def,
virDomainXMLOptionPtr xmlopt) virDomainXMLOption *xmlopt)
{ {
if (!def->os.loader) if (!def->os.loader)
return 0; return 0;
@ -1294,7 +1294,7 @@ virDomainDefIOMMUValidate(const virDomainDef *def)
static int static int
virDomainDefValidateInternal(const virDomainDef *def, virDomainDefValidateInternal(const virDomainDef *def,
virDomainXMLOptionPtr xmlopt) virDomainXMLOption *xmlopt)
{ {
if (virDomainDefDuplicateDiskInfoValidate(def) < 0) if (virDomainDefDuplicateDiskInfoValidate(def) < 0)
return -1; return -1;
@ -1343,9 +1343,9 @@ virDomainDefValidateInternal(const virDomainDef *def,
static int static int
virDomainDefValidateDeviceIterator(virDomainDefPtr def, virDomainDefValidateDeviceIterator(virDomainDef *def,
virDomainDeviceDefPtr dev, virDomainDeviceDef *dev,
virDomainDeviceInfoPtr info G_GNUC_UNUSED, virDomainDeviceInfo *info G_GNUC_UNUSED,
void *opaque) void *opaque)
{ {
struct virDomainDefPostParseDeviceIteratorData *data = opaque; struct virDomainDefPostParseDeviceIteratorData *data = opaque;
@ -1372,9 +1372,9 @@ virDomainDefValidateDeviceIterator(virDomainDefPtr def,
* appropriate message. * appropriate message.
*/ */
int int
virDomainDefValidate(virDomainDefPtr def, virDomainDefValidate(virDomainDef *def,
unsigned int parseFlags, unsigned int parseFlags,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque) void *parseOpaque)
{ {
struct virDomainDefPostParseDeviceIteratorData data = { struct virDomainDefPostParseDeviceIteratorData data = {
@ -1939,7 +1939,7 @@ int
virDomainDeviceDefValidate(const virDomainDeviceDef *dev, virDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def, const virDomainDef *def,
unsigned int parseFlags, unsigned int parseFlags,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque) void *parseOpaque)
{ {
/* validate configuration only in certain places */ /* validate configuration only in certain places */

View File

@ -25,16 +25,16 @@
#include "domain_conf.h" #include "domain_conf.h"
#include "virconftypes.h" #include "virconftypes.h"
int virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm, int virDomainDeviceValidateAliasForHotplug(virDomainObj *vm,
virDomainDeviceDefPtr dev, virDomainDeviceDef *dev,
unsigned int flags); unsigned int flags);
int virDomainDefValidate(virDomainDefPtr def, int virDomainDefValidate(virDomainDef *def,
unsigned int parseFlags, unsigned int parseFlags,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque); void *parseOpaque);
int virDomainActualNetDefValidate(const virDomainNetDef *net); int virDomainActualNetDefValidate(const virDomainNetDef *net);
int virDomainDeviceDefValidate(const virDomainDeviceDef *dev, int virDomainDeviceDefValidate(const virDomainDeviceDef *dev,
const virDomainDef *def, const virDomainDef *def,
unsigned int parseFlags, unsigned int parseFlags,
virDomainXMLOptionPtr xmlopt, virDomainXMLOption *xmlopt,
void *parseOpaque); void *parseOpaque);

View File

@ -37,15 +37,15 @@ VIR_ENUM_IMPL(virInterface,
"ethernet", "bridge", "bond", "vlan", "ethernet", "bridge", "bond", "vlan",
); );
static virInterfaceDefPtr static virInterfaceDef *
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType); virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
static int static int
virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def, virInterfaceDefDevFormat(virBuffer *buf, const virInterfaceDef *def,
virInterfaceType parentIfType); virInterfaceType parentIfType);
static void static void
virInterfaceIPDefFree(virInterfaceIPDefPtr def) virInterfaceIPDefFree(virInterfaceIPDef *def)
{ {
if (def == NULL) if (def == NULL)
return; return;
@ -55,7 +55,7 @@ virInterfaceIPDefFree(virInterfaceIPDefPtr def)
static void static void
virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) virInterfaceProtocolDefFree(virInterfaceProtocolDef *def)
{ {
size_t i; size_t i;
@ -71,7 +71,7 @@ virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
void void
virInterfaceDefFree(virInterfaceDefPtr def) virInterfaceDefFree(virInterfaceDef *def)
{ {
size_t i; size_t i;
int pp; int pp;
@ -116,7 +116,7 @@ virInterfaceDefFree(virInterfaceDefPtr def)
static int static int
virInterfaceDefParseName(virInterfaceDefPtr def, virInterfaceDefParseName(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
char *tmp; char *tmp;
@ -133,7 +133,7 @@ virInterfaceDefParseName(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseMtu(virInterfaceDefPtr def, virInterfaceDefParseMtu(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
unsigned long mtu; unsigned long mtu;
@ -152,7 +152,7 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseStartMode(virInterfaceDefPtr def, virInterfaceDefParseStartMode(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
char *tmp; char *tmp;
@ -259,7 +259,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt)
static int static int
virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def, virInterfaceDefParseDhcp(virInterfaceProtocolDef *def,
xmlNodePtr dhcp, xmlXPathContextPtr ctxt) xmlNodePtr dhcp, xmlXPathContextPtr ctxt)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -288,7 +288,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
static int static int
virInterfaceDefParseIP(virInterfaceIPDefPtr def, virInterfaceDefParseIP(virInterfaceIPDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
int ret = 0; int ret = 0;
@ -313,7 +313,7 @@ virInterfaceDefParseIP(virInterfaceIPDefPtr def,
static int static int
virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, virInterfaceDefParseProtoIPv4(virInterfaceProtocolDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr dhcp; xmlNodePtr dhcp;
@ -337,12 +337,12 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
if (ipNodes == NULL) if (ipNodes == NULL)
return 0; return 0;
def->ips = g_new0(virInterfaceIPDefPtr, nipNodes); def->ips = g_new0(virInterfaceIPDef *, nipNodes);
def->nips = 0; def->nips = 0;
for (i = 0; i < nipNodes; i++) { for (i = 0; i < nipNodes; i++) {
virInterfaceIPDefPtr ip; virInterfaceIPDef *ip;
ip = g_new0(virInterfaceIPDef, 1); ip = g_new0(virInterfaceIPDef, 1);
@ -363,7 +363,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
static int static int
virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, virInterfaceDefParseProtoIPv6(virInterfaceProtocolDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr dhcp, autoconf; xmlNodePtr dhcp, autoconf;
@ -391,12 +391,12 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
if (ipNodes == NULL) if (ipNodes == NULL)
return 0; return 0;
def->ips = g_new0(virInterfaceIPDefPtr, nipNodes); def->ips = g_new0(virInterfaceIPDef *, nipNodes);
def->nips = 0; def->nips = 0;
for (i = 0; i < nipNodes; i++) { for (i = 0; i < nipNodes; i++) {
virInterfaceIPDefPtr ip; virInterfaceIPDef *ip;
ip = g_new0(virInterfaceIPDef, 1); ip = g_new0(virInterfaceIPDef, 1);
@ -417,7 +417,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
static int static int
virInterfaceDefParseIfAdressing(virInterfaceDefPtr def, virInterfaceDefParseIfAdressing(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -434,12 +434,12 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
return 0; return 0;
} }
def->protos = g_new0(virInterfaceProtocolDefPtr, nProtoNodes); def->protos = g_new0(virInterfaceProtocolDef *, nProtoNodes);
def->nprotos = 0; def->nprotos = 0;
for (pp = 0; pp < nProtoNodes; pp++) { for (pp = 0; pp < nProtoNodes; pp++) {
virInterfaceProtocolDefPtr proto; virInterfaceProtocolDef *proto;
proto = g_new0(virInterfaceProtocolDef, 1); proto = g_new0(virInterfaceProtocolDef, 1);
@ -483,12 +483,12 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseBridge(virInterfaceDefPtr def, virInterfaceDefParseBridge(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
xmlNodePtr bridge; xmlNodePtr bridge;
virInterfaceDefPtr itf; virInterfaceDef *itf;
char *tmp = NULL; char *tmp = NULL;
int nbItf; int nbItf;
size_t i; size_t i;
@ -540,12 +540,12 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseBondItfs(virInterfaceDefPtr def, virInterfaceDefParseBondItfs(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
virInterfaceDefPtr itf; virInterfaceDef *itf;
int nbItf; int nbItf;
size_t i; size_t i;
int ret = -1; int ret = -1;
@ -581,7 +581,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseBond(virInterfaceDefPtr def, virInterfaceDefParseBond(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
int res; int res;
@ -654,7 +654,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
static int static int
virInterfaceDefParseVlan(virInterfaceDefPtr def, virInterfaceDefParseVlan(virInterfaceDef *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
def->data.vlan.tag = virXPathString("string(./@tag)", ctxt); def->data.vlan.tag = virXPathString("string(./@tag)", ctxt);
@ -675,11 +675,11 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
} }
static virInterfaceDefPtr static virInterfaceDef *
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
int parentIfType) int parentIfType)
{ {
virInterfaceDefPtr def; virInterfaceDef *def;
int type; int type;
char *tmp; char *tmp;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -795,7 +795,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
} }
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseNode(xmlDocPtr xml, virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root) xmlNodePtr root)
{ {
@ -817,12 +817,12 @@ virInterfaceDefParseNode(xmlDocPtr xml,
} }
static virInterfaceDefPtr static virInterfaceDef *
virInterfaceDefParse(const char *xmlStr, virInterfaceDefParse(const char *xmlStr,
const char *filename) const char *filename)
{ {
xmlDocPtr xml; xmlDocPtr xml;
virInterfaceDefPtr def = NULL; virInterfaceDef *def = NULL;
if ((xml = virXMLParse(filename, xmlStr, _("(interface_definition)")))) { if ((xml = virXMLParse(filename, xmlStr, _("(interface_definition)")))) {
def = virInterfaceDefParseNode(xml, xmlDocGetRootElement(xml)); def = virInterfaceDefParseNode(xml, xmlDocGetRootElement(xml));
@ -833,14 +833,14 @@ virInterfaceDefParse(const char *xmlStr,
} }
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseString(const char *xmlStr) virInterfaceDefParseString(const char *xmlStr)
{ {
return virInterfaceDefParse(xmlStr, NULL); return virInterfaceDefParse(xmlStr, NULL);
} }
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseFile(const char *filename) virInterfaceDefParseFile(const char *filename)
{ {
return virInterfaceDefParse(NULL, filename); return virInterfaceDefParse(NULL, filename);
@ -848,7 +848,7 @@ virInterfaceDefParseFile(const char *filename)
static int static int
virInterfaceBridgeDefFormat(virBufferPtr buf, virInterfaceBridgeDefFormat(virBuffer *buf,
const virInterfaceDef *def) const virInterfaceDef *def)
{ {
size_t i; size_t i;
@ -877,7 +877,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
static int static int
virInterfaceBondDefFormat(virBufferPtr buf, virInterfaceBondDefFormat(virBuffer *buf,
const virInterfaceDef *def) const virInterfaceDef *def)
{ {
size_t i; size_t i;
@ -942,7 +942,7 @@ virInterfaceBondDefFormat(virBufferPtr buf,
static int static int
virInterfaceVlanDefFormat(virBufferPtr buf, virInterfaceVlanDefFormat(virBuffer *buf,
const virInterfaceDef *def) const virInterfaceDef *def)
{ {
if (def->data.vlan.tag == NULL) { if (def->data.vlan.tag == NULL) {
@ -967,7 +967,7 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
static int static int
virInterfaceProtocolDefFormat(virBufferPtr buf, virInterfaceProtocolDefFormat(virBuffer *buf,
const virInterfaceDef *def) const virInterfaceDef *def)
{ {
size_t i, j; size_t i, j;
@ -1014,7 +1014,7 @@ virInterfaceProtocolDefFormat(virBufferPtr buf,
static int static int
virInterfaceStartmodeDefFormat(virBufferPtr buf, virInterfaceStartmodeDefFormat(virBuffer *buf,
virInterfaceStartMode startmode) virInterfaceStartMode startmode)
{ {
const char *mode; const char *mode;
@ -1041,7 +1041,7 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf,
static int static int
virInterfaceDefDevFormat(virBufferPtr buf, virInterfaceDefDevFormat(virBuffer *buf,
const virInterfaceDef *def, const virInterfaceDef *def,
virInterfaceType parentIfType) virInterfaceType parentIfType)
{ {

View File

@ -84,7 +84,6 @@ typedef enum {
struct _virInterfaceDef; /* forward declaration required for bridge/bond */ struct _virInterfaceDef; /* forward declaration required for bridge/bond */
typedef struct _virInterfaceBridgeDef virInterfaceBridgeDef; typedef struct _virInterfaceBridgeDef virInterfaceBridgeDef;
typedef virInterfaceBridgeDef *virInterfaceBridgeDefPtr;
struct _virInterfaceBridgeDef { struct _virInterfaceBridgeDef {
int stp; /* 0, 1 or -1 if undefined */ int stp; /* 0, 1 or -1 if undefined */
char *delay; char *delay;
@ -93,7 +92,6 @@ struct _virInterfaceBridgeDef {
}; };
typedef struct _virInterfaceBondDef virInterfaceBondDef; typedef struct _virInterfaceBondDef virInterfaceBondDef;
typedef virInterfaceBondDef *virInterfaceBondDefPtr;
struct _virInterfaceBondDef { struct _virInterfaceBondDef {
int mode; /* virInterfaceBondMode */ int mode; /* virInterfaceBondMode */
int monit; /* virInterfaceBondMonit */ int monit; /* virInterfaceBondMonit */
@ -109,14 +107,12 @@ struct _virInterfaceBondDef {
}; };
typedef struct _virInterfaceVlanDef virInterfaceVlanDef; typedef struct _virInterfaceVlanDef virInterfaceVlanDef;
typedef virInterfaceVlanDef *virInterfaceVlanDefPtr;
struct _virInterfaceVlanDef { struct _virInterfaceVlanDef {
char *tag; /* TAG for vlan */ char *tag; /* TAG for vlan */
char *dev_name; /* device name for vlan */ char *dev_name; /* device name for vlan */
}; };
typedef struct _virInterfaceIPDef virInterfaceIPDef; typedef struct _virInterfaceIPDef virInterfaceIPDef;
typedef virInterfaceIPDef *virInterfaceIPDefPtr;
struct _virInterfaceIPDef { struct _virInterfaceIPDef {
char *address; /* ip address */ char *address; /* ip address */
int prefix; /* ip prefix */ int prefix; /* ip prefix */
@ -124,20 +120,18 @@ struct _virInterfaceIPDef {
typedef struct _virInterfaceProtocolDef virInterfaceProtocolDef; typedef struct _virInterfaceProtocolDef virInterfaceProtocolDef;
typedef virInterfaceProtocolDef *virInterfaceProtocolDefPtr;
struct _virInterfaceProtocolDef { struct _virInterfaceProtocolDef {
char *family; /* ipv4 or ipv6 */ char *family; /* ipv4 or ipv6 */
int dhcp; /* use dhcp */ int dhcp; /* use dhcp */
int peerdns; /* dhcp peerdns ? */ int peerdns; /* dhcp peerdns ? */
int autoconf; /* only useful if family is ipv6 */ int autoconf; /* only useful if family is ipv6 */
int nips; int nips;
virInterfaceIPDefPtr *ips; /* ptr to array of ips[nips] */ virInterfaceIPDef **ips; /* ptr to array of ips[nips] */
char *gateway; /* route gateway */ char *gateway; /* route gateway */
}; };
typedef struct _virInterfaceDef virInterfaceDef; typedef struct _virInterfaceDef virInterfaceDef;
typedef virInterfaceDef *virInterfaceDefPtr;
struct _virInterfaceDef { struct _virInterfaceDef {
int type; /* interface type */ int type; /* interface type */
char *name; /* interface name */ char *name; /* interface name */
@ -154,19 +148,19 @@ struct _virInterfaceDef {
} data; } data;
int nprotos; int nprotos;
virInterfaceProtocolDefPtr *protos; /* ptr to array of protos[nprotos] */ virInterfaceProtocolDef **protos; /* ptr to array of protos[nprotos] */
}; };
void void
virInterfaceDefFree(virInterfaceDefPtr def); virInterfaceDefFree(virInterfaceDef *def);
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseString(const char *xmlStr); virInterfaceDefParseString(const char *xmlStr);
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseFile(const char *filename); virInterfaceDefParseFile(const char *filename);
virInterfaceDefPtr virInterfaceDef *
virInterfaceDefParseNode(xmlDocPtr xml, virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root); xmlNodePtr root);

View File

@ -34,7 +34,7 @@
VIR_LOG_INIT("conf.moment_conf"); VIR_LOG_INIT("conf.moment_conf");
static virClassPtr virDomainMomentDefClass; static virClass *virDomainMomentDefClass;
static void virDomainMomentDefDispose(void *obj); static void virDomainMomentDefDispose(void *obj);
static int static int
@ -48,7 +48,7 @@ virDomainMomentOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virDomainMoment); VIR_ONCE_GLOBAL_INIT(virDomainMoment);
virClassPtr virClass *
virClassForDomainMomentDef(void) virClassForDomainMomentDef(void)
{ {
if (virDomainMomentInitialize() < 0) if (virDomainMomentInitialize() < 0)
@ -60,7 +60,7 @@ virClassForDomainMomentDef(void)
static void static void
virDomainMomentDefDispose(void *obj) virDomainMomentDefDispose(void *obj)
{ {
virDomainMomentDefPtr def = obj; virDomainMomentDef *def = obj;
g_free(def->name); g_free(def->name);
g_free(def->description); g_free(def->description);
@ -71,7 +71,7 @@ virDomainMomentDefDispose(void *obj)
/* Provide defaults for creation time and moment name after parsing XML */ /* Provide defaults for creation time and moment name after parsing XML */
int int
virDomainMomentDefPostParse(virDomainMomentDefPtr def) virDomainMomentDefPostParse(virDomainMomentDef *def)
{ {
def->creationTime = g_get_real_time() / (1000*1000); def->creationTime = g_get_real_time() / (1000*1000);

View File

@ -41,15 +41,15 @@ struct _virDomainMomentDef {
* guest and the inactive domain definition in case of * guest and the inactive domain definition in case of
* offline guest * offline guest
*/ */
virDomainDefPtr dom; virDomainDef *dom;
/* /*
* Store the inactive domain definition in case of online * Store the inactive domain definition in case of online
* guest and leave NULL in case of offline guest * guest and leave NULL in case of offline guest
*/ */
virDomainDefPtr inactiveDom; virDomainDef *inactiveDom;
}; };
virClassPtr virClassForDomainMomentDef(void); virClass *virClassForDomainMomentDef(void);
int virDomainMomentDefPostParse(virDomainMomentDefPtr def); int virDomainMomentDefPostParse(virDomainMomentDef *def);

View File

@ -26,7 +26,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE #define VIR_FROM_THIS VIR_FROM_NONE
static int static int
virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate) virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRate *rate)
{ {
g_autofree char *average = NULL; g_autofree char *average = NULL;
g_autofree char *peak = NULL; g_autofree char *peak = NULL;
@ -101,7 +101,7 @@ virNetDevBandwidthParseRate(xmlNodePtr node, virNetDevBandwidthRatePtr rate)
* Returns !NULL on success, NULL on error. * Returns !NULL on success, NULL on error.
*/ */
int int
virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, virNetDevBandwidthParse(virNetDevBandwidth **bandwidth,
unsigned int *class_id, unsigned int *class_id,
xmlNodePtr node, xmlNodePtr node,
bool allowFloor) bool allowFloor)
@ -199,8 +199,8 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
} }
static int static int
virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def, virNetDevBandwidthRateFormat(virNetDevBandwidthRate *def,
virBufferPtr buf, virBuffer *buf,
const char *elem_name) const char *elem_name)
{ {
if (!buf || !elem_name) if (!buf || !elem_name)
@ -242,7 +242,7 @@ virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def,
int int
virNetDevBandwidthFormat(const virNetDevBandwidth *def, virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id, unsigned int class_id,
virBufferPtr buf) virBuffer *buf)
{ {
if (!buf) if (!buf)
return -1; return -1;
@ -265,7 +265,7 @@ virNetDevBandwidthFormat(const virNetDevBandwidth *def,
} }
void void
virDomainClearNetBandwidth(virDomainDefPtr def) virDomainClearNetBandwidth(virDomainDef *def)
{ {
size_t i; size_t i;
virDomainNetType type; virDomainNetType type;

View File

@ -25,16 +25,16 @@
#include "domain_conf.h" #include "domain_conf.h"
#include "network_conf.h" #include "network_conf.h"
int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, int virNetDevBandwidthParse(virNetDevBandwidth **bandwidth,
unsigned int *class_id, unsigned int *class_id,
xmlNodePtr node, xmlNodePtr node,
bool allowFloor) bool allowFloor)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
int virNetDevBandwidthFormat(const virNetDevBandwidth *def, int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id, unsigned int class_id,
virBufferPtr buf); virBuffer *buf);
void virDomainClearNetBandwidth(virDomainDefPtr def) void virDomainClearNetBandwidth(virDomainDef *def)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool virNetDevSupportsBandwidth(virDomainNetType type); bool virNetDevSupportsBandwidth(virDomainNetType type);

View File

@ -30,7 +30,7 @@ VIR_ENUM_IMPL(virNativeVlanMode,
); );
int int
virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr def) virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlan *def)
{ {
int ret = -1; int ret = -1;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -135,7 +135,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
} }
int int
virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf) virNetDevVlanFormat(const virNetDevVlan *def, virBuffer *buf)
{ {
size_t i; size_t i;

View File

@ -23,5 +23,5 @@
#include "virbuffer.h" #include "virbuffer.h"
#include "virxml.h" #include "virxml.h"
int virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr def); int virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlan *def);
int virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf); int virNetDevVlanFormat(const virNetDevVlan *def, virBuffer *buf);

View File

@ -26,7 +26,7 @@
#define VIR_FROM_THIS VIR_FROM_NONE #define VIR_FROM_THIS VIR_FROM_NONE
virNetDevVPortProfilePtr virNetDevVPortProfile *
virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags) virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags)
{ {
char *virtPortType; char *virtPortType;
@ -36,7 +36,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags)
char *virtPortInstanceID = NULL; char *virtPortInstanceID = NULL;
char *virtPortProfileID = NULL; char *virtPortProfileID = NULL;
char *virtPortInterfaceID = NULL; char *virtPortInterfaceID = NULL;
virNetDevVPortProfilePtr virtPort = NULL; virNetDevVPortProfile *virtPort = NULL;
xmlNodePtr cur = node->children; xmlNodePtr cur = node->children;
virtPort = g_new0(virNetDevVPortProfile, 1); virtPort = g_new0(virNetDevVPortProfile, 1);
@ -197,7 +197,7 @@ virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags)
int int
virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort,
virBufferPtr buf) virBuffer *buf)
{ {
enum virNetDevVPortProfile type; enum virNetDevVPortProfile type;
bool noParameters; bool noParameters;

View File

@ -36,9 +36,9 @@ typedef enum {
VIR_VPORT_XML_REQUIRE_TYPE = (1<<2), VIR_VPORT_XML_REQUIRE_TYPE = (1<<2),
} virNetDevVPortXMLFlags; } virNetDevVPortXMLFlags;
virNetDevVPortProfilePtr virNetDevVPortProfile *
virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags); virNetDevVPortProfileParse(xmlNodePtr node, unsigned int flags);
int int
virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort, virNetDevVPortProfileFormat(const virNetDevVPortProfile *virtPort,
virBufferPtr buf); virBuffer *buf);

View File

@ -77,7 +77,7 @@ VIR_ENUM_IMPL(virNetworkDHCPLeaseTimeUnit,
"hours", "hours",
); );
static virClassPtr virNetworkXMLOptionClass; static virClass *virNetworkXMLOptionClass;
static void static void
virNetworkXMLOptionDispose(void *obj G_GNUC_UNUSED) virNetworkXMLOptionDispose(void *obj G_GNUC_UNUSED)
@ -96,10 +96,10 @@ virNetworkXMLOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virNetworkXML); VIR_ONCE_GLOBAL_INIT(virNetworkXML);
virNetworkXMLOptionPtr virNetworkXMLOption *
virNetworkXMLOptionNew(virXMLNamespacePtr xmlns) virNetworkXMLOptionNew(virXMLNamespace *xmlns)
{ {
virNetworkXMLOptionPtr xmlopt; virNetworkXMLOption *xmlopt;
if (virNetworkXMLInitialize() < 0) if (virNetworkXMLInitialize() < 0)
return NULL; return NULL;
@ -114,7 +114,7 @@ virNetworkXMLOptionNew(virXMLNamespacePtr xmlns)
} }
static void static void
virPortGroupDefClear(virPortGroupDefPtr def) virPortGroupDefClear(virPortGroupDef *def)
{ {
VIR_FREE(def->name); VIR_FREE(def->name);
VIR_FREE(def->virtPortProfile); VIR_FREE(def->virtPortProfile);
@ -125,7 +125,7 @@ virPortGroupDefClear(virPortGroupDefPtr def)
static void static void
virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def) virNetworkForwardIfDefClear(virNetworkForwardIfDef *def)
{ {
if (def->type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV) if (def->type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV)
VIR_FREE(def->device.dev); VIR_FREE(def->device.dev);
@ -133,21 +133,21 @@ virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
static void static void
virNetworkForwardPfDefClear(virNetworkForwardPfDefPtr def) virNetworkForwardPfDefClear(virNetworkForwardPfDef *def)
{ {
VIR_FREE(def->dev); VIR_FREE(def->dev);
} }
static void static void
virNetworkDHCPLeaseTimeDefClear(virNetworkDHCPLeaseTimeDefPtr lease) virNetworkDHCPLeaseTimeDefClear(virNetworkDHCPLeaseTimeDef *lease)
{ {
VIR_FREE(lease); VIR_FREE(lease);
} }
static void static void
virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def) virNetworkDHCPHostDefClear(virNetworkDHCPHostDef *def)
{ {
VIR_FREE(def->mac); VIR_FREE(def->mac);
VIR_FREE(def->id); VIR_FREE(def->id);
@ -157,7 +157,7 @@ virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def)
static void static void
virNetworkIPDefClear(virNetworkIPDefPtr def) virNetworkIPDefClear(virNetworkIPDef *def)
{ {
VIR_FREE(def->family); VIR_FREE(def->family);
@ -175,7 +175,7 @@ virNetworkIPDefClear(virNetworkIPDefPtr def)
static void static void
virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def) virNetworkDNSTxtDefClear(virNetworkDNSTxtDef *def)
{ {
VIR_FREE(def->name); VIR_FREE(def->name);
VIR_FREE(def->value); VIR_FREE(def->value);
@ -183,7 +183,7 @@ virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def)
static void static void
virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def) virNetworkDNSHostDefClear(virNetworkDNSHostDef *def)
{ {
while (def->nnames) while (def->nnames)
VIR_FREE(def->names[--def->nnames]); VIR_FREE(def->names[--def->nnames]);
@ -192,7 +192,7 @@ virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def)
static void static void
virNetworkDNSSrvDefClear(virNetworkDNSSrvDefPtr def) virNetworkDNSSrvDefClear(virNetworkDNSSrvDef *def)
{ {
VIR_FREE(def->domain); VIR_FREE(def->domain);
VIR_FREE(def->service); VIR_FREE(def->service);
@ -202,14 +202,14 @@ virNetworkDNSSrvDefClear(virNetworkDNSSrvDefPtr def)
static void static void
virNetworkDNSForwarderClear(virNetworkDNSForwarderPtr def) virNetworkDNSForwarderClear(virNetworkDNSForwarder *def)
{ {
VIR_FREE(def->domain); VIR_FREE(def->domain);
} }
static void static void
virNetworkDNSDefClear(virNetworkDNSDefPtr def) virNetworkDNSDefClear(virNetworkDNSDef *def)
{ {
if (def->forwarders) { if (def->forwarders) {
while (def->nfwds) while (def->nfwds)
@ -235,7 +235,7 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def)
static void static void
virNetworkForwardDefClear(virNetworkForwardDefPtr def) virNetworkForwardDefClear(virNetworkForwardDef *def)
{ {
size_t i; size_t i;
@ -251,7 +251,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def)
void void
virNetworkDefFree(virNetworkDefPtr def) virNetworkDefFree(virNetworkDef *def)
{ {
size_t i; size_t i;
@ -301,9 +301,9 @@ virNetworkDefFree(virNetworkDefPtr def)
* *
* Returns a new NetworkDef on success, or NULL on failure. * Returns a new NetworkDef on success, or NULL on failure.
*/ */
virNetworkDefPtr virNetworkDef *
virNetworkDefCopy(virNetworkDefPtr def, virNetworkDefCopy(virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt, virNetworkXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
g_autofree char *xml = NULL; g_autofree char *xml = NULL;
@ -323,7 +323,7 @@ virNetworkDefCopy(virNetworkDefPtr def,
/* return ips[index], or NULL if there aren't enough ips */ /* return ips[index], or NULL if there aren't enough ips */
virNetworkIPDefPtr virNetworkIPDef *
virNetworkDefGetIPByIndex(const virNetworkDef *def, virNetworkDefGetIPByIndex(const virNetworkDef *def,
int family, int family,
size_t n) size_t n)
@ -349,7 +349,7 @@ virNetworkDefGetIPByIndex(const virNetworkDef *def,
/* return routes[index], or NULL if there aren't enough routes */ /* return routes[index], or NULL if there aren't enough routes */
virNetDevIPRoutePtr virNetDevIPRoute *
virNetworkDefGetRouteByIndex(const virNetworkDef *def, virNetworkDefGetRouteByIndex(const virNetworkDef *def,
int family, int family,
size_t n) size_t n)
@ -364,7 +364,7 @@ virNetworkDefGetRouteByIndex(const virNetworkDef *def,
/* find the nth route of type "family" */ /* find the nth route of type "family" */
for (i = 0; i < def->nroutes; i++) { for (i = 0; i < def->nroutes; i++) {
virSocketAddrPtr addr = virNetDevIPRouteGetAddress(def->routes[i]); virSocketAddr *addr = virNetDevIPRouteGetAddress(def->routes[i]);
if (VIR_SOCKET_ADDR_IS_FAMILY(addr, family) if (VIR_SOCKET_ADDR_IS_FAMILY(addr, family)
&& (n-- <= 0)) { && (n-- <= 0)) {
return def->routes[i]; return def->routes[i];
@ -393,7 +393,7 @@ virNetworkIPDefPrefix(const virNetworkIPDef *def)
* prefix. Return -1 on error (and set the netmask family to AF_UNSPEC) * prefix. Return -1 on error (and set the netmask family to AF_UNSPEC)
*/ */
int virNetworkIPDefNetmask(const virNetworkIPDef *def, int virNetworkIPDefNetmask(const virNetworkIPDef *def,
virSocketAddrPtr netmask) virSocketAddr *netmask)
{ {
if (VIR_SOCKET_ADDR_IS_FAMILY(&def->netmask, AF_INET)) { if (VIR_SOCKET_ADDR_IS_FAMILY(&def->netmask, AF_INET)) {
*netmask = def->netmask; *netmask = def->netmask;
@ -406,10 +406,10 @@ int virNetworkIPDefNetmask(const virNetworkIPDef *def,
static int static int
virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDefPtr *lease, virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDef **lease,
xmlNodePtr node) xmlNodePtr node)
{ {
virNetworkDHCPLeaseTimeDefPtr new_lease = NULL; virNetworkDHCPLeaseTimeDef *new_lease = NULL;
g_autofree char *expirystr = NULL; g_autofree char *expirystr = NULL;
g_autofree char *unitstr = NULL; g_autofree char *unitstr = NULL;
unsigned long expiry; unsigned long expiry;
@ -457,11 +457,11 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDefPtr *lease,
static int static int
virNetworkDHCPRangeDefParseXML(const char *networkName, virNetworkDHCPRangeDefParseXML(const char *networkName,
virNetworkIPDefPtr ipdef, virNetworkIPDef *ipdef,
xmlNodePtr node, xmlNodePtr node,
virNetworkDHCPRangeDefPtr range) virNetworkDHCPRangeDef *range)
{ {
virSocketAddrRangePtr addr = &range->addr; virSocketAddrRange *addr = &range->addr;
xmlNodePtr cur = node->children; xmlNodePtr cur = node->children;
g_autofree char *start = NULL; g_autofree char *start = NULL;
g_autofree char *end = NULL; g_autofree char *end = NULL;
@ -505,9 +505,9 @@ virNetworkDHCPRangeDefParseXML(const char *networkName,
static int static int
virNetworkDHCPHostDefParseXML(const char *networkName, virNetworkDHCPHostDefParseXML(const char *networkName,
virNetworkIPDefPtr def, virNetworkIPDef *def,
xmlNodePtr node, xmlNodePtr node,
virNetworkDHCPHostDefPtr host, virNetworkDHCPHostDef *host,
bool partialOkay) bool partialOkay)
{ {
g_autofree char *mac = NULL; g_autofree char *mac = NULL;
@ -632,7 +632,7 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
static int static int
virNetworkDHCPDefParseXML(const char *networkName, virNetworkDHCPDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
virNetworkIPDefPtr def) virNetworkIPDef *def)
{ {
int ret = -1; int ret = -1;
xmlNodePtr cur; xmlNodePtr cur;
@ -696,7 +696,7 @@ virNetworkDHCPDefParseXML(const char *networkName,
static int static int
virNetworkDNSHostDefParseXML(const char *networkName, virNetworkDNSHostDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
virNetworkDNSHostDefPtr def, virNetworkDNSHostDef *def,
bool partialOkay) bool partialOkay)
{ {
xmlNodePtr cur; xmlNodePtr cur;
@ -779,7 +779,7 @@ static int
virNetworkDNSSrvDefParseXML(const char *networkName, virNetworkDNSSrvDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkDNSSrvDefPtr def, virNetworkDNSSrvDef *def,
bool partialOkay) bool partialOkay)
{ {
int ret; int ret;
@ -889,7 +889,7 @@ virNetworkDNSSrvDefParseXML(const char *networkName,
static int static int
virNetworkDNSTxtDefParseXML(const char *networkName, virNetworkDNSTxtDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
virNetworkDNSTxtDefPtr def, virNetworkDNSTxtDef *def,
bool partialOkay) bool partialOkay)
{ {
const char *bad = " ,"; const char *bad = " ,";
@ -931,7 +931,7 @@ static int
virNetworkDNSDefParseXML(const char *networkName, virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkDNSDefPtr def) virNetworkDNSDef *def)
{ {
g_autofree xmlNodePtr *hostNodes = NULL; g_autofree xmlNodePtr *hostNodes = NULL;
g_autofree xmlNodePtr *srvNodes = NULL; g_autofree xmlNodePtr *srvNodes = NULL;
@ -1074,7 +1074,7 @@ static int
virNetworkIPDefParseXML(const char *networkName, virNetworkIPDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkIPDefPtr def) virNetworkIPDef *def)
{ {
/* /*
* virNetworkIPDef object is already allocated as part of an array. * virNetworkIPDef object is already allocated as part of an array.
@ -1243,7 +1243,7 @@ virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt,
static int static int
virNetworkPortGroupParseXML(virPortGroupDefPtr def, virNetworkPortGroupParseXML(virPortGroupDef *def,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
@ -1314,7 +1314,7 @@ static int
virNetworkForwardNatDefParseXML(const char *networkName, virNetworkForwardNatDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkForwardDefPtr def) virNetworkForwardDef *def)
{ {
int nNatAddrs, nNatPorts; int nNatAddrs, nNatPorts;
g_autofree xmlNodePtr *natAddrNodes = NULL; g_autofree xmlNodePtr *natAddrNodes = NULL;
@ -1448,7 +1448,7 @@ static int
virNetworkForwardDefParseXML(const char *networkName, virNetworkForwardDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkForwardDefPtr def) virNetworkForwardDef *def)
{ {
size_t i, j; size_t i, j;
int nForwardIfs, nForwardAddrs, nForwardPfs, nForwardNats; int nForwardIfs, nForwardAddrs, nForwardPfs, nForwardNats;
@ -1621,7 +1621,7 @@ virNetworkForwardDefParseXML(const char *networkName,
switch (def->ifs[i].type) { switch (def->ifs[i].type) {
case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI: case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI:
{ {
virPCIDeviceAddressPtr addr = &def->ifs[i].device.pci; virPCIDeviceAddress *addr = &def->ifs[i].device.pci;
if (virPCIDeviceAddressParseXML(forwardAddrNodes[i], addr) < 0) if (virPCIDeviceAddressParseXML(forwardAddrNodes[i], addr) < 0)
return -1; return -1;
@ -1675,9 +1675,9 @@ virNetworkForwardDefParseXML(const char *networkName,
} }
virNetworkDefPtr virNetworkDef *
virNetworkDefParseXML(xmlXPathContextPtr ctxt, virNetworkDefParseXML(xmlXPathContextPtr ctxt,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
g_autoptr(virNetworkDef) def = NULL; g_autoptr(virNetworkDef) def = NULL;
g_autofree char *uuid = NULL; g_autofree char *uuid = NULL;
@ -1895,10 +1895,10 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
size_t i; size_t i;
/* allocate array to hold all the route definitions */ /* allocate array to hold all the route definitions */
def->routes = g_new0(virNetDevIPRoutePtr, nRoutes); def->routes = g_new0(virNetDevIPRoute *, nRoutes);
/* parse each definition */ /* parse each definition */
for (i = 0; i < nRoutes; i++) { for (i = 0; i < nRoutes; i++) {
virNetDevIPRoutePtr route = NULL; virNetDevIPRoute *route = NULL;
if (!(route = virNetDevIPRouteParseXML(def->name, if (!(route = virNetDevIPRouteParseXML(def->name,
routeNodes[i], routeNodes[i],
@ -1920,11 +1920,11 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
size_t j; size_t j;
virSocketAddr testAddr, testGw; virSocketAddr testAddr, testGw;
bool addrMatch; bool addrMatch;
virNetDevIPRoutePtr gwdef = def->routes[i]; virNetDevIPRoute *gwdef = def->routes[i];
virSocketAddrPtr gateway = virNetDevIPRouteGetGateway(gwdef); virSocketAddr *gateway = virNetDevIPRouteGetGateway(gwdef);
addrMatch = false; addrMatch = false;
for (j = 0; j < nips; j++) { for (j = 0; j < nips; j++) {
virNetworkIPDefPtr def2 = &def->ips[j]; virNetworkIPDef *def2 = &def->ips[j];
int prefix; int prefix;
if (VIR_SOCKET_ADDR_FAMILY(gateway) if (VIR_SOCKET_ADDR_FAMILY(gateway)
@ -2101,13 +2101,13 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt,
} }
static virNetworkDefPtr static virNetworkDef *
virNetworkDefParse(const char *xmlStr, virNetworkDefParse(const char *xmlStr,
const char *filename, const char *filename,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
g_autoptr(xmlDoc) xml = NULL; g_autoptr(xmlDoc) xml = NULL;
virNetworkDefPtr def = NULL; virNetworkDef *def = NULL;
int keepBlanksDefault = xmlKeepBlanksDefault(0); int keepBlanksDefault = xmlKeepBlanksDefault(0);
if ((xml = virXMLParse(filename, xmlStr, _("(network_definition)")))) if ((xml = virXMLParse(filename, xmlStr, _("(network_definition)"))))
@ -2118,26 +2118,26 @@ virNetworkDefParse(const char *xmlStr,
} }
virNetworkDefPtr virNetworkDef *
virNetworkDefParseString(const char *xmlStr, virNetworkDefParseString(const char *xmlStr,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
return virNetworkDefParse(xmlStr, NULL, xmlopt); return virNetworkDefParse(xmlStr, NULL, xmlopt);
} }
virNetworkDefPtr virNetworkDef *
virNetworkDefParseFile(const char *filename, virNetworkDefParseFile(const char *filename,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
return virNetworkDefParse(NULL, filename, xmlopt); return virNetworkDefParse(NULL, filename, xmlopt);
} }
virNetworkDefPtr virNetworkDef *
virNetworkDefParseNode(xmlDocPtr xml, virNetworkDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
g_autoptr(xmlXPathContext) ctxt = NULL; g_autoptr(xmlXPathContext) ctxt = NULL;
@ -2158,7 +2158,7 @@ virNetworkDefParseNode(xmlDocPtr xml,
static int static int
virNetworkDNSDefFormat(virBufferPtr buf, virNetworkDNSDefFormat(virBuffer *buf,
const virNetworkDNSDef *def) const virNetworkDNSDef *def)
{ {
size_t i, j; size_t i, j;
@ -2263,7 +2263,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
static int static int
virNetworkIPDefFormat(virBufferPtr buf, virNetworkIPDefFormat(virBuffer *buf,
const virNetworkIPDef *def) const virNetworkIPDef *def)
{ {
virBufferAddLit(buf, "<ip"); virBufferAddLit(buf, "<ip");
@ -2304,7 +2304,7 @@ virNetworkIPDefFormat(virBufferPtr buf,
for (i = 0; i < def->nranges; i++) { for (i = 0; i < def->nranges; i++) {
virSocketAddrRange addr = def->ranges[i].addr; virSocketAddrRange addr = def->ranges[i].addr;
virNetworkDHCPLeaseTimeDefPtr lease = def->ranges[i].lease; virNetworkDHCPLeaseTimeDef *lease = def->ranges[i].lease;
g_autofree char *saddr = NULL; g_autofree char *saddr = NULL;
g_autofree char *eaddr = NULL; g_autofree char *eaddr = NULL;
@ -2333,7 +2333,7 @@ virNetworkIPDefFormat(virBufferPtr buf,
} }
} }
for (i = 0; i < def->nhosts; i++) { for (i = 0; i < def->nhosts; i++) {
virNetworkDHCPLeaseTimeDefPtr lease = def->hosts[i].lease; virNetworkDHCPLeaseTimeDef *lease = def->hosts[i].lease;
virBufferAddLit(buf, "<host"); virBufferAddLit(buf, "<host");
if (def->hosts[i].mac) if (def->hosts[i].mac)
virBufferAsprintf(buf, " mac='%s'", def->hosts[i].mac); virBufferAsprintf(buf, " mac='%s'", def->hosts[i].mac);
@ -2389,7 +2389,7 @@ virNetworkIPDefFormat(virBufferPtr buf,
void void
virNetworkPortOptionsFormat(virTristateBool isolatedPort, virNetworkPortOptionsFormat(virTristateBool isolatedPort,
virBufferPtr buf) virBuffer *buf)
{ {
if (isolatedPort != VIR_TRISTATE_BOOL_ABSENT) if (isolatedPort != VIR_TRISTATE_BOOL_ABSENT)
virBufferAsprintf(buf, "<port isolated='%s'/>\n", virBufferAsprintf(buf, "<port isolated='%s'/>\n",
@ -2397,7 +2397,7 @@ virNetworkPortOptionsFormat(virTristateBool isolatedPort,
} }
static int static int
virPortGroupDefFormat(virBufferPtr buf, virPortGroupDefFormat(virBuffer *buf,
const virPortGroupDef *def) const virPortGroupDef *def)
{ {
virBufferAsprintf(buf, "<portgroup name='%s'", def->name); virBufferAsprintf(buf, "<portgroup name='%s'", def->name);
@ -2420,7 +2420,7 @@ virPortGroupDefFormat(virBufferPtr buf,
static int static int
virNetworkForwardNatDefFormat(virBufferPtr buf, virNetworkForwardNatDefFormat(virBuffer *buf,
const virNetworkForwardDef *fwd) const virNetworkForwardDef *fwd)
{ {
g_autofree char *addrStart = NULL; g_autofree char *addrStart = NULL;
@ -2473,9 +2473,9 @@ virNetworkForwardNatDefFormat(virBufferPtr buf,
int int
virNetworkDefFormatBuf(virBufferPtr buf, virNetworkDefFormatBuf(virBuffer *buf,
const virNetworkDef *def, const virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt G_GNUC_UNUSED, virNetworkXMLOption *xmlopt G_GNUC_UNUSED,
unsigned int flags) unsigned int flags)
{ {
const unsigned char *uuid; const unsigned char *uuid;
@ -2708,7 +2708,7 @@ virNetworkDefFormatBuf(virBufferPtr buf,
char * char *
virNetworkDefFormat(const virNetworkDef *def, virNetworkDefFormat(const virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt, virNetworkXMLOption *xmlopt,
unsigned int flags) unsigned int flags)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@ -2730,8 +2730,8 @@ virNetworkDefForwardIf(const virNetworkDef *def,
} }
virPortGroupDefPtr virPortGroupDef *
virPortGroupFindByName(virNetworkDefPtr net, virPortGroupFindByName(virNetworkDef *net,
const char *portgroup) const char *portgroup)
{ {
size_t i; size_t i;
@ -2750,7 +2750,7 @@ virPortGroupFindByName(virNetworkDefPtr net,
int int
virNetworkSaveXML(const char *configDir, virNetworkSaveXML(const char *configDir,
virNetworkDefPtr def, virNetworkDef *def,
const char *xml) const char *xml)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -2775,8 +2775,8 @@ virNetworkSaveXML(const char *configDir,
int int
virNetworkSaveConfig(const char *configDir, virNetworkSaveConfig(const char *configDir,
virNetworkDefPtr def, virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt) virNetworkXMLOption *xmlopt)
{ {
g_autofree char *xml = NULL; g_autofree char *xml = NULL;
@ -2799,7 +2799,7 @@ virNetworkConfigFile(const char *dir,
void void
virNetworkSetBridgeMacAddr(virNetworkDefPtr def) virNetworkSetBridgeMacAddr(virNetworkDef *def)
{ {
if (!def->mac_specified) { if (!def->mac_specified) {
/* if the bridge doesn't have a mac address explicitly defined, /* if the bridge doesn't have a mac address explicitly defined,
@ -2815,7 +2815,7 @@ virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
/* NetworkObj backend of the virNetworkUpdate API */ /* NetworkObj backend of the virNetworkUpdate API */
static void static void
virNetworkDefUpdateNoSupport(virNetworkDefPtr def, const char *section) virNetworkDefUpdateNoSupport(virNetworkDef *def, const char *section)
{ {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("can't update '%s' section of network '%s'"), _("can't update '%s' section of network '%s'"),
@ -2832,7 +2832,7 @@ virNetworkDefUpdateUnknownCommand(unsigned int command)
static int static int
virNetworkDefUpdateCheckElementName(virNetworkDefPtr def, virNetworkDefUpdateCheckElementName(virNetworkDef *def,
xmlNodePtr node, xmlNodePtr node,
const char *section) const char *section)
{ {
@ -2848,7 +2848,7 @@ virNetworkDefUpdateCheckElementName(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateBridge(virNetworkDefPtr def, virNetworkDefUpdateBridge(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -2861,7 +2861,7 @@ virNetworkDefUpdateBridge(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateDomain(virNetworkDefPtr def, virNetworkDefUpdateDomain(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -2874,7 +2874,7 @@ virNetworkDefUpdateDomain(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateIP(virNetworkDefPtr def, virNetworkDefUpdateIP(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -2886,10 +2886,10 @@ virNetworkDefUpdateIP(virNetworkDefPtr def,
} }
static virNetworkIPDefPtr static virNetworkIPDef *
virNetworkIPDefByIndex(virNetworkDefPtr def, int parentIndex) virNetworkIPDefByIndex(virNetworkDef *def, int parentIndex)
{ {
virNetworkIPDefPtr ipdef = NULL; virNetworkIPDef *ipdef = NULL;
size_t i; size_t i;
/* first find which ip element's dhcp host list to work on */ /* first find which ip element's dhcp host list to work on */
@ -2928,12 +2928,12 @@ virNetworkIPDefByIndex(virNetworkDefPtr def, int parentIndex)
static int static int
virNetworkDefUpdateCheckMultiDHCP(virNetworkDefPtr def, virNetworkDefUpdateCheckMultiDHCP(virNetworkDef *def,
virNetworkIPDefPtr ipdef) virNetworkIPDef *ipdef)
{ {
int family = VIR_SOCKET_ADDR_FAMILY(&ipdef->address); int family = VIR_SOCKET_ADDR_FAMILY(&ipdef->address);
size_t i; size_t i;
virNetworkIPDefPtr ip; virNetworkIPDef *ip;
for (i = 0; (ip = virNetworkDefGetIPByIndex(def, family, i)); i++) { for (i = 0; (ip = virNetworkDefGetIPByIndex(def, family, i)); i++) {
if (ip != ipdef) { if (ip != ipdef) {
@ -2951,7 +2951,7 @@ virNetworkDefUpdateCheckMultiDHCP(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, virNetworkDefUpdateIPDHCPHost(virNetworkDef *def,
unsigned int command, unsigned int command,
int parentIndex, int parentIndex,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -2960,7 +2960,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
{ {
size_t i; size_t i;
int ret = -1; int ret = -1;
virNetworkIPDefPtr ipdef = virNetworkIPDefByIndex(def, parentIndex); virNetworkIPDef *ipdef = virNetworkIPDefByIndex(def, parentIndex);
virNetworkDHCPHostDef host; virNetworkDHCPHostDef host;
bool partialOkay = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE); bool partialOkay = (command == VIR_NETWORK_UPDATE_COMMAND_DELETE);
@ -3089,7 +3089,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, virNetworkDefUpdateIPDHCPRange(virNetworkDef *def,
unsigned int command, unsigned int command,
int parentIndex, int parentIndex,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -3097,7 +3097,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
unsigned int fflags G_GNUC_UNUSED) unsigned int fflags G_GNUC_UNUSED)
{ {
size_t i; size_t i;
virNetworkIPDefPtr ipdef = virNetworkIPDefByIndex(def, parentIndex); virNetworkIPDef *ipdef = virNetworkIPDefByIndex(def, parentIndex);
virNetworkDHCPRangeDef range; virNetworkDHCPRangeDef range;
memset(&range, 0, sizeof(range)); memset(&range, 0, sizeof(range));
@ -3187,7 +3187,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateForward(virNetworkDefPtr def, virNetworkDefUpdateForward(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -3200,7 +3200,7 @@ virNetworkDefUpdateForward(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, virNetworkDefUpdateForwardInterface(virNetworkDef *def,
unsigned int command, unsigned int command,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -3295,7 +3295,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateForwardPF(virNetworkDefPtr def, virNetworkDefUpdateForwardPF(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -3308,7 +3308,7 @@ virNetworkDefUpdateForwardPF(virNetworkDefPtr def,
static int static int
virNetworkDefUpdatePortGroup(virNetworkDefPtr def, virNetworkDefUpdatePortGroup(virNetworkDef *def,
unsigned int command, unsigned int command,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -3403,7 +3403,7 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateDNSHost(virNetworkDefPtr def, virNetworkDefUpdateDNSHost(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -3412,7 +3412,7 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
{ {
size_t i, j, k; size_t i, j, k;
int foundIdx = -1, ret = -1; int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns; virNetworkDNSDef *dns = &def->dns;
virNetworkDNSHostDef host; virNetworkDNSHostDef host;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST || bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST); command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
@ -3498,7 +3498,7 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateDNSSrv(virNetworkDefPtr def, virNetworkDefUpdateDNSSrv(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -3507,7 +3507,7 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
{ {
size_t i; size_t i;
int foundIdx = -1, ret = -1; int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns; virNetworkDNSDef *dns = &def->dns;
virNetworkDNSSrvDef srv; virNetworkDNSSrvDef srv;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST || bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST); command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
@ -3585,7 +3585,7 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
static int static int
virNetworkDefUpdateDNSTxt(virNetworkDefPtr def, virNetworkDefUpdateDNSTxt(virNetworkDef *def,
unsigned int command G_GNUC_UNUSED, unsigned int command G_GNUC_UNUSED,
int parentIndex G_GNUC_UNUSED, int parentIndex G_GNUC_UNUSED,
xmlXPathContextPtr ctxt G_GNUC_UNUSED, xmlXPathContextPtr ctxt G_GNUC_UNUSED,
@ -3593,7 +3593,7 @@ virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
unsigned int fflags G_GNUC_UNUSED) unsigned int fflags G_GNUC_UNUSED)
{ {
int foundIdx, ret = -1; int foundIdx, ret = -1;
virNetworkDNSDefPtr dns = &def->dns; virNetworkDNSDef *dns = &def->dns;
virNetworkDNSTxtDef txt; virNetworkDNSTxtDef txt;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST || bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST); command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST);
@ -3659,7 +3659,7 @@ virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
int int
virNetworkDefUpdateSection(virNetworkDefPtr def, virNetworkDefUpdateSection(virNetworkDef *def,
unsigned int command, /* virNetworkUpdateCommand */ unsigned int command, /* virNetworkUpdateCommand */
unsigned int section, /* virNetworkUpdateSection */ unsigned int section, /* virNetworkUpdateSection */
int parentIndex, int parentIndex,

View File

@ -44,7 +44,6 @@ struct _virNetworkXMLOption {
virXMLNamespace ns; virXMLNamespace ns;
}; };
typedef struct _virNetworkXMLOption virNetworkXMLOption; typedef struct _virNetworkXMLOption virNetworkXMLOption;
typedef virNetworkXMLOption *virNetworkXMLOptionPtr;
typedef enum { typedef enum {
@ -105,38 +104,33 @@ typedef enum {
VIR_ENUM_DECL(virNetworkForwardDriverName); VIR_ENUM_DECL(virNetworkForwardDriverName);
typedef struct _virNetworkDHCPLeaseTimeDef virNetworkDHCPLeaseTimeDef; typedef struct _virNetworkDHCPLeaseTimeDef virNetworkDHCPLeaseTimeDef;
typedef virNetworkDHCPLeaseTimeDef *virNetworkDHCPLeaseTimeDefPtr;
struct _virNetworkDHCPLeaseTimeDef { struct _virNetworkDHCPLeaseTimeDef {
unsigned long expiry; unsigned long expiry;
virNetworkDHCPLeaseTimeUnitType unit; virNetworkDHCPLeaseTimeUnitType unit;
}; };
typedef struct _virNetworkDHCPRangeDef virNetworkDHCPRangeDef; typedef struct _virNetworkDHCPRangeDef virNetworkDHCPRangeDef;
typedef virNetworkDHCPRangeDef *virNetworkDHCPRangeDefPtr;
struct _virNetworkDHCPRangeDef { struct _virNetworkDHCPRangeDef {
virSocketAddrRange addr; virSocketAddrRange addr;
virNetworkDHCPLeaseTimeDefPtr lease; virNetworkDHCPLeaseTimeDef *lease;
}; };
typedef struct _virNetworkDHCPHostDef virNetworkDHCPHostDef; typedef struct _virNetworkDHCPHostDef virNetworkDHCPHostDef;
typedef virNetworkDHCPHostDef *virNetworkDHCPHostDefPtr;
struct _virNetworkDHCPHostDef { struct _virNetworkDHCPHostDef {
char *mac; char *mac;
char *id; char *id;
char *name; char *name;
virSocketAddr ip; virSocketAddr ip;
virNetworkDHCPLeaseTimeDefPtr lease; virNetworkDHCPLeaseTimeDef *lease;
}; };
typedef struct _virNetworkDNSTxtDef virNetworkDNSTxtDef; typedef struct _virNetworkDNSTxtDef virNetworkDNSTxtDef;
typedef virNetworkDNSTxtDef *virNetworkDNSTxtDefPtr;
struct _virNetworkDNSTxtDef { struct _virNetworkDNSTxtDef {
char *name; char *name;
char *value; char *value;
}; };
typedef struct _virNetworkDNSSrvDef virNetworkDNSSrvDef; typedef struct _virNetworkDNSSrvDef virNetworkDNSSrvDef;
typedef virNetworkDNSSrvDef *virNetworkDNSSrvDefPtr;
struct _virNetworkDNSSrvDef { struct _virNetworkDNSSrvDef {
char *domain; char *domain;
char *service; char *service;
@ -148,7 +142,6 @@ struct _virNetworkDNSSrvDef {
}; };
typedef struct _virNetworkDNSHostDef virNetworkDNSHostDef; typedef struct _virNetworkDNSHostDef virNetworkDNSHostDef;
typedef virNetworkDNSHostDef *virNetworkDNSHostDefPtr;
struct _virNetworkDNSHostDef { struct _virNetworkDNSHostDef {
virSocketAddr ip; virSocketAddr ip;
size_t nnames; size_t nnames;
@ -157,29 +150,26 @@ struct _virNetworkDNSHostDef {
typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder; typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
typedef virNetworkDNSForwarder *virNetworkDNSForwarderPtr;
struct _virNetworkDNSForwarder { struct _virNetworkDNSForwarder {
virSocketAddr addr; virSocketAddr addr;
char *domain; char *domain;
}; };
typedef struct _virNetworkDNSDef virNetworkDNSDef; typedef struct _virNetworkDNSDef virNetworkDNSDef;
typedef virNetworkDNSDef *virNetworkDNSDefPtr;
struct _virNetworkDNSDef { struct _virNetworkDNSDef {
int enable; /* enum virTristateBool */ int enable; /* enum virTristateBool */
int forwardPlainNames; /* enum virTristateBool */ int forwardPlainNames; /* enum virTristateBool */
size_t ntxts; size_t ntxts;
virNetworkDNSTxtDefPtr txts; virNetworkDNSTxtDef *txts;
size_t nhosts; size_t nhosts;
virNetworkDNSHostDefPtr hosts; virNetworkDNSHostDef *hosts;
size_t nsrvs; size_t nsrvs;
virNetworkDNSSrvDefPtr srvs; virNetworkDNSSrvDef *srvs;
size_t nfwds; size_t nfwds;
virNetworkDNSForwarderPtr forwarders; virNetworkDNSForwarder *forwarders;
}; };
typedef struct _virNetworkIPDef virNetworkIPDef; typedef struct _virNetworkIPDef virNetworkIPDef;
typedef virNetworkIPDef *virNetworkIPDefPtr;
struct _virNetworkIPDef { struct _virNetworkIPDef {
char *family; /* ipv4 or ipv6 - default is ipv4 */ char *family; /* ipv4 or ipv6 - default is ipv4 */
virSocketAddr address; /* Bridge IP address */ virSocketAddr address; /* Bridge IP address */
@ -196,10 +186,10 @@ struct _virNetworkIPDef {
int localPTR; /* virTristateBool */ int localPTR; /* virTristateBool */
size_t nranges; /* Zero or more dhcp ranges */ size_t nranges; /* Zero or more dhcp ranges */
virNetworkDHCPRangeDefPtr ranges; virNetworkDHCPRangeDef *ranges;
size_t nhosts; /* Zero or more dhcp hosts */ size_t nhosts; /* Zero or more dhcp hosts */
virNetworkDHCPHostDefPtr hosts; virNetworkDHCPHostDef *hosts;
char *tftproot; char *tftproot;
char *bootfile; char *bootfile;
@ -207,7 +197,6 @@ struct _virNetworkIPDef {
}; };
typedef struct _virNetworkForwardIfDef virNetworkForwardIfDef; typedef struct _virNetworkForwardIfDef virNetworkForwardIfDef;
typedef virNetworkForwardIfDef *virNetworkForwardIfDefPtr;
struct _virNetworkForwardIfDef { struct _virNetworkForwardIfDef {
int type; int type;
union { union {
@ -219,14 +208,12 @@ struct _virNetworkForwardIfDef {
}; };
typedef struct _virNetworkForwardPfDef virNetworkForwardPfDef; typedef struct _virNetworkForwardPfDef virNetworkForwardPfDef;
typedef virNetworkForwardPfDef *virNetworkForwardPfDefPtr;
struct _virNetworkForwardPfDef { struct _virNetworkForwardPfDef {
char *dev; /* name of device */ char *dev; /* name of device */
int connections; /* how many guest interfaces are connected to this device? */ int connections; /* how many guest interfaces are connected to this device? */
}; };
typedef struct _virNetworkForwardDef virNetworkForwardDef; typedef struct _virNetworkForwardDef virNetworkForwardDef;
typedef virNetworkForwardDef *virNetworkForwardDefPtr;
struct _virNetworkForwardDef { struct _virNetworkForwardDef {
int type; /* One of virNetworkForwardType constants */ int type; /* One of virNetworkForwardType constants */
bool managed; /* managed attribute for hostdev mode */ bool managed; /* managed attribute for hostdev mode */
@ -236,10 +223,10 @@ struct _virNetworkForwardDef {
* interfaces), they will be listed here. * interfaces), they will be listed here.
*/ */
size_t npfs; size_t npfs;
virNetworkForwardPfDefPtr pfs; virNetworkForwardPfDef *pfs;
size_t nifs; size_t nifs;
virNetworkForwardIfDefPtr ifs; virNetworkForwardIfDef *ifs;
/* ranges for NAT */ /* ranges for NAT */
virSocketAddrRange addr; virSocketAddrRange addr;
@ -249,18 +236,16 @@ struct _virNetworkForwardDef {
}; };
typedef struct _virPortGroupDef virPortGroupDef; typedef struct _virPortGroupDef virPortGroupDef;
typedef virPortGroupDef *virPortGroupDefPtr;
struct _virPortGroupDef { struct _virPortGroupDef {
char *name; char *name;
bool isDefault; bool isDefault;
virNetDevVPortProfilePtr virtPortProfile; virNetDevVPortProfile *virtPortProfile;
virNetDevBandwidthPtr bandwidth; virNetDevBandwidth *bandwidth;
virNetDevVlan vlan; virNetDevVlan vlan;
int trustGuestRxFilters; /* enum virTristateBool */ int trustGuestRxFilters; /* enum virTristateBool */
}; };
typedef struct _virNetworkDef virNetworkDef; typedef struct _virNetworkDef virNetworkDef;
typedef virNetworkDef *virNetworkDefPtr;
struct _virNetworkDef { struct _virNetworkDef {
unsigned char uuid[VIR_UUID_BUFLEN]; unsigned char uuid[VIR_UUID_BUFLEN];
bool uuid_specified; bool uuid_specified;
@ -286,17 +271,17 @@ struct _virNetworkDef {
virNetworkForwardDef forward; virNetworkForwardDef forward;
size_t nips; size_t nips;
virNetworkIPDefPtr ips; /* ptr to array of IP addresses on this network */ virNetworkIPDef *ips; /* ptr to array of IP addresses on this network */
size_t nroutes; size_t nroutes;
virNetDevIPRoutePtr *routes; /* ptr to array of static routes on this interface */ virNetDevIPRoute **routes; /* ptr to array of static routes on this interface */
virNetworkDNSDef dns; /* dns related configuration */ virNetworkDNSDef dns; /* dns related configuration */
virNetDevVPortProfilePtr virtPortProfile; virNetDevVPortProfile *virtPortProfile;
size_t nPortGroups; size_t nPortGroups;
virPortGroupDefPtr portGroups; virPortGroupDef *portGroups;
virNetDevBandwidthPtr bandwidth; virNetDevBandwidth *bandwidth;
virNetDevVlan vlan; virNetDevVlan vlan;
int trustGuestRxFilters; /* enum virTristateBool */ int trustGuestRxFilters; /* enum virTristateBool */
virTristateBool isolatedPort; virTristateBool isolatedPort;
@ -320,7 +305,7 @@ typedef enum {
VIR_NETWORK_TAINT_LAST VIR_NETWORK_TAINT_LAST
} virNetworkTaintFlags; } virNetworkTaintFlags;
void virNetworkDefFree(virNetworkDefPtr def); void virNetworkDefFree(virNetworkDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkDef, virNetworkDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkDef, virNetworkDefFree);
enum { enum {
@ -328,56 +313,56 @@ enum {
VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1), VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1),
}; };
virNetworkXMLOptionPtr virNetworkXMLOption *
virNetworkXMLOptionNew(virXMLNamespacePtr xmlns); virNetworkXMLOptionNew(virXMLNamespace *xmlns);
virNetworkDefPtr virNetworkDef *
virNetworkDefCopy(virNetworkDefPtr def, virNetworkDefCopy(virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt, virNetworkXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
virNetworkDefPtr virNetworkDef *
virNetworkDefParseXML(xmlXPathContextPtr ctxt, virNetworkDefParseXML(xmlXPathContextPtr ctxt,
virNetworkXMLOptionPtr xmlopt); virNetworkXMLOption *xmlopt);
virNetworkDefPtr virNetworkDef *
virNetworkDefParseString(const char *xmlStr, virNetworkDefParseString(const char *xmlStr,
virNetworkXMLOptionPtr xmlopt); virNetworkXMLOption *xmlopt);
virNetworkDefPtr virNetworkDef *
virNetworkDefParseFile(const char *filename, virNetworkDefParseFile(const char *filename,
virNetworkXMLOptionPtr xmlopt); virNetworkXMLOption *xmlopt);
virNetworkDefPtr virNetworkDef *
virNetworkDefParseNode(xmlDocPtr xml, virNetworkDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
virNetworkXMLOptionPtr xmlopt); virNetworkXMLOption *xmlopt);
char * char *
virNetworkDefFormat(const virNetworkDef *def, virNetworkDefFormat(const virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt, virNetworkXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
int int
virNetworkDefFormatBuf(virBufferPtr buf, virNetworkDefFormatBuf(virBuffer *buf,
const virNetworkDef *def, const virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt, virNetworkXMLOption *xmlopt,
unsigned int flags); unsigned int flags);
const char * const char *
virNetworkDefForwardIf(const virNetworkDef *def, virNetworkDefForwardIf(const virNetworkDef *def,
size_t n); size_t n);
virPortGroupDefPtr virPortGroupDef *
virPortGroupFindByName(virNetworkDefPtr net, virPortGroupFindByName(virNetworkDef *net,
const char *portgroup); const char *portgroup);
virNetworkIPDefPtr virNetworkIPDef *
virNetworkDefGetIPByIndex(const virNetworkDef *def, virNetworkDefGetIPByIndex(const virNetworkDef *def,
int family, int family,
size_t n); size_t n);
virNetDevIPRoutePtr virNetDevIPRoute *
virNetworkDefGetRouteByIndex(const virNetworkDef *def, virNetworkDefGetRouteByIndex(const virNetworkDef *def,
int family, int family,
size_t n); size_t n);
@ -387,24 +372,24 @@ virNetworkIPDefPrefix(const virNetworkIPDef *def);
int int
virNetworkIPDefNetmask(const virNetworkIPDef *def, virNetworkIPDefNetmask(const virNetworkIPDef *def,
virSocketAddrPtr netmask); virSocketAddr *netmask);
int int
virNetworkSaveXML(const char *configDir, virNetworkSaveXML(const char *configDir,
virNetworkDefPtr def, virNetworkDef *def,
const char *xml); const char *xml);
int int
virNetworkSaveConfig(const char *configDir, virNetworkSaveConfig(const char *configDir,
virNetworkDefPtr def, virNetworkDef *def,
virNetworkXMLOptionPtr xmlopt); virNetworkXMLOption *xmlopt);
char * char *
virNetworkConfigFile(const char *dir, virNetworkConfigFile(const char *dir,
const char *name); const char *name);
void void
virNetworkSetBridgeMacAddr(virNetworkDefPtr def); virNetworkSetBridgeMacAddr(virNetworkDef *def);
int int
virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt, virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt,
@ -412,7 +397,7 @@ virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt,
void void
virNetworkPortOptionsFormat(virTristateBool isolatedPort, virNetworkPortOptionsFormat(virTristateBool isolatedPort,
virBufferPtr buf); virBuffer *buf);
VIR_ENUM_DECL(virNetworkForward); VIR_ENUM_DECL(virNetworkForward);
@ -435,7 +420,7 @@ VIR_ENUM_DECL(virNetworkForward);
/* for testing */ /* for testing */
int int
virNetworkDefUpdateSection(virNetworkDefPtr def, virNetworkDefUpdateSection(virNetworkDef *def,
unsigned int command, /* virNetworkUpdateCommand */ unsigned int command, /* virNetworkUpdateCommand */
unsigned int section, /* virNetworkUpdateSection */ unsigned int section, /* virNetworkUpdateSection */
int parentIndex, int parentIndex,

View File

@ -36,7 +36,6 @@ struct _virNetworkEvent {
bool dummy; bool dummy;
}; };
typedef struct _virNetworkEvent virNetworkEvent; typedef struct _virNetworkEvent virNetworkEvent;
typedef virNetworkEvent *virNetworkEventPtr;
struct _virNetworkEventLifecycle { struct _virNetworkEventLifecycle {
virNetworkEvent parent; virNetworkEvent parent;
@ -45,10 +44,9 @@ struct _virNetworkEventLifecycle {
int detail; int detail;
}; };
typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle; typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
static virClassPtr virNetworkEventClass; static virClass *virNetworkEventClass;
static virClassPtr virNetworkEventLifecycleClass; static virClass *virNetworkEventLifecycleClass;
static void virNetworkEventDispose(void *obj); static void virNetworkEventDispose(void *obj);
static void virNetworkEventLifecycleDispose(void *obj); static void virNetworkEventLifecycleDispose(void *obj);
@ -69,7 +67,7 @@ VIR_ONCE_GLOBAL_INIT(virNetworkEvents);
static void static void
virNetworkEventDispose(void *obj) virNetworkEventDispose(void *obj)
{ {
virNetworkEventPtr event = obj; virNetworkEvent *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
} }
@ -77,14 +75,14 @@ virNetworkEventDispose(void *obj)
static void static void
virNetworkEventLifecycleDispose(void *obj) virNetworkEventLifecycleDispose(void *obj)
{ {
virNetworkEventLifecyclePtr event = obj; virNetworkEventLifecycle *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
} }
static void static void
virNetworkEventDispatchDefaultFunc(virConnectPtr conn, virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
virObjectEventPtr event, virObjectEvent *event,
virConnectObjectEventGenericCallback cb, virConnectObjectEventGenericCallback cb,
void *cbopaque) void *cbopaque)
{ {
@ -95,9 +93,9 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
switch ((virNetworkEventID)event->eventID) { switch ((virNetworkEventID)event->eventID) {
case VIR_NETWORK_EVENT_ID_LIFECYCLE: case VIR_NETWORK_EVENT_ID_LIFECYCLE:
{ {
virNetworkEventLifecyclePtr networkLifecycleEvent; virNetworkEventLifecycle *networkLifecycleEvent;
networkLifecycleEvent = (virNetworkEventLifecyclePtr)event; networkLifecycleEvent = (virNetworkEventLifecycle *)event;
((virConnectNetworkEventLifecycleCallback)cb)(conn, net, ((virConnectNetworkEventLifecycleCallback)cb)(conn, net,
networkLifecycleEvent->type, networkLifecycleEvent->type,
networkLifecycleEvent->detail, networkLifecycleEvent->detail,
@ -134,7 +132,7 @@ virNetworkEventDispatchDefaultFunc(virConnectPtr conn,
*/ */
int int
virNetworkEventStateRegisterID(virConnectPtr conn, virNetworkEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNetworkPtr net, virNetworkPtr net,
int eventID, int eventID,
virConnectNetworkEventGenericCallback cb, virConnectNetworkEventGenericCallback cb,
@ -178,7 +176,7 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
*/ */
int int
virNetworkEventStateRegisterClient(virConnectPtr conn, virNetworkEventStateRegisterClient(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNetworkPtr net, virNetworkPtr net,
int eventID, int eventID,
virConnectNetworkEventGenericCallback cb, virConnectNetworkEventGenericCallback cb,
@ -211,13 +209,13 @@ virNetworkEventStateRegisterClient(virConnectPtr conn,
* *
* Create a new network lifecycle event. * Create a new network lifecycle event.
*/ */
virObjectEventPtr virObjectEvent *
virNetworkEventLifecycleNew(const char *name, virNetworkEventLifecycleNew(const char *name,
const unsigned char *uuid, const unsigned char *uuid,
int type, int type,
int detail) int detail)
{ {
virNetworkEventLifecyclePtr event; virNetworkEventLifecycle *event;
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
if (virNetworkEventsInitialize() < 0) if (virNetworkEventsInitialize() < 0)
@ -233,5 +231,5 @@ virNetworkEventLifecycleNew(const char *name,
event->type = type; event->type = type;
event->detail = detail; event->detail = detail;
return (virObjectEventPtr)event; return (virObjectEvent *)event;
} }

View File

@ -27,7 +27,7 @@
int int
virNetworkEventStateRegisterID(virConnectPtr conn, virNetworkEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNetworkPtr net, virNetworkPtr net,
int eventID, int eventID,
virConnectNetworkEventGenericCallback cb, virConnectNetworkEventGenericCallback cb,
@ -39,7 +39,7 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
int int
virNetworkEventStateRegisterClient(virConnectPtr conn, virNetworkEventStateRegisterClient(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNetworkPtr net, virNetworkPtr net,
int eventID, int eventID,
virConnectNetworkEventGenericCallback cb, virConnectNetworkEventGenericCallback cb,
@ -49,7 +49,7 @@ virNetworkEventStateRegisterClient(virConnectPtr conn,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(8); ATTRIBUTE_NONNULL(8);
virObjectEventPtr virObjectEvent *
virNetworkEventLifecycleNew(const char *name, virNetworkEventLifecycleNew(const char *name,
const unsigned char *uuid, const unsigned char *uuid,
int type, int type,

View File

@ -30,7 +30,7 @@
#define VIR_FROM_THIS VIR_FROM_NETWORK #define VIR_FROM_THIS VIR_FROM_NETWORK
virNetDevIPRoutePtr virNetDevIPRoute *
virNetDevIPRouteCreate(const char *errorDetail, virNetDevIPRouteCreate(const char *errorDetail,
const char *family, const char *family,
const char *address, const char *address,
@ -212,7 +212,7 @@ virNetDevIPRouteCreate(const char *errorDetail,
return g_steal_pointer(&def); return g_steal_pointer(&def);
} }
virNetDevIPRoutePtr virNetDevIPRoute *
virNetDevIPRouteParseXML(const char *errorDetail, virNetDevIPRouteParseXML(const char *errorDetail,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -273,7 +273,7 @@ virNetDevIPRouteParseXML(const char *errorDetail,
} }
int int
virNetDevIPRouteFormat(virBufferPtr buf, virNetDevIPRouteFormat(virBuffer *buf,
const virNetDevIPRoute *def) const virNetDevIPRoute *def)
{ {
g_autofree char *address = NULL; g_autofree char *address = NULL;

View File

@ -30,7 +30,7 @@
#include "virsocketaddr.h" #include "virsocketaddr.h"
#include "virnetdevip.h" #include "virnetdevip.h"
virNetDevIPRoutePtr virNetDevIPRoute *
virNetDevIPRouteCreate(const char *networkName, virNetDevIPRouteCreate(const char *networkName,
const char *family, const char *family,
const char *address, const char *address,
@ -41,10 +41,10 @@ virNetDevIPRouteCreate(const char *networkName,
unsigned int metric, unsigned int metric,
bool hasMetric); bool hasMetric);
virNetDevIPRoutePtr virNetDevIPRoute *
virNetDevIPRouteParseXML(const char *networkName, virNetDevIPRouteParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
xmlXPathContextPtr ctxt); xmlXPathContextPtr ctxt);
int int
virNetDevIPRouteFormat(virBufferPtr buf, virNetDevIPRouteFormat(virBuffer *buf,
const virNetDevIPRoute *def); const virNetDevIPRoute *def);

View File

@ -101,9 +101,9 @@ virNodeDevCapsDefParseString(const char *xpath,
void void
virNodeDeviceDefFree(virNodeDeviceDefPtr def) virNodeDeviceDefFree(virNodeDeviceDef *def)
{ {
virNodeDevCapsDefPtr caps; virNodeDevCapsDef *caps;
if (!def) if (!def)
return; return;
@ -121,7 +121,7 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def)
caps = def->caps; caps = def->caps;
while (caps) { while (caps) {
virNodeDevCapsDefPtr next = caps->next; virNodeDevCapsDef *next = caps->next;
virNodeDevCapsDefFree(caps); virNodeDevCapsDefFree(caps);
caps = next; caps = next;
} }
@ -131,8 +131,8 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def)
static void static void
virPCIELinkFormat(virBufferPtr buf, virPCIELinkFormat(virBuffer *buf,
virPCIELinkPtr lnk, virPCIELink *lnk,
const char *attrib) const char *attrib)
{ {
if (!lnk) if (!lnk)
@ -150,8 +150,8 @@ virPCIELinkFormat(virBufferPtr buf,
static void static void
virPCIEDeviceInfoFormat(virBufferPtr buf, virPCIEDeviceInfoFormat(virBuffer *buf,
virPCIEDeviceInfoPtr info) virPCIEDeviceInfo *info)
{ {
if (!info->link_cap && !info->link_sta) { if (!info->link_cap && !info->link_sta) {
virBufferAddLit(buf, "<pci-express/>\n"); virBufferAddLit(buf, "<pci-express/>\n");
@ -170,7 +170,7 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapSystemDefFormat(virBufferPtr buf, virNodeDeviceCapSystemDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -211,8 +211,8 @@ virNodeDeviceCapSystemDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapMdevTypesFormat(virBufferPtr buf, virNodeDeviceCapMdevTypesFormat(virBuffer *buf,
virMediatedDeviceTypePtr *mdev_types, virMediatedDeviceType **mdev_types,
const size_t nmdev_types) const size_t nmdev_types)
{ {
size_t i; size_t i;
@ -221,7 +221,7 @@ virNodeDeviceCapMdevTypesFormat(virBufferPtr buf,
virBufferAddLit(buf, "<capability type='mdev_types'>\n"); virBufferAddLit(buf, "<capability type='mdev_types'>\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (i = 0; i < nmdev_types; i++) { for (i = 0; i < nmdev_types; i++) {
virMediatedDeviceTypePtr type = mdev_types[i]; virMediatedDeviceType *type = mdev_types[i];
virBufferEscapeString(buf, "<type id='%s'>\n", type->id); virBufferEscapeString(buf, "<type id='%s'>\n", type->id);
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
if (type->name) if (type->name)
@ -242,7 +242,7 @@ virNodeDeviceCapMdevTypesFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapPCIDefFormat(virBufferPtr buf, virNodeDeviceCapPCIDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
size_t i; size_t i;
@ -341,7 +341,7 @@ virNodeDeviceCapPCIDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapUSBDevDefFormat(virBufferPtr buf, virNodeDeviceCapUSBDevDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferAsprintf(buf, "<bus>%d</bus>\n", data->usb_dev.bus); virBufferAsprintf(buf, "<bus>%d</bus>\n", data->usb_dev.bus);
@ -365,7 +365,7 @@ virNodeDeviceCapUSBDevDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapUSBInterfaceDefFormat(virBufferPtr buf, virNodeDeviceCapUSBInterfaceDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferAsprintf(buf, "<number>%d</number>\n", virBufferAsprintf(buf, "<number>%d</number>\n",
@ -384,7 +384,7 @@ virNodeDeviceCapUSBInterfaceDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapNetDefFormat(virBufferPtr buf, virNodeDeviceCapNetDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
size_t i; size_t i;
@ -413,7 +413,7 @@ virNodeDeviceCapNetDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapSCSIHostDefFormat(virBufferPtr buf, virNodeDeviceCapSCSIHostDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferAsprintf(buf, "<host>%d</host>\n", virBufferAsprintf(buf, "<host>%d</host>\n",
@ -447,7 +447,7 @@ virNodeDeviceCapSCSIHostDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapSCSIDefFormat(virBufferPtr buf, virNodeDeviceCapSCSIDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferAsprintf(buf, "<host>%d</host>\n", data->scsi.host); virBufferAsprintf(buf, "<host>%d</host>\n", data->scsi.host);
@ -462,7 +462,7 @@ virNodeDeviceCapSCSIDefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapStorageDefFormat(virBufferPtr buf, virNodeDeviceCapStorageDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferEscapeString(buf, "<block>%s</block>\n", virBufferEscapeString(buf, "<block>%s</block>\n",
@ -521,7 +521,7 @@ virNodeDeviceCapStorageDefFormat(virBufferPtr buf,
} }
static void static void
virNodeDeviceCapMdevDefFormat(virBufferPtr buf, virNodeDeviceCapMdevDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
size_t i; size_t i;
@ -532,14 +532,14 @@ virNodeDeviceCapMdevDefFormat(virBufferPtr buf,
data->mdev.iommuGroupNumber); data->mdev.iommuGroupNumber);
for (i = 0; i < data->mdev.nattributes; i++) { for (i = 0; i < data->mdev.nattributes; i++) {
virMediatedDeviceAttrPtr attr = data->mdev.attributes[i]; virMediatedDeviceAttr *attr = data->mdev.attributes[i];
virBufferAsprintf(buf, "<attr name='%s' value='%s'/>\n", virBufferAsprintf(buf, "<attr name='%s' value='%s'/>\n",
attr->name, attr->value); attr->name, attr->value);
} }
} }
static void static void
virNodeDeviceCapVDPADefFormat(virBufferPtr buf, virNodeDeviceCapVDPADefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferEscapeString(buf, "<chardev>%s</chardev>\n", data->vdpa.chardev); virBufferEscapeString(buf, "<chardev>%s</chardev>\n", data->vdpa.chardev);
@ -547,7 +547,7 @@ virNodeDeviceCapVDPADefFormat(virBufferPtr buf,
static void static void
virNodeDeviceCapCCWDefFormat(virBufferPtr buf, virNodeDeviceCapCCWDefFormat(virBuffer *buf,
const virNodeDevCapData *data) const virNodeDevCapData *data)
{ {
virBufferAsprintf(buf, "<cssid>0x%x</cssid>\n", virBufferAsprintf(buf, "<cssid>0x%x</cssid>\n",
@ -567,7 +567,7 @@ char *
virNodeDeviceDefFormat(const virNodeDeviceDef *def) virNodeDeviceDefFormat(const virNodeDeviceDef *def)
{ {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps; virNodeDevCapsDef *caps;
size_t i = 0; size_t i = 0;
virBufferAddLit(&buf, "<device>\n"); virBufferAddLit(&buf, "<device>\n");
@ -593,7 +593,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
} }
for (caps = def->caps; caps; caps = caps->next) { for (caps = def->caps; caps; caps = caps->next) {
virNodeDevCapDataPtr data = &caps->data; virNodeDevCapData *data = &caps->data;
virBufferAsprintf(&buf, "<capability type='%s'>\n", virBufferAsprintf(&buf, "<capability type='%s'>\n",
virNodeDevCapTypeToString(caps->data.type)); virNodeDevCapTypeToString(caps->data.type));
@ -704,7 +704,7 @@ static int
virNodeDevCapsDefParseIntOptional(const char *xpath, virNodeDevCapsDefParseIntOptional(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
int *value, int *value,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
const char *invalid_error_fmt) const char *invalid_error_fmt)
{ {
int ret; int ret;
@ -728,7 +728,7 @@ static int
virNodeDevCapsDefParseULong(const char *xpath, virNodeDevCapsDefParseULong(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned *value, unsigned *value,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
const char *missing_error_fmt, const char *missing_error_fmt,
const char *invalid_error_fmt) const char *invalid_error_fmt)
{ {
@ -752,7 +752,7 @@ static int
virNodeDevCapsDefParseULongLong(const char *xpath, virNodeDevCapsDefParseULongLong(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned long long *value, unsigned long long *value,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
const char *missing_error_fmt, const char *missing_error_fmt,
const char *invalid_error_fmt) const char *invalid_error_fmt)
{ {
@ -774,9 +774,9 @@ virNodeDevCapsDefParseULongLong(const char *xpath,
static int static int
virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapDRMPtr drm) virNodeDevCapDRM *drm)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
int val; int val;
@ -799,14 +799,14 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt, virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt,
virMediatedDeviceTypePtr **mdev_types, virMediatedDeviceType ***mdev_types,
size_t *nmdev_types) size_t *nmdev_types)
{ {
int ret = -1; int ret = -1;
xmlNodePtr orignode = NULL; xmlNodePtr orignode = NULL;
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
int ntypes = -1; int ntypes = -1;
virMediatedDeviceTypePtr type = NULL; virMediatedDeviceType *type = NULL;
size_t i; size_t i;
if ((ntypes = virXPathNodeSet("./type", ctxt, &nodes)) < 0) if ((ntypes = virXPathNodeSet("./type", ctxt, &nodes)) < 0)
@ -865,7 +865,7 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt, virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapAPMatrixPtr apm_dev) virNodeDevCapAPMatrix *apm_dev)
{ {
g_autofree char *type = virXMLPropString(node, "type"); g_autofree char *type = virXMLPropString(node, "type");
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -892,7 +892,7 @@ virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt, virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapCCWPtr ccw_dev) virNodeDevCapCCW *ccw_dev)
{ {
g_autofree char *type = virXMLPropString(node, "type"); g_autofree char *type = virXMLPropString(node, "type");
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -918,9 +918,9 @@ virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapCCWPtr ccw_dev) virNodeDevCapCCW *ccw_dev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
@ -985,7 +985,7 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapAPAdapterParseXML(xmlXPathContextPtr ctxt, virNodeDevCapAPAdapterParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
unsigned int *ap_adapter) unsigned int *ap_adapter)
{ {
g_autofree char *adapter = NULL; g_autofree char *adapter = NULL;
@ -1009,9 +1009,9 @@ virNodeDevCapAPAdapterParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt, virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapAPCardPtr ap_card) virNodeDevCapAPCard *ap_card)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
ctxt->node = node; ctxt->node = node;
@ -1022,9 +1022,9 @@ virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt, virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapAPQueuePtr ap_queue) virNodeDevCapAPQueue *ap_queue)
{ {
int ret = -1; int ret = -1;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -1063,9 +1063,9 @@ virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapAPMatrixParseXML(xmlXPathContextPtr ctxt, virNodeDevCapAPMatrixParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def G_GNUC_UNUSED, virNodeDeviceDef *def G_GNUC_UNUSED,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapAPMatrixPtr ap_matrix) virNodeDevCapAPMatrix *ap_matrix)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
@ -1088,9 +1088,9 @@ virNodeDevCapAPMatrixParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapStoragePtr storage) virNodeDevCapStorage *storage)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
@ -1174,9 +1174,9 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapSCSIPtr scsi) virNodeDevCapSCSI *scsi)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -1214,9 +1214,9 @@ virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapSCSITargetPtr scsi_target) virNodeDevCapSCSITarget *scsi_target)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
@ -1281,9 +1281,9 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapSCSIHostPtr scsi_host, virNodeDevCapSCSIHost *scsi_host,
int create, int create,
const char *virt_type) const char *virt_type)
{ {
@ -1376,9 +1376,9 @@ virNodeDevCapSCSIHostParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt, virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapNetPtr net) virNodeDevCapNet *net)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
xmlNodePtr lnk; xmlNodePtr lnk;
@ -1447,9 +1447,9 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt, virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapUSBIfPtr usb_if) virNodeDevCapUSBIf *usb_if)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -1489,7 +1489,7 @@ static int
virNodeDevCapsDefParseHexId(const char *xpath, virNodeDevCapsDefParseHexId(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned *value, unsigned *value,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
const char *missing_error_fmt, const char *missing_error_fmt,
const char *invalid_error_fmt) const char *invalid_error_fmt)
{ {
@ -1511,9 +1511,9 @@ virNodeDevCapsDefParseHexId(const char *xpath,
static int static int
virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapUSBDevPtr usb_dev) virNodeDevCapUSBDev *usb_dev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -1553,7 +1553,7 @@ virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt, virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr iommuGroupNode, xmlNodePtr iommuGroupNode,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree xmlNodePtr *addrNodes = NULL; g_autofree xmlNodePtr *addrNodes = NULL;
@ -1598,7 +1598,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
static int static int
virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr linkNode, xmlNodePtr linkNode,
virPCIELinkPtr lnk) virPCIELink *lnk)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
int speed; int speed;
@ -1641,7 +1641,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
static int static int
virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr pciExpressNode, xmlNodePtr pciExpressNode,
virPCIEDeviceInfoPtr pci_express) virPCIEDeviceInfo *pci_express)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
xmlNodePtr lnk; xmlNodePtr lnk;
@ -1670,7 +1670,7 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevPCICapSRIOVPhysicalParseXML(xmlXPathContextPtr ctxt, virNodeDevPCICapSRIOVPhysicalParseXML(xmlXPathContextPtr ctxt,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
xmlNodePtr address = virXPathNode("./address[1]", ctxt); xmlNodePtr address = virXPathNode("./address[1]", ctxt);
@ -1694,7 +1694,7 @@ virNodeDevPCICapSRIOVPhysicalParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt, virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
g_autofree xmlNodePtr *addresses = NULL; g_autofree xmlNodePtr *addresses = NULL;
int naddresses = virXPathNodeSet("./address", ctxt, &addresses); int naddresses = virXPathNodeSet("./address", ctxt, &addresses);
@ -1712,7 +1712,7 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
return -1; return -1;
} }
pci_dev->virtual_functions = g_new0(virPCIDeviceAddressPtr, naddresses); pci_dev->virtual_functions = g_new0(virPCIDeviceAddress *, naddresses);
for (i = 0; i < naddresses; i++) { for (i = 0; i < naddresses; i++) {
g_autoptr(virPCIDeviceAddress) addr = NULL; g_autoptr(virPCIDeviceAddress) addr = NULL;
@ -1736,7 +1736,7 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
g_autofree char *type = virXMLPropString(node, "type"); g_autofree char *type = virXMLPropString(node, "type");
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
@ -1773,9 +1773,9 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
xmlNodePtr iommuGroupNode; xmlNodePtr iommuGroupNode;
@ -1783,7 +1783,7 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
g_autofree xmlNodePtr *nodes = NULL; g_autofree xmlNodePtr *nodes = NULL;
int n = 0; int n = 0;
int ret = -1; int ret = -1;
virPCIEDeviceInfoPtr pci_express = NULL; virPCIEDeviceInfo *pci_express = NULL;
g_autofree char *tmp = NULL; g_autofree char *tmp = NULL;
size_t i = 0; size_t i = 0;
@ -1880,12 +1880,12 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapSystemPtr syscap) virNodeDevCapSystem *syscap)
{ {
virNodeDevCapSystemHardwarePtr hardware = &syscap->hardware; virNodeDevCapSystemHardware *hardware = &syscap->hardware;
virNodeDevCapSystemFirmwarePtr firmware = &syscap->firmware; virNodeDevCapSystemFirmware *firmware = &syscap->firmware;
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree char *tmp = NULL; g_autofree char *tmp = NULL;
@ -1920,7 +1920,7 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapMdevAttributeParseXML(xmlXPathContextPtr ctxt, virNodeDevCapMdevAttributeParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapMdevPtr mdev) virNodeDevCapMdev *mdev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autoptr(virMediatedDeviceAttr) attr = virMediatedDeviceAttrNew(); g_autoptr(virMediatedDeviceAttr) attr = virMediatedDeviceAttrNew();
@ -1941,9 +1941,9 @@ virNodeDevCapMdevAttributeParseXML(xmlXPathContextPtr ctxt,
static int static int
virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
virNodeDevCapMdevPtr mdev) virNodeDevCapMdev *mdev)
{ {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
int nattrs = 0; int nattrs = 0;
@ -1991,14 +1991,14 @@ virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt,
} }
static virNodeDevCapsDefPtr static virNodeDevCapsDef *
virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDef *def,
xmlNodePtr node, xmlNodePtr node,
int create, int create,
const char *virt_type) const char *virt_type)
{ {
virNodeDevCapsDefPtr caps; virNodeDevCapsDef *caps;
g_autofree char *tmp = NULL; g_autofree char *tmp = NULL;
int val, ret = -1; int val, ret = -1;
@ -2097,13 +2097,13 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
} }
static virNodeDeviceDefPtr static virNodeDeviceDef *
virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
int create, int create,
const char *virt_type) const char *virt_type)
{ {
virNodeDeviceDefPtr def; virNodeDeviceDef *def;
virNodeDevCapsDefPtr *next_cap; virNodeDevCapsDef **next_cap;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int n, m; int n, m;
size_t i; size_t i;
@ -2219,7 +2219,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
} }
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseNode(xmlDocPtr xml, virNodeDeviceDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
int create, int create,
@ -2243,14 +2243,14 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
} }
static virNodeDeviceDefPtr static virNodeDeviceDef *
virNodeDeviceDefParse(const char *str, virNodeDeviceDefParse(const char *str,
const char *filename, const char *filename,
int create, int create,
const char *virt_type) const char *virt_type)
{ {
xmlDocPtr xml; xmlDocPtr xml;
virNodeDeviceDefPtr def = NULL; virNodeDeviceDef *def = NULL;
if ((xml = virXMLParse(filename, str, _("(node_device_definition)")))) { if ((xml = virXMLParse(filename, str, _("(node_device_definition)")))) {
def = virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml), def = virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml),
@ -2262,7 +2262,7 @@ virNodeDeviceDefParse(const char *str,
} }
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseString(const char *str, virNodeDeviceDefParseString(const char *str,
int create, int create,
const char *virt_type) const char *virt_type)
@ -2271,7 +2271,7 @@ virNodeDeviceDefParseString(const char *str,
} }
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseFile(const char *filename, virNodeDeviceDefParseFile(const char *filename,
int create, int create,
const char *virt_type) const char *virt_type)
@ -2284,11 +2284,11 @@ virNodeDeviceDefParseFile(const char *filename,
* Return fc_host dev's WWNN and WWPN * Return fc_host dev's WWNN and WWPN
*/ */
int int
virNodeDeviceGetWWNs(virNodeDeviceDefPtr def, virNodeDeviceGetWWNs(virNodeDeviceDef *def,
char **wwnn, char **wwnn,
char **wwpn) char **wwpn)
{ {
virNodeDevCapsDefPtr cap = NULL; virNodeDevCapsDef *cap = NULL;
cap = def->caps; cap = def->caps;
while (cap != NULL) { while (cap != NULL) {
@ -2313,10 +2313,10 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
void void
virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) virNodeDevCapsDefFree(virNodeDevCapsDef *caps)
{ {
size_t i = 0; size_t i = 0;
virNodeDevCapDataPtr data = &caps->data; virNodeDevCapData *data = &caps->data;
switch (caps->data.type) { switch (caps->data.type) {
case VIR_NODE_DEV_CAP_SYSTEM: case VIR_NODE_DEV_CAP_SYSTEM:
@ -2416,9 +2416,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
int int
virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) virNodeDeviceUpdateCaps(virNodeDeviceDef *def)
{ {
virNodeDevCapsDefPtr cap = def->caps; virNodeDevCapsDef *cap = def->caps;
while (cap) { while (cap) {
switch (cap->data.type) { switch (cap->data.type) {
@ -2495,10 +2495,10 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
* Returns the number of capabilities the device supports, -1 on error. * Returns the number of capabilities the device supports, -1 on error.
*/ */
int int
virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, virNodeDeviceCapsListExport(virNodeDeviceDef *def,
virNodeDevCapType **list) virNodeDevCapType **list)
{ {
virNodeDevCapsDefPtr caps = NULL; virNodeDevCapsDef *caps = NULL;
g_autofree virNodeDevCapType *tmp = NULL; g_autofree virNodeDevCapType *tmp = NULL;
bool want_list = !!list; bool want_list = !!list;
int ncaps = 0; int ncaps = 0;
@ -2576,7 +2576,7 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def,
#ifdef __linux__ #ifdef __linux__
int int
virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host) virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host)
{ {
g_autofree char *tmp = NULL; g_autofree char *tmp = NULL;
int ret = -1; int ret = -1;
@ -2657,7 +2657,7 @@ virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host)
int int
virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
virNodeDevCapSCSITargetPtr scsi_target) virNodeDevCapSCSITarget *scsi_target)
{ {
int ret = -1; int ret = -1;
g_autofree char *dir = NULL; g_autofree char *dir = NULL;
@ -2698,7 +2698,7 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
static int static int
virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath, virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
size_t i; size_t i;
int ret; int ret;
@ -2736,7 +2736,7 @@ virNodeDeviceGetPCISRIOVCaps(const char *sysfsPath,
static int static int
virNodeDeviceGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev) virNodeDeviceGetPCIIOMMUGroupCaps(virNodeDevCapPCIDev *pci_dev)
{ {
size_t i; size_t i;
int tmpGroup; int tmpGroup;
@ -2774,10 +2774,10 @@ virNodeDeviceGetPCIIOMMUGroupCaps(virNodeDevCapPCIDevPtr pci_dev)
static int static int
virNodeDeviceGetMdevTypesCaps(const char *sysfspath, virNodeDeviceGetMdevTypesCaps(const char *sysfspath,
virMediatedDeviceTypePtr **mdev_types, virMediatedDeviceType ***mdev_types,
size_t *nmdev_types) size_t *nmdev_types)
{ {
virMediatedDeviceTypePtr *types = NULL; virMediatedDeviceType **types = NULL;
size_t ntypes = 0; size_t ntypes = 0;
size_t i; size_t i;
@ -2805,7 +2805,7 @@ virNodeDeviceGetMdevTypesCaps(const char *sysfspath,
*/ */
int int
virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath, virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath,
virNodeDevCapPCIDevPtr pci_dev) virNodeDevCapPCIDev *pci_dev)
{ {
if (virNodeDeviceGetPCISRIOVCaps(sysfsPath, pci_dev) < 0 || if (virNodeDeviceGetPCISRIOVCaps(sysfsPath, pci_dev) < 0 ||
virNodeDeviceGetPCIIOMMUGroupCaps(pci_dev) < 0) virNodeDeviceGetPCIIOMMUGroupCaps(pci_dev) < 0)
@ -2831,7 +2831,7 @@ virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath,
*/ */
int int
virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath, virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath,
virNodeDevCapCCWPtr ccw_dev) virNodeDevCapCCW *ccw_dev)
{ {
ccw_dev->flags &= ~VIR_NODE_DEV_CAP_FLAG_CSS_MDEV; ccw_dev->flags &= ~VIR_NODE_DEV_CAP_FLAG_CSS_MDEV;
if (virNodeDeviceGetMdevTypesCaps(sysfsPath, if (virNodeDeviceGetMdevTypesCaps(sysfsPath,
@ -2852,7 +2852,7 @@ virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath,
*/ */
int int
virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath, virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath,
virNodeDevCapAPMatrixPtr ap_matrix) virNodeDevCapAPMatrix *ap_matrix)
{ {
ap_matrix->flags &= ~VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV; ap_matrix->flags &= ~VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV;
if (virNodeDeviceGetMdevTypesCaps(sysfsPath, if (virNodeDeviceGetMdevTypesCaps(sysfsPath,
@ -2868,35 +2868,35 @@ virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath,
#else #else
int int
virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host G_GNUC_UNUSED) virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host G_GNUC_UNUSED)
{ {
return -1; return -1;
} }
int int
virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath G_GNUC_UNUSED, virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath G_GNUC_UNUSED,
virNodeDevCapPCIDevPtr pci_dev G_GNUC_UNUSED) virNodeDevCapPCIDev *pci_dev G_GNUC_UNUSED)
{ {
return -1; return -1;
} }
int virNodeDeviceGetSCSITargetCaps(const char *sysfsPath G_GNUC_UNUSED, int virNodeDeviceGetSCSITargetCaps(const char *sysfsPath G_GNUC_UNUSED,
virNodeDevCapSCSITargetPtr scsi_target G_GNUC_UNUSED) virNodeDevCapSCSITarget *scsi_target G_GNUC_UNUSED)
{ {
return -1; return -1;
} }
int int
virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath G_GNUC_UNUSED, virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath G_GNUC_UNUSED,
virNodeDevCapCCWPtr ccw_dev G_GNUC_UNUSED) virNodeDevCapCCW *ccw_dev G_GNUC_UNUSED)
{ {
return -1; return -1;
} }
int int
virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath G_GNUC_UNUSED, virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath G_GNUC_UNUSED,
virNodeDevCapAPMatrixPtr ap_matrix G_GNUC_UNUSED) virNodeDevCapAPMatrix *ap_matrix G_GNUC_UNUSED)
{ {
return -1; return -1;
} }

View File

@ -125,7 +125,6 @@ typedef enum {
VIR_ENUM_DECL(virNodeDevDRM); VIR_ENUM_DECL(virNodeDevDRM);
typedef struct _virNodeDevCapSystemHardware virNodeDevCapSystemHardware; typedef struct _virNodeDevCapSystemHardware virNodeDevCapSystemHardware;
typedef virNodeDevCapSystemHardware *virNodeDevCapSystemHardwarePtr;
struct _virNodeDevCapSystemHardware { struct _virNodeDevCapSystemHardware {
char *vendor_name; char *vendor_name;
char *version; char *version;
@ -134,7 +133,6 @@ struct _virNodeDevCapSystemHardware {
}; };
typedef struct _virNodeDevCapSystemFirmware virNodeDevCapSystemFirmware; typedef struct _virNodeDevCapSystemFirmware virNodeDevCapSystemFirmware;
typedef virNodeDevCapSystemFirmware *virNodeDevCapSystemFirmwarePtr;
struct _virNodeDevCapSystemFirmware { struct _virNodeDevCapSystemFirmware {
char *vendor_name; char *vendor_name;
char *version; char *version;
@ -142,7 +140,6 @@ struct _virNodeDevCapSystemFirmware {
}; };
typedef struct _virNodeDevCapSystem virNodeDevCapSystem; typedef struct _virNodeDevCapSystem virNodeDevCapSystem;
typedef virNodeDevCapSystem *virNodeDevCapSystemPtr;
struct _virNodeDevCapSystem { struct _virNodeDevCapSystem {
char *product_name; char *product_name;
virNodeDevCapSystemHardware hardware; virNodeDevCapSystemHardware hardware;
@ -150,17 +147,15 @@ struct _virNodeDevCapSystem {
}; };
typedef struct _virNodeDevCapMdev virNodeDevCapMdev; typedef struct _virNodeDevCapMdev virNodeDevCapMdev;
typedef virNodeDevCapMdev *virNodeDevCapMdevPtr;
struct _virNodeDevCapMdev { struct _virNodeDevCapMdev {
char *type; char *type;
unsigned int iommuGroupNumber; unsigned int iommuGroupNumber;
char *uuid; char *uuid;
virMediatedDeviceAttrPtr *attributes; virMediatedDeviceAttr **attributes;
size_t nattributes; size_t nattributes;
}; };
typedef struct _virNodeDevCapPCIDev virNodeDevCapPCIDev; typedef struct _virNodeDevCapPCIDev virNodeDevCapPCIDev;
typedef virNodeDevCapPCIDev *virNodeDevCapPCIDevPtr;
struct _virNodeDevCapPCIDev { struct _virNodeDevCapPCIDev {
unsigned int domain; unsigned int domain;
unsigned int bus; unsigned int bus;
@ -171,23 +166,22 @@ struct _virNodeDevCapPCIDev {
int klass; int klass;
char *product_name; char *product_name;
char *vendor_name; char *vendor_name;
virPCIDeviceAddressPtr physical_function; virPCIDeviceAddress *physical_function;
virPCIDeviceAddressPtr *virtual_functions; virPCIDeviceAddress **virtual_functions;
size_t num_virtual_functions; size_t num_virtual_functions;
unsigned int max_virtual_functions; unsigned int max_virtual_functions;
unsigned int flags; unsigned int flags;
virPCIDeviceAddressPtr *iommuGroupDevices; virPCIDeviceAddress **iommuGroupDevices;
size_t nIommuGroupDevices; size_t nIommuGroupDevices;
unsigned int iommuGroupNumber; unsigned int iommuGroupNumber;
int numa_node; int numa_node;
virPCIEDeviceInfoPtr pci_express; virPCIEDeviceInfo *pci_express;
int hdrType; /* enum virPCIHeaderType or -1 */ int hdrType; /* enum virPCIHeaderType or -1 */
virMediatedDeviceTypePtr *mdev_types; virMediatedDeviceType **mdev_types;
size_t nmdev_types; size_t nmdev_types;
}; };
typedef struct _virNodeDevCapUSBDev virNodeDevCapUSBDev; typedef struct _virNodeDevCapUSBDev virNodeDevCapUSBDev;
typedef virNodeDevCapUSBDev *virNodeDevCapUSBDevPtr;
struct _virNodeDevCapUSBDev { struct _virNodeDevCapUSBDev {
unsigned int bus; unsigned int bus;
unsigned int device; unsigned int device;
@ -198,7 +192,6 @@ struct _virNodeDevCapUSBDev {
}; };
typedef struct _virNodeDevCapUSBIf virNodeDevCapUSBIf; typedef struct _virNodeDevCapUSBIf virNodeDevCapUSBIf;
typedef virNodeDevCapUSBIf *virNodeDevCapUSBIfPtr;
struct _virNodeDevCapUSBIf { struct _virNodeDevCapUSBIf {
unsigned int number; unsigned int number;
unsigned int klass; unsigned int klass;
@ -208,18 +201,16 @@ struct _virNodeDevCapUSBIf {
}; };
typedef struct _virNodeDevCapNet virNodeDevCapNet; typedef struct _virNodeDevCapNet virNodeDevCapNet;
typedef virNodeDevCapNet *virNodeDevCapNetPtr;
struct _virNodeDevCapNet { struct _virNodeDevCapNet {
char *address; char *address;
unsigned int address_len; unsigned int address_len;
char *ifname; char *ifname;
virNetDevIfLink lnk; virNetDevIfLink lnk;
virNodeDevNetCapType subtype; /* LAST -> no subtype */ virNodeDevNetCapType subtype; /* LAST -> no subtype */
virBitmapPtr features; /* enum virNetDevFeature */ virBitmap *features; /* enum virNetDevFeature */
}; };
typedef struct _virNodeDevCapSCSIHost virNodeDevCapSCSIHost; typedef struct _virNodeDevCapSCSIHost virNodeDevCapSCSIHost;
typedef virNodeDevCapSCSIHost *virNodeDevCapSCSIHostPtr;
struct _virNodeDevCapSCSIHost { struct _virNodeDevCapSCSIHost {
unsigned int host; unsigned int host;
int unique_id; int unique_id;
@ -232,7 +223,6 @@ struct _virNodeDevCapSCSIHost {
}; };
typedef struct _virNodeDevCapSCSITarget virNodeDevCapSCSITarget; typedef struct _virNodeDevCapSCSITarget virNodeDevCapSCSITarget;
typedef virNodeDevCapSCSITarget *virNodeDevCapSCSITargetPtr;
struct _virNodeDevCapSCSITarget { struct _virNodeDevCapSCSITarget {
char *name; char *name;
unsigned int flags; /* enum virNodeDevSCSITargetCapsFlags */ unsigned int flags; /* enum virNodeDevSCSITargetCapsFlags */
@ -241,7 +231,6 @@ struct _virNodeDevCapSCSITarget {
}; };
typedef struct _virNodeDevCapSCSI virNodeDevCapSCSI; typedef struct _virNodeDevCapSCSI virNodeDevCapSCSI;
typedef virNodeDevCapSCSI *virNodeDevCapSCSIPtr;
struct _virNodeDevCapSCSI { struct _virNodeDevCapSCSI {
unsigned int host; unsigned int host;
unsigned int bus; unsigned int bus;
@ -251,7 +240,6 @@ struct _virNodeDevCapSCSI {
}; };
typedef struct _virNodeDevCapStorage virNodeDevCapStorage; typedef struct _virNodeDevCapStorage virNodeDevCapStorage;
typedef virNodeDevCapStorage *virNodeDevCapStoragePtr;
struct _virNodeDevCapStorage { struct _virNodeDevCapStorage {
unsigned long long size; unsigned long long size;
unsigned long long num_blocks; unsigned long long num_blocks;
@ -268,58 +256,50 @@ struct _virNodeDevCapStorage {
}; };
typedef struct _virNodeDevCapSCSIGeneric virNodeDevCapSCSIGeneric; typedef struct _virNodeDevCapSCSIGeneric virNodeDevCapSCSIGeneric;
typedef virNodeDevCapSCSIGeneric *virNodeDevCapSCSIGenericPtr;
struct _virNodeDevCapSCSIGeneric { struct _virNodeDevCapSCSIGeneric {
char *path; char *path;
}; };
typedef struct _virNodeDevCapDRM virNodeDevCapDRM; typedef struct _virNodeDevCapDRM virNodeDevCapDRM;
typedef virNodeDevCapDRM *virNodeDevCapDRMPtr;
struct _virNodeDevCapDRM { struct _virNodeDevCapDRM {
virNodeDevDRMType type; virNodeDevDRMType type;
}; };
typedef struct _virNodeDevCapCCW virNodeDevCapCCW; typedef struct _virNodeDevCapCCW virNodeDevCapCCW;
typedef virNodeDevCapCCW *virNodeDevCapCCWPtr;
struct _virNodeDevCapCCW { struct _virNodeDevCapCCW {
unsigned int cssid; unsigned int cssid;
unsigned int ssid; unsigned int ssid;
unsigned int devno; unsigned int devno;
unsigned int flags; /* enum virNodeDevCCWCapFlags */ unsigned int flags; /* enum virNodeDevCCWCapFlags */
virMediatedDeviceTypePtr *mdev_types; virMediatedDeviceType **mdev_types;
size_t nmdev_types; size_t nmdev_types;
}; };
typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA; typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA;
typedef virNodeDevCapVDPA *virNodeDevCapVDPAPtr;
struct _virNodeDevCapVDPA { struct _virNodeDevCapVDPA {
char *chardev; char *chardev;
}; };
typedef struct _virNodeDevCapAPCard virNodeDevCapAPCard; typedef struct _virNodeDevCapAPCard virNodeDevCapAPCard;
typedef virNodeDevCapAPCard *virNodeDevCapAPCardPtr;
struct _virNodeDevCapAPCard { struct _virNodeDevCapAPCard {
unsigned int ap_adapter; unsigned int ap_adapter;
}; };
typedef struct _virNodeDevCapAPQueue virNodeDevCapAPQueue; typedef struct _virNodeDevCapAPQueue virNodeDevCapAPQueue;
typedef virNodeDevCapAPQueue *virNodeDevCapAPQueuePtr;
struct _virNodeDevCapAPQueue { struct _virNodeDevCapAPQueue {
unsigned int ap_adapter; unsigned int ap_adapter;
unsigned int ap_domain; unsigned int ap_domain;
}; };
typedef struct _virNodeDevCapAPMatrix virNodeDevCapAPMatrix; typedef struct _virNodeDevCapAPMatrix virNodeDevCapAPMatrix;
typedef virNodeDevCapAPMatrix *virNodeDevCapAPMatrixPtr;
struct _virNodeDevCapAPMatrix { struct _virNodeDevCapAPMatrix {
char *addr; char *addr;
unsigned int flags; /* enum virNodeDevAPMatrixCapFlags */ unsigned int flags; /* enum virNodeDevAPMatrixCapFlags */
virMediatedDeviceTypePtr *mdev_types; virMediatedDeviceType **mdev_types;
size_t nmdev_types; size_t nmdev_types;
}; };
typedef struct _virNodeDevCapData virNodeDevCapData; typedef struct _virNodeDevCapData virNodeDevCapData;
typedef virNodeDevCapData *virNodeDevCapDataPtr;
struct _virNodeDevCapData { struct _virNodeDevCapData {
virNodeDevCapType type; virNodeDevCapType type;
union { union {
@ -344,15 +324,13 @@ struct _virNodeDevCapData {
}; };
typedef struct _virNodeDevCapsDef virNodeDevCapsDef; typedef struct _virNodeDevCapsDef virNodeDevCapsDef;
typedef virNodeDevCapsDef *virNodeDevCapsDefPtr;
struct _virNodeDevCapsDef { struct _virNodeDevCapsDef {
virNodeDevCapData data; virNodeDevCapData data;
virNodeDevCapsDefPtr next; /* next capability */ virNodeDevCapsDef *next; /* next capability */
}; };
typedef struct _virNodeDeviceDef virNodeDeviceDef; typedef struct _virNodeDeviceDef virNodeDeviceDef;
typedef virNodeDeviceDef *virNodeDeviceDefPtr;
struct _virNodeDeviceDef { struct _virNodeDeviceDef {
char *name; /* device name (unique on node) */ char *name; /* device name (unique on node) */
char *sysfs_path; /* udev name/sysfs path */ char *sysfs_path; /* udev name/sysfs path */
@ -364,40 +342,40 @@ struct _virNodeDeviceDef {
char *driver; /* optional driver name */ char *driver; /* optional driver name */
char *devnode; /* /dev path */ char *devnode; /* /dev path */
char **devlinks; /* /dev links */ char **devlinks; /* /dev links */
virNodeDevCapsDefPtr caps; /* optional device capabilities */ virNodeDevCapsDef *caps; /* optional device capabilities */
}; };
char * char *
virNodeDeviceDefFormat(const virNodeDeviceDef *def); virNodeDeviceDefFormat(const virNodeDeviceDef *def);
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseString(const char *str, virNodeDeviceDefParseString(const char *str,
int create, int create,
const char *virt_type); const char *virt_type);
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseFile(const char *filename, virNodeDeviceDefParseFile(const char *filename,
int create, int create,
const char *virt_type); const char *virt_type);
virNodeDeviceDefPtr virNodeDeviceDef *
virNodeDeviceDefParseNode(xmlDocPtr xml, virNodeDeviceDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
int create, int create,
const char *virt_type); const char *virt_type);
int int
virNodeDeviceGetWWNs(virNodeDeviceDefPtr def, virNodeDeviceGetWWNs(virNodeDeviceDef *def,
char **wwnn, char **wwnn,
char **wwpn); char **wwpn);
void void
virNodeDeviceDefFree(virNodeDeviceDefPtr def); virNodeDeviceDefFree(virNodeDeviceDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDeviceDef, virNodeDeviceDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNodeDeviceDef, virNodeDeviceDefFree);
void void
virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); virNodeDevCapsDefFree(virNodeDevCapsDef *caps);
#define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \ #define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \
(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \ (VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \
@ -431,27 +409,27 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps);
VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ACTIVE VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_ACTIVE
int int
virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHost *scsi_host);
int int
virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, virNodeDeviceGetSCSITargetCaps(const char *sysfsPath,
virNodeDevCapSCSITargetPtr scsi_target); virNodeDevCapSCSITarget *scsi_target);
int int
virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath, virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath,
virNodeDevCapPCIDevPtr pci_dev); virNodeDevCapPCIDev *pci_dev);
int int
virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath, virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath,
virNodeDevCapCCWPtr ccw_dev); virNodeDevCapCCW *ccw_dev);
int int
virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath, virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath,
virNodeDevCapAPMatrixPtr ap_matrix); virNodeDevCapAPMatrix *ap_matrix);
int int
virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def); virNodeDeviceUpdateCaps(virNodeDeviceDef *def);
int int
virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, virNodeDeviceCapsListExport(virNodeDeviceDef *def,
virNodeDevCapType **list); virNodeDevCapType **list);

View File

@ -37,7 +37,6 @@ struct _virNodeDeviceEvent {
bool dummy; bool dummy;
}; };
typedef struct _virNodeDeviceEvent virNodeDeviceEvent; typedef struct _virNodeDeviceEvent virNodeDeviceEvent;
typedef virNodeDeviceEvent *virNodeDeviceEventPtr;
struct _virNodeDeviceEventLifecycle { struct _virNodeDeviceEventLifecycle {
virNodeDeviceEvent parent; virNodeDeviceEvent parent;
@ -46,7 +45,6 @@ struct _virNodeDeviceEventLifecycle {
int detail; int detail;
}; };
typedef struct _virNodeDeviceEventLifecycle virNodeDeviceEventLifecycle; typedef struct _virNodeDeviceEventLifecycle virNodeDeviceEventLifecycle;
typedef virNodeDeviceEventLifecycle *virNodeDeviceEventLifecyclePtr;
struct _virNodeDeviceEventUpdate { struct _virNodeDeviceEventUpdate {
virNodeDeviceEvent parent; virNodeDeviceEvent parent;
@ -54,11 +52,10 @@ struct _virNodeDeviceEventUpdate {
bool dummy; bool dummy;
}; };
typedef struct _virNodeDeviceEventUpdate virNodeDeviceEventUpdate; typedef struct _virNodeDeviceEventUpdate virNodeDeviceEventUpdate;
typedef virNodeDeviceEventUpdate *virNodeDeviceEventUpdatePtr;
static virClassPtr virNodeDeviceEventClass; static virClass *virNodeDeviceEventClass;
static virClassPtr virNodeDeviceEventLifecycleClass; static virClass *virNodeDeviceEventLifecycleClass;
static virClassPtr virNodeDeviceEventUpdateClass; static virClass *virNodeDeviceEventUpdateClass;
static void virNodeDeviceEventDispose(void *obj); static void virNodeDeviceEventDispose(void *obj);
static void virNodeDeviceEventLifecycleDispose(void *obj); static void virNodeDeviceEventLifecycleDispose(void *obj);
static void virNodeDeviceEventUpdateDispose(void *obj); static void virNodeDeviceEventUpdateDispose(void *obj);
@ -83,7 +80,7 @@ VIR_ONCE_GLOBAL_INIT(virNodeDeviceEvents);
static void static void
virNodeDeviceEventDispose(void *obj) virNodeDeviceEventDispose(void *obj)
{ {
virNodeDeviceEventPtr event = obj; virNodeDeviceEvent *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
} }
@ -91,7 +88,7 @@ virNodeDeviceEventDispose(void *obj)
static void static void
virNodeDeviceEventLifecycleDispose(void *obj) virNodeDeviceEventLifecycleDispose(void *obj)
{ {
virNodeDeviceEventLifecyclePtr event = obj; virNodeDeviceEventLifecycle *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
} }
@ -99,14 +96,14 @@ virNodeDeviceEventLifecycleDispose(void *obj)
static void static void
virNodeDeviceEventUpdateDispose(void *obj) virNodeDeviceEventUpdateDispose(void *obj)
{ {
virNodeDeviceEventUpdatePtr event = obj; virNodeDeviceEventUpdate *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
} }
static void static void
virNodeDeviceEventDispatchDefaultFunc(virConnectPtr conn, virNodeDeviceEventDispatchDefaultFunc(virConnectPtr conn,
virObjectEventPtr event, virObjectEvent *event,
virConnectObjectEventGenericCallback cb, virConnectObjectEventGenericCallback cb,
void *cbopaque) void *cbopaque)
{ {
@ -119,9 +116,9 @@ virNodeDeviceEventDispatchDefaultFunc(virConnectPtr conn,
switch ((virNodeDeviceEventID)event->eventID) { switch ((virNodeDeviceEventID)event->eventID) {
case VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE: case VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE:
{ {
virNodeDeviceEventLifecyclePtr nodeDeviceLifecycleEvent; virNodeDeviceEventLifecycle *nodeDeviceLifecycleEvent;
nodeDeviceLifecycleEvent = (virNodeDeviceEventLifecyclePtr)event; nodeDeviceLifecycleEvent = (virNodeDeviceEventLifecycle *)event;
((virConnectNodeDeviceEventLifecycleCallback)cb)(conn, dev, ((virConnectNodeDeviceEventLifecycleCallback)cb)(conn, dev,
nodeDeviceLifecycleEvent->type, nodeDeviceLifecycleEvent->type,
nodeDeviceLifecycleEvent->detail, nodeDeviceLifecycleEvent->detail,
@ -165,7 +162,7 @@ virNodeDeviceEventDispatchDefaultFunc(virConnectPtr conn,
*/ */
int int
virNodeDeviceEventStateRegisterID(virConnectPtr conn, virNodeDeviceEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNodeDevicePtr dev, virNodeDevicePtr dev,
int eventID, int eventID,
virConnectNodeDeviceEventGenericCallback cb, virConnectNodeDeviceEventGenericCallback cb,
@ -205,7 +202,7 @@ virNodeDeviceEventStateRegisterID(virConnectPtr conn,
*/ */
int int
virNodeDeviceEventStateRegisterClient(virConnectPtr conn, virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNodeDevicePtr dev, virNodeDevicePtr dev,
int eventID, int eventID,
virConnectNodeDeviceEventGenericCallback cb, virConnectNodeDeviceEventGenericCallback cb,
@ -233,12 +230,12 @@ virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
* *
* Create a new node device lifecycle event. * Create a new node device lifecycle event.
*/ */
virObjectEventPtr virObjectEvent *
virNodeDeviceEventLifecycleNew(const char *name, virNodeDeviceEventLifecycleNew(const char *name,
int type, int type,
int detail) int detail)
{ {
virNodeDeviceEventLifecyclePtr event; virNodeDeviceEventLifecycle *event;
if (virNodeDeviceEventsInitialize() < 0) if (virNodeDeviceEventsInitialize() < 0)
return NULL; return NULL;
@ -252,7 +249,7 @@ virNodeDeviceEventLifecycleNew(const char *name,
event->type = type; event->type = type;
event->detail = detail; event->detail = detail;
return (virObjectEventPtr)event; return (virObjectEvent *)event;
} }
@ -262,10 +259,10 @@ virNodeDeviceEventLifecycleNew(const char *name,
* *
* Create a new node device update event. * Create a new node device update event.
*/ */
virObjectEventPtr virObjectEvent *
virNodeDeviceEventUpdateNew(const char *name) virNodeDeviceEventUpdateNew(const char *name)
{ {
virNodeDeviceEventUpdatePtr event; virNodeDeviceEventUpdate *event;
if (virNodeDeviceEventsInitialize() < 0) if (virNodeDeviceEventsInitialize() < 0)
return NULL; return NULL;
@ -276,5 +273,5 @@ virNodeDeviceEventUpdateNew(const char *name)
0, name, NULL, name))) 0, name, NULL, name)))
return NULL; return NULL;
return (virObjectEventPtr)event; return (virObjectEvent *)event;
} }

View File

@ -28,7 +28,7 @@
int int
virNodeDeviceEventStateRegisterID(virConnectPtr conn, virNodeDeviceEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNodeDevicePtr dev, virNodeDevicePtr dev,
int eventID, int eventID,
virConnectNodeDeviceEventGenericCallback cb, virConnectNodeDeviceEventGenericCallback cb,
@ -40,7 +40,7 @@ virNodeDeviceEventStateRegisterID(virConnectPtr conn,
int int
virNodeDeviceEventStateRegisterClient(virConnectPtr conn, virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virNodeDevicePtr dev, virNodeDevicePtr dev,
int eventID, int eventID,
virConnectNodeDeviceEventGenericCallback cb, virConnectNodeDeviceEventGenericCallback cb,
@ -50,10 +50,10 @@ virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(8); ATTRIBUTE_NONNULL(8);
virObjectEventPtr virObjectEvent *
virNodeDeviceEventLifecycleNew(const char *name, virNodeDeviceEventLifecycleNew(const char *name,
int type, int type,
int detail); int detail);
virObjectEventPtr virObjectEvent *
virNodeDeviceEventUpdateNew(const char *name); virNodeDeviceEventUpdateNew(const char *name);

View File

@ -75,7 +75,7 @@ virNodeDeviceGetParentName(virConnectPtr conn,
* Returns vHBA name on success, NULL on failure with an error message set * Returns vHBA name on success, NULL on failure with an error message set
*/ */
char * char *
virNodeDeviceCreateVport(virStorageAdapterFCHostPtr fchost) virNodeDeviceCreateVport(virStorageAdapterFCHost *fchost)
{ {
unsigned int parent_host; unsigned int parent_host;
char *name = NULL; char *name = NULL;
@ -159,7 +159,7 @@ virNodeDeviceCreateVport(virStorageAdapterFCHostPtr fchost)
*/ */
int int
virNodeDeviceDeleteVport(virConnectPtr conn, virNodeDeviceDeleteVport(virConnectPtr conn,
virStorageAdapterFCHostPtr fchost) virStorageAdapterFCHost *fchost)
{ {
char *name = NULL; char *name = NULL;
char *scsi_host_name = NULL; char *scsi_host_name = NULL;

View File

@ -25,8 +25,8 @@ virNodeDeviceGetParentName(virConnectPtr conn,
const char *nodedev_name); const char *nodedev_name);
char * char *
virNodeDeviceCreateVport(virStorageAdapterFCHostPtr fchost); virNodeDeviceCreateVport(virStorageAdapterFCHost *fchost);
int int
virNodeDeviceDeleteVport(virConnectPtr conn, virNodeDeviceDeleteVport(virConnectPtr conn,
virStorageAdapterFCHostPtr fchost); virStorageAdapterFCHost *fchost);

View File

@ -82,29 +82,25 @@ VIR_ENUM_IMPL(virDomainMemoryLatency,
); );
typedef struct _virDomainNumaDistance virDomainNumaDistance; typedef struct _virDomainNumaDistance virDomainNumaDistance;
typedef virDomainNumaDistance *virDomainNumaDistancePtr;
typedef struct _virDomainNumaCache virDomainNumaCache; typedef struct _virDomainNumaCache virDomainNumaCache;
typedef virDomainNumaCache *virDomainNumaCachePtr;
typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect; typedef struct _virDomainNumaInterconnect virDomainNumaInterconnect;
typedef virDomainNumaInterconnect *virDomainNumaInterconnectPtr;
typedef struct _virDomainNumaNode virDomainNumaNode; typedef struct _virDomainNumaNode virDomainNumaNode;
typedef virDomainNumaNode *virDomainNumaNodePtr;
struct _virDomainNuma { struct _virDomainNuma {
struct { struct {
bool specified; bool specified;
virBitmapPtr nodeset; virBitmap *nodeset;
virDomainNumatuneMemMode mode; virDomainNumatuneMemMode mode;
virDomainNumatunePlacement placement; virDomainNumatunePlacement placement;
} memory; /* pinning for all the memory */ } memory; /* pinning for all the memory */
struct _virDomainNumaNode { struct _virDomainNumaNode {
unsigned long long mem; /* memory size in KiB */ unsigned long long mem; /* memory size in KiB */
virBitmapPtr cpumask; /* bitmap of vCPUs corresponding to the node */ virBitmap *cpumask; /* bitmap of vCPUs corresponding to the node */
virBitmapPtr nodeset; /* host memory nodes where this guest node resides */ virBitmap *nodeset; /* host memory nodes where this guest node resides */
virDomainNumatuneMemMode mode; /* memory mode selection */ virDomainNumatuneMemMode mode; /* memory mode selection */
virDomainMemoryAccess memAccess; /* shared memory access configuration */ virDomainMemoryAccess memAccess; /* shared memory access configuration */
virTristateBool discard; /* discard-data for memory-backend-file */ virTristateBool discard; /* discard-data for memory-backend-file */
@ -143,7 +139,7 @@ struct _virDomainNuma {
bool bool
virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune, virDomainNumatuneNodeSpecified(virDomainNuma *numatune,
int cellid) int cellid)
{ {
if (numatune && if (numatune &&
@ -155,7 +151,7 @@ virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
} }
static int static int
virDomainNumatuneNodeParseXML(virDomainNumaPtr numa, virDomainNumatuneNodeParseXML(virDomainNuma *numa,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
char *tmp = NULL; char *tmp = NULL;
@ -191,7 +187,7 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int mode = 0; int mode = 0;
unsigned int cellid = 0; unsigned int cellid = 0;
virDomainNumaNodePtr mem_node = NULL; virDomainNumaNode *mem_node = NULL;
xmlNodePtr cur_node = nodes[i]; xmlNodePtr cur_node = nodes[i];
tmp = virXMLPropString(cur_node, "cellid"); tmp = virXMLPropString(cur_node, "cellid");
@ -264,7 +260,7 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
} }
int int
virDomainNumatuneParseXML(virDomainNumaPtr numa, virDomainNumatuneParseXML(virDomainNuma *numa,
bool placement_static, bool placement_static,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
@ -273,7 +269,7 @@ virDomainNumatuneParseXML(virDomainNumaPtr numa,
int n = 0; int n = 0;
int placement = -1; int placement = -1;
int ret = -1; int ret = -1;
virBitmapPtr nodeset = NULL; virBitmap *nodeset = NULL;
xmlNodePtr node = NULL; xmlNodePtr node = NULL;
if (virXPathInt("count(./numatune)", ctxt, &n) < 0) { if (virXPathInt("count(./numatune)", ctxt, &n) < 0) {
@ -341,8 +337,8 @@ virDomainNumatuneParseXML(virDomainNumaPtr numa,
} }
int int
virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumatuneFormatXML(virBuffer *buf,
virDomainNumaPtr numatune) virDomainNuma *numatune)
{ {
const char *tmp = NULL; const char *tmp = NULL;
char *nodeset = NULL; char *nodeset = NULL;
@ -381,7 +377,7 @@ virDomainNumatuneFormatXML(virBufferPtr buf,
} }
for (i = 0; i < numatune->nmem_nodes; i++) { for (i = 0; i < numatune->nmem_nodes; i++) {
virDomainNumaNodePtr mem_node = &numatune->mem_nodes[i]; virDomainNumaNode *mem_node = &numatune->mem_nodes[i];
if (!mem_node->nodeset) if (!mem_node->nodeset)
continue; continue;
@ -403,7 +399,7 @@ virDomainNumatuneFormatXML(virBufferPtr buf,
} }
void void
virDomainNumaFree(virDomainNumaPtr numa) virDomainNumaFree(virDomainNuma *numa)
{ {
size_t i = 0; size_t i = 0;
@ -439,7 +435,7 @@ virDomainNumaFree(virDomainNumaPtr numa)
* Returns: 0 on success (with @mode updated) * Returns: 0 on success (with @mode updated)
* -1 if no mode was defined in XML * -1 if no mode was defined in XML
*/ */
int virDomainNumatuneGetMode(virDomainNumaPtr numatune, int virDomainNumatuneGetMode(virDomainNuma *numatune,
int cellid, int cellid,
virDomainNumatuneMemMode *mode) virDomainNumatuneMemMode *mode)
{ {
@ -461,9 +457,9 @@ int virDomainNumatuneGetMode(virDomainNumaPtr numatune,
return 0; return 0;
} }
virBitmapPtr virBitmap *
virDomainNumatuneGetNodeset(virDomainNumaPtr numatune, virDomainNumatuneGetNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
int cellid) int cellid)
{ {
if (!numatune) if (!numatune)
@ -483,8 +479,8 @@ virDomainNumatuneGetNodeset(virDomainNumaPtr numatune,
} }
char * char *
virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune, virDomainNumatuneFormatNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
int cellid) int cellid)
{ {
return virBitmapFormat(virDomainNumatuneGetNodeset(numatune, return virBitmapFormat(virDomainNumatuneGetNodeset(numatune,
@ -494,9 +490,9 @@ virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune,
int int
virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune, virDomainNumatuneMaybeGetNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
virBitmapPtr *retNodeset, virBitmap **retNodeset,
int cellid) int cellid)
{ {
*retNodeset = NULL; *retNodeset = NULL;
@ -524,12 +520,12 @@ virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
int int
virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune, virDomainNumatuneMaybeFormatNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
char **mask, char **mask,
int cellid) int cellid)
{ {
virBitmapPtr nodeset; virBitmap *nodeset;
if (virDomainNumatuneMaybeGetNodeset(numatune, auto_nodeset, &nodeset, if (virDomainNumatuneMaybeGetNodeset(numatune, auto_nodeset, &nodeset,
cellid) < 0) cellid) < 0)
@ -543,11 +539,11 @@ virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
} }
int int
virDomainNumatuneSet(virDomainNumaPtr numa, virDomainNumatuneSet(virDomainNuma *numa,
bool placement_static, bool placement_static,
int placement, int placement,
int mode, int mode,
virBitmapPtr nodeset) virBitmap *nodeset)
{ {
/* No need to do anything in this case */ /* No need to do anything in this case */
if (mode == -1 && placement == -1 && !nodeset) if (mode == -1 && placement == -1 && !nodeset)
@ -619,8 +615,8 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
} }
static bool static bool
virDomainNumaNodesEqual(virDomainNumaPtr n1, virDomainNumaNodesEqual(virDomainNuma *n1,
virDomainNumaPtr n2) virDomainNuma *n2)
{ {
size_t i = 0; size_t i = 0;
@ -628,8 +624,8 @@ virDomainNumaNodesEqual(virDomainNumaPtr n1,
return false; return false;
for (i = 0; i < n1->nmem_nodes; i++) { for (i = 0; i < n1->nmem_nodes; i++) {
virDomainNumaNodePtr nd1 = &n1->mem_nodes[i]; virDomainNumaNode *nd1 = &n1->mem_nodes[i];
virDomainNumaNodePtr nd2 = &n2->mem_nodes[i]; virDomainNumaNode *nd2 = &n2->mem_nodes[i];
if (!nd1->nodeset && !nd2->nodeset) if (!nd1->nodeset && !nd2->nodeset)
continue; continue;
@ -645,8 +641,8 @@ virDomainNumaNodesEqual(virDomainNumaPtr n1,
} }
bool bool
virDomainNumaEquals(virDomainNumaPtr n1, virDomainNumaEquals(virDomainNuma *n1,
virDomainNumaPtr n2) virDomainNuma *n2)
{ {
if (!n1 && !n2) if (!n1 && !n2)
return true; return true;
@ -673,7 +669,7 @@ virDomainNumaEquals(virDomainNumaPtr n1,
} }
bool bool
virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune) virDomainNumatuneHasPlacementAuto(virDomainNuma *numatune)
{ {
if (!numatune) if (!numatune)
return false; return false;
@ -688,7 +684,7 @@ virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune)
} }
bool bool
virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune) virDomainNumatuneHasPerNodeBinding(virDomainNuma *numatune)
{ {
size_t i = 0; size_t i = 0;
@ -704,10 +700,10 @@ virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune)
} }
int int
virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune) virDomainNumatuneSpecifiedMaxNode(virDomainNuma *numatune)
{ {
int ret = -1; int ret = -1;
virBitmapPtr nodemask = NULL; virBitmap *nodemask = NULL;
size_t i; size_t i;
int bit; int bit;
@ -732,11 +728,11 @@ virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune)
} }
bool bool
virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune, virDomainNumatuneNodesetIsAvailable(virDomainNuma *numatune,
virBitmapPtr auto_nodeset) virBitmap *auto_nodeset)
{ {
size_t i = 0; size_t i = 0;
virBitmapPtr b = NULL; virBitmap *b = NULL;
if (!numatune) if (!numatune)
return true; return true;
@ -756,7 +752,7 @@ virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
static int static int
virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def, virDomainNumaDefNodeDistanceParseXML(virDomainNuma *def,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int cur_cell) unsigned int cur_cell)
{ {
@ -780,8 +776,8 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def,
} }
for (i = 0; i < sibling; i++) { for (i = 0; i < sibling; i++) {
virDomainNumaDistancePtr ldist; virDomainNumaDistance *ldist;
virDomainNumaDistancePtr rdist; virDomainNumaDistance *rdist;
unsigned int sibling_id, sibling_value; unsigned int sibling_id, sibling_value;
/* siblings are in order of parsing or explicitly numbered */ /* siblings are in order of parsing or explicitly numbered */
@ -893,7 +889,7 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def,
static int static int
virDomainNumaDefNodeCacheParseXML(virDomainNumaPtr def, virDomainNumaDefNodeCacheParseXML(virDomainNuma *def,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
unsigned int cur_cell) unsigned int cur_cell)
{ {
@ -908,7 +904,7 @@ virDomainNumaDefNodeCacheParseXML(virDomainNumaPtr def,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
VIR_XPATH_NODE_AUTORESTORE(ctxt) VIR_XPATH_NODE_AUTORESTORE(ctxt)
virDomainNumaCachePtr cache = &def->mem_nodes[cur_cell].caches[i]; virDomainNumaCache *cache = &def->mem_nodes[cur_cell].caches[i];
g_autofree char *tmp = NULL; g_autofree char *tmp = NULL;
unsigned int level; unsigned int level;
int associativity; int associativity;
@ -983,7 +979,7 @@ virDomainNumaDefNodeCacheParseXML(virDomainNumaPtr def,
int int
virDomainNumaDefParseXML(virDomainNumaPtr def, virDomainNumaDefParseXML(virDomainNuma *def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
@ -1208,8 +1204,8 @@ virDomainNumaDefParseXML(virDomainNumaPtr def,
int int
virDomainNumaDefFormatXML(virBufferPtr buf, virDomainNumaDefFormatXML(virBuffer *buf,
virDomainNumaPtr def) virDomainNuma *def)
{ {
virDomainMemoryAccess memAccess; virDomainMemoryAccess memAccess;
virTristateBool discard; virTristateBool discard;
@ -1222,7 +1218,7 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAddLit(buf, "<numa>\n"); virBufferAddLit(buf, "<numa>\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (i = 0; i < ncells; i++) { for (i = 0; i < ncells; i++) {
virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(def, i); virBitmap *cpumask = virDomainNumaGetNodeCpumask(def, i);
int ndistances; int ndistances;
size_t ncaches; size_t ncaches;
@ -1261,7 +1257,7 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
if (ndistances) { if (ndistances) {
virDomainNumaDistancePtr distances = def->mem_nodes[i].distances; virDomainNumaDistance *distances = def->mem_nodes[i].distances;
virBufferAddLit(buf, "<distances>\n"); virBufferAddLit(buf, "<distances>\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
@ -1278,7 +1274,7 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
} }
for (j = 0; j < ncaches; j++) { for (j = 0; j < ncaches; j++) {
virDomainNumaCachePtr cache = &def->mem_nodes[i].caches[j]; virDomainNumaCache *cache = &def->mem_nodes[i].caches[j];
virBufferAsprintf(buf, "<cache level='%u'", cache->level); virBufferAsprintf(buf, "<cache level='%u'", cache->level);
if (cache->associativity) { if (cache->associativity) {
@ -1317,7 +1313,7 @@ virDomainNumaDefFormatXML(virBufferPtr buf,
} }
for (i = 0; i < def->ninterconnects; i++) { for (i = 0; i < def->ninterconnects; i++) {
virDomainNumaInterconnectPtr l = &def->interconnects[i]; virDomainNumaInterconnect *l = &def->interconnects[i];
switch (l->type) { switch (l->type) {
case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY: case VIR_DOMAIN_NUMA_INTERCONNECT_TYPE_LATENCY:
@ -1459,13 +1455,13 @@ virDomainNumaDefValidate(const virDomainNuma *def)
unsigned int unsigned int
virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa) virDomainNumaGetCPUCountTotal(virDomainNuma *numa)
{ {
size_t i; size_t i;
unsigned int ret = 0; unsigned int ret = 0;
for (i = 0; i < numa->nmem_nodes; i++) { for (i = 0; i < numa->nmem_nodes; i++) {
virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i); virBitmap *cpumask = virDomainNumaGetNodeCpumask(numa, i);
if (cpumask) if (cpumask)
ret += virBitmapCountBits(cpumask); ret += virBitmapCountBits(cpumask);
@ -1475,13 +1471,13 @@ virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
} }
unsigned int unsigned int
virDomainNumaGetMaxCPUID(virDomainNumaPtr numa) virDomainNumaGetMaxCPUID(virDomainNuma *numa)
{ {
size_t i; size_t i;
unsigned int ret = 0; unsigned int ret = 0;
for (i = 0; i < numa->nmem_nodes; i++) { for (i = 0; i < numa->nmem_nodes; i++) {
virBitmapPtr cpumask = virDomainNumaGetNodeCpumask(numa, i); virBitmap *cpumask = virDomainNumaGetNodeCpumask(numa, i);
int bit; int bit;
if (cpumask) { if (cpumask) {
@ -1495,7 +1491,7 @@ virDomainNumaGetMaxCPUID(virDomainNumaPtr numa)
} }
virDomainNumaPtr virDomainNuma *
virDomainNumaNew(void) virDomainNumaNew(void)
{ {
return g_new0(virDomainNuma, 1); return g_new0(virDomainNuma, 1);
@ -1503,8 +1499,8 @@ virDomainNumaNew(void)
bool bool
virDomainNumaCheckABIStability(virDomainNumaPtr src, virDomainNumaCheckABIStability(virDomainNuma *src,
virDomainNumaPtr tgt) virDomainNuma *tgt)
{ {
size_t i; size_t i;
size_t j; size_t j;
@ -1554,7 +1550,7 @@ virDomainNumaCheckABIStability(virDomainNumaPtr src,
size_t size_t
virDomainNumaGetNodeCount(virDomainNumaPtr numa) virDomainNumaGetNodeCount(virDomainNuma *numa)
{ {
if (!numa) if (!numa)
return 0; return 0;
@ -1564,7 +1560,7 @@ virDomainNumaGetNodeCount(virDomainNumaPtr numa)
size_t size_t
virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes) virDomainNumaSetNodeCount(virDomainNuma *numa, size_t nmem_nodes)
{ {
if (!nmem_nodes) { if (!nmem_nodes) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -1587,7 +1583,7 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes)
bool bool
virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa, virDomainNumaNodeDistanceIsUsingDefaults(virDomainNuma *numa,
size_t node, size_t node,
size_t sibling) size_t sibling)
{ {
@ -1607,7 +1603,7 @@ virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa,
bool bool
virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa) virDomainNumaNodesDistancesAreBeingSet(virDomainNuma *numa)
{ {
size_t ncells = virDomainNumaGetNodeCount(numa); size_t ncells = virDomainNumaGetNodeCount(numa);
size_t i, j; size_t i, j;
@ -1626,11 +1622,11 @@ virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa)
size_t size_t
virDomainNumaGetNodeDistance(virDomainNumaPtr numa, virDomainNumaGetNodeDistance(virDomainNuma *numa,
size_t node, size_t node,
size_t cellid) size_t cellid)
{ {
virDomainNumaDistancePtr distances = NULL; virDomainNumaDistance *distances = NULL;
if (node < numa->nmem_nodes) if (node < numa->nmem_nodes)
distances = numa->mem_nodes[node].distances; distances = numa->mem_nodes[node].distances;
@ -1650,12 +1646,12 @@ virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
int int
virDomainNumaSetNodeDistance(virDomainNumaPtr numa, virDomainNumaSetNodeDistance(virDomainNuma *numa,
size_t node, size_t node,
size_t cellid, size_t cellid,
unsigned int value) unsigned int value)
{ {
virDomainNumaDistancePtr distances; virDomainNumaDistance *distances;
if (node >= numa->nmem_nodes) { if (node >= numa->nmem_nodes) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
@ -1704,11 +1700,11 @@ virDomainNumaSetNodeDistance(virDomainNumaPtr numa,
size_t size_t
virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa, virDomainNumaSetNodeDistanceCount(virDomainNuma *numa,
size_t node, size_t node,
size_t ndistances) size_t ndistances)
{ {
virDomainNumaDistancePtr distances; virDomainNumaDistance *distances;
distances = numa->mem_nodes[node].distances; distances = numa->mem_nodes[node].distances;
if (distances) { if (distances) {
@ -1727,8 +1723,8 @@ virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa,
} }
virBitmapPtr virBitmap *
virDomainNumaGetNodeCpumask(virDomainNumaPtr numa, virDomainNumaGetNodeCpumask(virDomainNuma *numa,
size_t node) size_t node)
{ {
return numa->mem_nodes[node].cpumask; return numa->mem_nodes[node].cpumask;
@ -1736,16 +1732,16 @@ virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
void void
virDomainNumaSetNodeCpumask(virDomainNumaPtr numa, virDomainNumaSetNodeCpumask(virDomainNuma *numa,
size_t node, size_t node,
virBitmapPtr cpumask) virBitmap *cpumask)
{ {
numa->mem_nodes[node].cpumask = cpumask; numa->mem_nodes[node].cpumask = cpumask;
} }
virDomainMemoryAccess virDomainMemoryAccess
virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa, virDomainNumaGetNodeMemoryAccessMode(virDomainNuma *numa,
size_t node) size_t node)
{ {
return numa->mem_nodes[node].memAccess; return numa->mem_nodes[node].memAccess;
@ -1753,7 +1749,7 @@ virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
virTristateBool virTristateBool
virDomainNumaGetNodeDiscard(virDomainNumaPtr numa, virDomainNumaGetNodeDiscard(virDomainNuma *numa,
size_t node) size_t node)
{ {
return numa->mem_nodes[node].discard; return numa->mem_nodes[node].discard;
@ -1761,7 +1757,7 @@ virDomainNumaGetNodeDiscard(virDomainNumaPtr numa,
unsigned long long unsigned long long
virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa, virDomainNumaGetNodeMemorySize(virDomainNuma *numa,
size_t node) size_t node)
{ {
return numa->mem_nodes[node].mem; return numa->mem_nodes[node].mem;
@ -1769,7 +1765,7 @@ virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
void void
virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa, virDomainNumaSetNodeMemorySize(virDomainNuma *numa,
size_t node, size_t node,
unsigned long long size) unsigned long long size)
{ {
@ -1778,7 +1774,7 @@ virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
unsigned long long unsigned long long
virDomainNumaGetMemorySize(virDomainNumaPtr numa) virDomainNumaGetMemorySize(virDomainNuma *numa)
{ {
size_t i; size_t i;
unsigned long long ret = 0; unsigned long long ret = 0;
@ -1791,7 +1787,7 @@ virDomainNumaGetMemorySize(virDomainNumaPtr numa)
int int
virDomainNumaFillCPUsInNode(virDomainNumaPtr numa, virDomainNumaFillCPUsInNode(virDomainNuma *numa,
size_t node, size_t node,
unsigned int maxCpus) unsigned int maxCpus)
{ {
@ -1804,7 +1800,7 @@ virDomainNumaFillCPUsInNode(virDomainNumaPtr numa,
virBitmapSetAll(maxCPUsBitmap); virBitmapSetAll(maxCPUsBitmap);
for (i = 0; i < numa->nmem_nodes; i++) { for (i = 0; i < numa->nmem_nodes; i++) {
virBitmapPtr nodeCpus = virDomainNumaGetNodeCpumask(numa, i); virBitmap *nodeCpus = virDomainNumaGetNodeCpumask(numa, i);
if (i == node || !nodeCpus) if (i == node || !nodeCpus)
continue; continue;

View File

@ -29,7 +29,6 @@
typedef struct _virDomainNuma virDomainNuma; typedef struct _virDomainNuma virDomainNuma;
typedef virDomainNuma *virDomainNumaPtr;
typedef enum { typedef enum {
VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0, VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
@ -85,142 +84,142 @@ typedef enum {
VIR_ENUM_DECL(virDomainMemoryLatency); VIR_ENUM_DECL(virDomainMemoryLatency);
virDomainNumaPtr virDomainNumaNew(void); virDomainNuma *virDomainNumaNew(void);
void virDomainNumaFree(virDomainNumaPtr numa); void virDomainNumaFree(virDomainNuma *numa);
/* /*
* XML Parse/Format functions * XML Parse/Format functions
*/ */
int virDomainNumatuneParseXML(virDomainNumaPtr numa, int virDomainNumatuneParseXML(virDomainNuma *numa,
bool placement_static, bool placement_static,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune) int virDomainNumatuneFormatXML(virBuffer *buf, virDomainNuma *numatune)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
/* /*
* Getters * Getters
*/ */
int virDomainNumatuneGetMode(virDomainNumaPtr numatune, int virDomainNumatuneGetMode(virDomainNuma *numatune,
int cellid, int cellid,
virDomainNumatuneMemMode *mode); virDomainNumatuneMemMode *mode);
virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumaPtr numatune, virBitmap *virDomainNumatuneGetNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
int cellid); int cellid);
int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune, int virDomainNumatuneMaybeGetNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
virBitmapPtr *retNodeset, virBitmap **retNodeset,
int cellid); int cellid);
size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa); size_t virDomainNumaGetNodeCount(virDomainNuma *numa);
bool virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa, bool virDomainNumaNodeDistanceIsUsingDefaults(virDomainNuma *numa,
size_t node, size_t node,
size_t sibling) size_t sibling)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
bool virDomainNumaNodesDistancesAreBeingSet(virDomainNumaPtr numa) bool virDomainNumaNodesDistancesAreBeingSet(virDomainNuma *numa)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, size_t virDomainNumaGetNodeDistance(virDomainNuma *numa,
size_t node, size_t node,
size_t sibling) size_t sibling)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa, virBitmap *virDomainNumaGetNodeCpumask(virDomainNuma *numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa, virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNuma *numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virTristateBool virDomainNumaGetNodeDiscard(virDomainNumaPtr numa, virTristateBool virDomainNumaGetNodeDiscard(virDomainNuma *numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa, unsigned long long virDomainNumaGetNodeMemorySize(virDomainNuma *numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa) unsigned long long virDomainNumaGetMemorySize(virDomainNuma *numa)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
unsigned int unsigned int
virDomainNumaGetMaxCPUID(virDomainNumaPtr numa); virDomainNumaGetMaxCPUID(virDomainNuma *numa);
/* /*
* Formatters * Formatters
*/ */
char *virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune, char *virDomainNumatuneFormatNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
int cellid); int cellid);
int virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune, int virDomainNumatuneMaybeFormatNodeset(virDomainNuma *numatune,
virBitmapPtr auto_nodeset, virBitmap *auto_nodeset,
char **mask, char **mask,
int cellid); int cellid);
/* /*
* Setters * Setters
*/ */
int virDomainNumatuneSet(virDomainNumaPtr numa, int virDomainNumatuneSet(virDomainNuma *numa,
bool placement_static, bool placement_static,
int placement, int placement,
int mode, int mode,
virBitmapPtr nodeset) virBitmap *nodeset)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
size_t virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t virDomainNumaSetNodeCount(virDomainNuma *numa,
size_t nmem_nodes) size_t nmem_nodes)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa, void virDomainNumaSetNodeMemorySize(virDomainNuma *numa,
size_t node, size_t node,
unsigned long long size) unsigned long long size)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainNumaSetNodeDistance(virDomainNumaPtr numa, int virDomainNumaSetNodeDistance(virDomainNuma *numa,
size_t node, size_t node,
size_t sibling, size_t sibling,
unsigned int value) unsigned int value)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
size_t virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa, size_t virDomainNumaSetNodeDistanceCount(virDomainNuma *numa,
size_t node, size_t node,
size_t ndistances) size_t ndistances)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void virDomainNumaSetNodeCpumask(virDomainNumaPtr numa, void virDomainNumaSetNodeCpumask(virDomainNuma *numa,
size_t node, size_t node,
virBitmapPtr cpumask) virBitmap *cpumask)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
/* /*
* Other accessors * Other accessors
*/ */
bool virDomainNumaEquals(virDomainNumaPtr n1, bool virDomainNumaEquals(virDomainNuma *n1,
virDomainNumaPtr n2); virDomainNuma *n2);
bool virDomainNumaCheckABIStability(virDomainNumaPtr src, bool virDomainNumaCheckABIStability(virDomainNuma *src,
virDomainNumaPtr tgt); virDomainNuma *tgt);
bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune); bool virDomainNumatuneHasPlacementAuto(virDomainNuma *numatune);
bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune); bool virDomainNumatuneHasPerNodeBinding(virDomainNuma *numatune);
int virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune); int virDomainNumatuneSpecifiedMaxNode(virDomainNuma *numatune);
bool virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune, bool virDomainNumatuneNodesetIsAvailable(virDomainNuma *numatune,
virBitmapPtr auto_nodeset); virBitmap *auto_nodeset);
bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune, bool virDomainNumatuneNodeSpecified(virDomainNuma *numatune,
int cellid); int cellid);
int virDomainNumaDefParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt); int virDomainNumaDefParseXML(virDomainNuma *def, xmlXPathContextPtr ctxt);
int virDomainNumaDefFormatXML(virBufferPtr buf, virDomainNumaPtr def); int virDomainNumaDefFormatXML(virBuffer *buf, virDomainNuma *def);
int virDomainNumaDefValidate(const virDomainNuma *def); int virDomainNumaDefValidate(const virDomainNuma *def);
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa); unsigned int virDomainNumaGetCPUCountTotal(virDomainNuma *numa);
int virDomainNumaFillCPUsInNode(virDomainNumaPtr numa, size_t node, int virDomainNumaFillCPUsInNode(virDomainNuma *numa, size_t node,
unsigned int maxCpus); unsigned int maxCpus);
bool virDomainNumaHasHMAT(const virDomainNuma *numa); bool virDomainNumaHasHMAT(const virDomainNuma *numa);

View File

@ -299,7 +299,7 @@ intMapGetByString(const struct int_map *intmap,
void void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) virNWFilterRuleDefFree(virNWFilterRuleDef *def)
{ {
size_t i; size_t i;
if (!def) if (!def)
@ -319,7 +319,7 @@ virNWFilterRuleDefFree(virNWFilterRuleDefPtr def)
static void static void
virNWFilterIncludeDefFree(virNWFilterIncludeDefPtr inc) virNWFilterIncludeDefFree(virNWFilterIncludeDef *inc)
{ {
if (!inc) if (!inc)
return; return;
@ -330,7 +330,7 @@ virNWFilterIncludeDefFree(virNWFilterIncludeDefPtr inc)
static void static void
virNWFilterEntryFree(virNWFilterEntryPtr entry) virNWFilterEntryFree(virNWFilterEntry *entry)
{ {
if (!entry) if (!entry)
return; return;
@ -342,7 +342,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry)
void void
virNWFilterDefFree(virNWFilterDefPtr def) virNWFilterDefFree(virNWFilterDef *def)
{ {
size_t i; size_t i;
if (!def) if (!def)
@ -361,12 +361,12 @@ virNWFilterDefFree(virNWFilterDefPtr def)
static int static int
virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf, virNWFilterRuleDefAddVar(virNWFilterRuleDef *nwf,
nwItemDesc *item, nwItemDesc *item,
const char *var) const char *var)
{ {
size_t i = 0; size_t i = 0;
virNWFilterVarAccessPtr varAccess; virNWFilterVarAccess *varAccess;
varAccess = virNWFilterVarAccessParse(var); varAccess = virNWFilterVarAccessParse(var);
if (varAccess == NULL) if (varAccess == NULL)
@ -390,7 +390,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf,
static char * static char *
virNWFilterRuleDefAddString(virNWFilterRuleDefPtr nwf, virNWFilterRuleDefAddString(virNWFilterRuleDef *nwf,
const char *string, const char *string,
size_t maxstrlen) size_t maxstrlen)
{ {
@ -412,10 +412,10 @@ union data {
}; };
typedef bool (*valueValidator)(enum attrDatatype datatype, union data *valptr, typedef bool (*valueValidator)(enum attrDatatype datatype, union data *valptr,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item); nwItemDesc *item);
typedef bool (*valueFormatter)(virBufferPtr buf, typedef bool (*valueFormatter)(virBuffer *buf,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item); nwItemDesc *item);
typedef struct _virXMLAttr2Struct virXMLAttr2Struct; typedef struct _virXMLAttr2Struct virXMLAttr2Struct;
@ -443,7 +443,7 @@ static const struct int_map macProtoMap[] = {
static bool static bool
checkMacProtocolID(enum attrDatatype datatype, checkMacProtocolID(enum attrDatatype datatype,
union data *value, union data *value,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
int32_t res = -1; int32_t res = -1;
@ -470,8 +470,8 @@ checkMacProtocolID(enum attrDatatype datatype,
static bool static bool
macProtocolIDFormatter(virBufferPtr buf, macProtocolIDFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
const char *str = NULL; const char *str = NULL;
@ -494,7 +494,7 @@ macProtocolIDFormatter(virBufferPtr buf,
static bool static bool
checkVlanVlanID(enum attrDatatype datatype, checkVlanVlanID(enum attrDatatype datatype,
union data *value, union data *value,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
int32_t res; int32_t res;
@ -516,7 +516,7 @@ checkVlanVlanID(enum attrDatatype datatype,
static bool static bool
checkVlanProtocolID(enum attrDatatype datatype, checkVlanProtocolID(enum attrDatatype datatype,
union data *value, union data *value,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
int32_t res = -1; int32_t res = -1;
@ -543,8 +543,8 @@ checkVlanProtocolID(enum attrDatatype datatype,
static bool static bool
vlanProtocolIDFormatter(virBufferPtr buf, vlanProtocolIDFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
const char *str = NULL; const char *str = NULL;
@ -597,7 +597,7 @@ checkValidMask(unsigned char *data,
static bool static bool
checkMACMask(enum attrDatatype datatype G_GNUC_UNUSED, checkMACMask(enum attrDatatype datatype G_GNUC_UNUSED,
union data *macMask, union data *macMask,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
return checkValidMask(macMask->uc, 6); return checkValidMask(macMask->uc, 6);
@ -624,7 +624,7 @@ static const struct int_map arpOpcodeMap[] = {
static bool static bool
arpOpcodeValidator(enum attrDatatype datatype, arpOpcodeValidator(enum attrDatatype datatype,
union data *value, union data *value,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
int32_t res = -1; int32_t res = -1;
@ -648,8 +648,8 @@ arpOpcodeValidator(enum attrDatatype datatype,
static bool static bool
arpOpcodeFormatter(virBufferPtr buf, arpOpcodeFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
const char *str = NULL; const char *str = NULL;
@ -686,7 +686,7 @@ static const struct int_map ipProtoMap[] = {
static bool static bool
checkIPProtocolID(enum attrDatatype datatype, checkIPProtocolID(enum attrDatatype datatype,
union data *value, union data *value,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
int32_t res = -1; int32_t res = -1;
@ -710,8 +710,8 @@ checkIPProtocolID(enum attrDatatype datatype,
static bool static bool
formatIPProtocolID(virBufferPtr buf, formatIPProtocolID(virBuffer *buf,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
const char *str = NULL; const char *str = NULL;
@ -734,7 +734,7 @@ formatIPProtocolID(virBufferPtr buf,
static bool static bool
dscpValidator(enum attrDatatype datatype, dscpValidator(enum attrDatatype datatype,
union data *val, union data *val,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item G_GNUC_UNUSED) nwItemDesc *item G_GNUC_UNUSED)
{ {
uint8_t dscp = val->ui; uint8_t dscp = val->ui;
@ -793,7 +793,7 @@ parseStringItems(const struct int_map *int_map,
static int static int
printStringItems(virBufferPtr buf, printStringItems(virBuffer *buf,
const struct int_map *int_map, const struct int_map *int_map,
int32_t flags, int32_t flags,
const char *sep) const char *sep)
@ -837,7 +837,7 @@ parseStateMatch(const char *statematch,
void void
virNWFilterPrintStateMatchFlags(virBufferPtr buf, virNWFilterPrintStateMatchFlags(virBuffer *buf,
const char *prefix, const char *prefix,
int32_t flags, int32_t flags,
bool disp_none) bool disp_none)
@ -854,7 +854,7 @@ virNWFilterPrintStateMatchFlags(virBufferPtr buf,
static bool static bool
stateValidator(enum attrDatatype datatype G_GNUC_UNUSED, stateValidator(enum attrDatatype datatype G_GNUC_UNUSED,
union data *val, union data *val,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
nwItemDesc *item) nwItemDesc *item)
{ {
char *input = val->c; char *input = val->c;
@ -873,8 +873,8 @@ stateValidator(enum attrDatatype datatype G_GNUC_UNUSED,
static bool static bool
stateFormatter(virBufferPtr buf, stateFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
virNWFilterPrintStateMatchFlags(buf, "", item->u.u16, true); virNWFilterPrintStateMatchFlags(buf, "", item->u.u16, true);
@ -899,7 +899,7 @@ static const struct int_map tcpFlags[] = {
static bool static bool
tcpFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED, tcpFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED,
union data *val, union data *val,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
bool rc = false; bool rc = false;
@ -929,7 +929,7 @@ tcpFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED,
static void static void
printTCPFlags(virBufferPtr buf, printTCPFlags(virBuffer *buf,
uint8_t flags) uint8_t flags)
{ {
if (flags == 0) if (flags == 0)
@ -951,8 +951,8 @@ virNWFilterPrintTCPFlags(uint8_t flags)
static bool static bool
tcpFlagsFormatter(virBufferPtr buf, tcpFlagsFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
printTCPFlags(buf, item->u.tcpFlags.mask); printTCPFlags(buf, item->u.tcpFlags.mask);
@ -966,7 +966,7 @@ tcpFlagsFormatter(virBufferPtr buf,
static bool static bool
ipsetValidator(enum attrDatatype datatype G_GNUC_UNUSED, ipsetValidator(enum attrDatatype datatype G_GNUC_UNUSED,
union data *val, union data *val,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
const char *errmsg = NULL; const char *errmsg = NULL;
@ -992,8 +992,8 @@ ipsetValidator(enum attrDatatype datatype G_GNUC_UNUSED,
static bool static bool
ipsetFormatter(virBufferPtr buf, ipsetFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
virBufferAdd(buf, item->u.ipset.setname, -1); virBufferAdd(buf, item->u.ipset.setname, -1);
@ -1005,7 +1005,7 @@ ipsetFormatter(virBufferPtr buf,
static bool static bool
ipsetFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED, ipsetFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED,
union data *val, union data *val,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
const char *errmsg = NULL; const char *errmsg = NULL;
@ -1042,8 +1042,8 @@ ipsetFlagsValidator(enum attrDatatype datatype G_GNUC_UNUSED,
static bool static bool
ipsetFlagsFormatter(virBufferPtr buf, ipsetFlagsFormatter(virBuffer *buf,
virNWFilterRuleDefPtr nwf G_GNUC_UNUSED, virNWFilterRuleDef *nwf G_GNUC_UNUSED,
nwItemDesc *item) nwItemDesc *item)
{ {
uint8_t ctr; uint8_t ctr;
@ -1794,7 +1794,7 @@ static const virAttributes virAttr[] = {
static int static int
virNWFilterRuleDetailsParse(xmlNodePtr node, virNWFilterRuleDetailsParse(xmlNodePtr node,
virNWFilterRuleDefPtr nwf, virNWFilterRuleDef *nwf,
const virXMLAttr2Struct *att) const virXMLAttr2Struct *att)
{ {
int rc = 0, g_rc = 0; int rc = 0, g_rc = 0;
@ -2060,10 +2060,10 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
} }
static virNWFilterIncludeDefPtr static virNWFilterIncludeDef *
virNWFilterIncludeParse(xmlNodePtr cur) virNWFilterIncludeParse(xmlNodePtr cur)
{ {
virNWFilterIncludeDefPtr ret; virNWFilterIncludeDef *ret;
ret = g_new0(virNWFilterIncludeDef, 1); ret = g_new0(virNWFilterIncludeDef, 1);
@ -2088,7 +2088,7 @@ virNWFilterIncludeParse(xmlNodePtr cur)
static void static void
virNWFilterRuleDefFixupIPSet(ipHdrDataDefPtr ipHdr) virNWFilterRuleDefFixupIPSet(ipHdrDataDef *ipHdr)
{ {
if (HAS_ENTRY_ITEM(&ipHdr->dataIPSet) && if (HAS_ENTRY_ITEM(&ipHdr->dataIPSet) &&
!HAS_ENTRY_ITEM(&ipHdr->dataIPSetFlags)) { !HAS_ENTRY_ITEM(&ipHdr->dataIPSetFlags)) {
@ -2109,11 +2109,11 @@ virNWFilterRuleDefFixupIPSet(ipHdrDataDefPtr ipHdr)
* defined that cannot be instantiated. * defined that cannot be instantiated.
*/ */
static int static int
virNWFilterRuleValidate(virNWFilterRuleDefPtr rule) virNWFilterRuleValidate(virNWFilterRuleDef *rule)
{ {
int ret = 0; int ret = 0;
portDataDefPtr portData = NULL; portDataDef *portData = NULL;
nwItemDescPtr dataProtocolID = NULL; nwItemDesc *dataProtocolID = NULL;
const char *protocol = NULL; const char *protocol = NULL;
switch (rule->prtclType) { switch (rule->prtclType) {
@ -2189,7 +2189,7 @@ virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
static void static void
virNWFilterRuleDefFixup(virNWFilterRuleDefPtr rule) virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
{ {
#define COPY_NEG_SIGN(A, B) \ #define COPY_NEG_SIGN(A, B) \
(A).flags = ((A).flags & ~NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) | \ (A).flags = ((A).flags & ~NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) | \
@ -2404,7 +2404,7 @@ virNWFilterRuleDefFixup(virNWFilterRuleDefPtr rule)
} }
static virNWFilterRuleDefPtr static virNWFilterRuleDef *
virNWFilterRuleParse(xmlNodePtr node) virNWFilterRuleParse(xmlNodePtr node)
{ {
char *action; char *action;
@ -2416,7 +2416,7 @@ virNWFilterRuleParse(xmlNodePtr node)
int priority; int priority;
xmlNodePtr cur; xmlNodePtr cur;
virNWFilterRuleDefPtr ret; virNWFilterRuleDef *ret;
ret = g_new0(virNWFilterRuleDef, 1); ret = g_new0(virNWFilterRuleDef, 1);
@ -2598,15 +2598,15 @@ virNWFilterIsAllowedChain(const char *chainname)
} }
static virNWFilterDefPtr static virNWFilterDef *
virNWFilterDefParseXML(xmlXPathContextPtr ctxt) virNWFilterDefParseXML(xmlXPathContextPtr ctxt)
{ {
virNWFilterDefPtr ret; virNWFilterDef *ret;
xmlNodePtr curr = ctxt->node; xmlNodePtr curr = ctxt->node;
char *uuid = NULL; char *uuid = NULL;
char *chain = NULL; char *chain = NULL;
char *chain_pri_s = NULL; char *chain_pri_s = NULL;
virNWFilterEntryPtr entry; virNWFilterEntry *entry;
int chain_priority; int chain_priority;
const char *name_prefix; const char *name_prefix;
@ -2722,7 +2722,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt)
} }
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseNode(xmlDocPtr xml, virNWFilterDefParseNode(xmlDocPtr xml,
xmlNodePtr root) xmlNodePtr root)
{ {
@ -2743,11 +2743,11 @@ virNWFilterDefParseNode(xmlDocPtr xml,
} }
static virNWFilterDefPtr static virNWFilterDef *
virNWFilterDefParse(const char *xmlStr, virNWFilterDefParse(const char *xmlStr,
const char *filename) const char *filename)
{ {
virNWFilterDefPtr def = NULL; virNWFilterDef *def = NULL;
xmlDocPtr xml; xmlDocPtr xml;
if ((xml = virXMLParse(filename, xmlStr, _("(nwfilter_definition)")))) { if ((xml = virXMLParse(filename, xmlStr, _("(nwfilter_definition)")))) {
@ -2759,14 +2759,14 @@ virNWFilterDefParse(const char *xmlStr,
} }
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseString(const char *xmlStr) virNWFilterDefParseString(const char *xmlStr)
{ {
return virNWFilterDefParse(xmlStr, NULL); return virNWFilterDefParse(xmlStr, NULL);
} }
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseFile(const char *filename) virNWFilterDefParseFile(const char *filename)
{ {
return virNWFilterDefParse(NULL, filename); return virNWFilterDefParse(NULL, filename);
@ -2775,7 +2775,7 @@ virNWFilterDefParseFile(const char *filename)
int int
virNWFilterSaveConfig(const char *configDir, virNWFilterSaveConfig(const char *configDir,
virNWFilterDefPtr def) virNWFilterDef *def)
{ {
int ret = -1; int ret = -1;
char *xml; char *xml;
@ -2802,7 +2802,7 @@ virNWFilterSaveConfig(const char *configDir,
int int
virNWFilterDeleteDef(const char *configDir, virNWFilterDeleteDef(const char *configDir,
virNWFilterDefPtr def) virNWFilterDef *def)
{ {
int ret = -1; int ret = -1;
char *configFile = NULL; char *configFile = NULL;
@ -2825,8 +2825,8 @@ virNWFilterDeleteDef(const char *configDir,
static void static void
virNWIPAddressFormat(virBufferPtr buf, virNWIPAddressFormat(virBuffer *buf,
virSocketAddrPtr ipaddr) virSocketAddr *ipaddr)
{ {
char *output = virSocketAddrFormat(ipaddr); char *output = virSocketAddrFormat(ipaddr);
@ -2838,10 +2838,10 @@ virNWIPAddressFormat(virBufferPtr buf,
static void static void
virNWFilterRuleDefDetailsFormat(virBufferPtr buf, virNWFilterRuleDefDetailsFormat(virBuffer *buf,
const char *type, const char *type,
const virXMLAttr2Struct *att, const virXMLAttr2Struct *att,
virNWFilterRuleDefPtr def) virNWFilterRuleDef *def)
{ {
size_t i = 0, j; size_t i = 0, j;
bool typeShown = false; bool typeShown = false;
@ -2985,8 +2985,8 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
static int static int
virNWFilterRuleDefFormat(virBufferPtr buf, virNWFilterRuleDefFormat(virBuffer *buf,
virNWFilterRuleDefPtr def) virNWFilterRuleDef *def)
{ {
size_t i; size_t i;
bool subelement = false; bool subelement = false;
@ -3025,8 +3025,8 @@ virNWFilterRuleDefFormat(virBufferPtr buf,
static int static int
virNWFilterEntryFormat(virBufferPtr buf, virNWFilterEntryFormat(virBuffer *buf,
virNWFilterEntryPtr entry) virNWFilterEntry *entry)
{ {
if (entry->rule) if (entry->rule)
return virNWFilterRuleDefFormat(buf, entry->rule); return virNWFilterRuleDefFormat(buf, entry->rule);
@ -3111,7 +3111,7 @@ virNWFilterTriggerRebuild(void)
bool bool
virNWFilterRuleIsProtocolIPv4(virNWFilterRuleDefPtr rule) virNWFilterRuleIsProtocolIPv4(virNWFilterRuleDef *rule)
{ {
if (rule->prtclType >= VIR_NWFILTER_RULE_PROTOCOL_TCP && if (rule->prtclType >= VIR_NWFILTER_RULE_PROTOCOL_TCP &&
rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_ALL) rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_ALL)
@ -3121,7 +3121,7 @@ virNWFilterRuleIsProtocolIPv4(virNWFilterRuleDefPtr rule)
bool bool
virNWFilterRuleIsProtocolIPv6(virNWFilterRuleDefPtr rule) virNWFilterRuleIsProtocolIPv6(virNWFilterRuleDef *rule)
{ {
if (rule->prtclType >= VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6 && if (rule->prtclType >= VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6 &&
rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6) rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6)
@ -3131,7 +3131,7 @@ virNWFilterRuleIsProtocolIPv6(virNWFilterRuleDefPtr rule)
bool bool
virNWFilterRuleIsProtocolEthernet(virNWFilterRuleDefPtr rule) virNWFilterRuleIsProtocolEthernet(virNWFilterRuleDef *rule)
{ {
if (rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_IPV6) if (rule->prtclType <= VIR_NWFILTER_RULE_PROTOCOL_IPV6)
return true; return true;

View File

@ -111,10 +111,9 @@ typedef enum attrDatatype {
typedef struct _nwItemDesc nwItemDesc; typedef struct _nwItemDesc nwItemDesc;
typedef nwItemDesc *nwItemDescPtr;
struct _nwItemDesc { struct _nwItemDesc {
virNWFilterEntryItemFlags flags; virNWFilterEntryItemFlags flags;
virNWFilterVarAccessPtr varAccess; virNWFilterVarAccess *varAccess;
enum attrDatatype datatype; enum attrDatatype datatype;
union { union {
virMacAddr macaddr; virMacAddr macaddr;
@ -141,7 +140,6 @@ struct _nwItemDesc {
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-+ " "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-+ "
typedef struct _ethHdrDataDef ethHdrDataDef; typedef struct _ethHdrDataDef ethHdrDataDef;
typedef ethHdrDataDef *ethHdrDataDefPtr;
struct _ethHdrDataDef { struct _ethHdrDataDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
nwItemDesc dataSrcMACMask; nwItemDesc dataSrcMACMask;
@ -151,7 +149,6 @@ struct _ethHdrDataDef {
typedef struct _ethHdrFilterDef ethHdrFilterDef; typedef struct _ethHdrFilterDef ethHdrFilterDef;
typedef ethHdrFilterDef *ethHdrFilterDefPtr;
struct _ethHdrFilterDef { struct _ethHdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
nwItemDesc dataProtocolID; nwItemDesc dataProtocolID;
@ -160,7 +157,6 @@ struct _ethHdrFilterDef {
typedef struct _vlanHdrFilterDef vlanHdrFilterDef; typedef struct _vlanHdrFilterDef vlanHdrFilterDef;
typedef vlanHdrFilterDef *vlanHdrFilterDefPtr;
struct _vlanHdrFilterDef { struct _vlanHdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
nwItemDesc dataVlanID; nwItemDesc dataVlanID;
@ -170,7 +166,6 @@ struct _vlanHdrFilterDef {
typedef struct _stpHdrFilterDef stpHdrFilterDef; typedef struct _stpHdrFilterDef stpHdrFilterDef;
typedef stpHdrFilterDef *stpHdrFilterDefPtr;
struct _stpHdrFilterDef { struct _stpHdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
nwItemDesc dataType; nwItemDesc dataType;
@ -200,7 +195,6 @@ struct _stpHdrFilterDef {
typedef struct _arpHdrFilterDef arpHdrFilterDef; typedef struct _arpHdrFilterDef arpHdrFilterDef;
typedef arpHdrFilterDef *arpHdrFilterDefPtr;
struct _arpHdrFilterDef { struct _arpHdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
nwItemDesc dataHWType; nwItemDesc dataHWType;
@ -218,7 +212,6 @@ struct _arpHdrFilterDef {
typedef struct _ipHdrDataDef ipHdrDataDef; typedef struct _ipHdrDataDef ipHdrDataDef;
typedef ipHdrDataDef *ipHdrDataDefPtr;
struct _ipHdrDataDef { struct _ipHdrDataDef {
nwItemDesc dataIPVersion; nwItemDesc dataIPVersion;
nwItemDesc dataSrcIPAddr; nwItemDesc dataSrcIPAddr;
@ -240,7 +233,6 @@ struct _ipHdrDataDef {
typedef struct _portDataDef portDataDef; typedef struct _portDataDef portDataDef;
typedef portDataDef *portDataDefPtr;
struct _portDataDef { struct _portDataDef {
nwItemDesc dataSrcPortStart; nwItemDesc dataSrcPortStart;
nwItemDesc dataSrcPortEnd; nwItemDesc dataSrcPortEnd;
@ -250,7 +242,6 @@ struct _portDataDef {
typedef struct _ipHdrFilterDef ipHdrFilterDef; typedef struct _ipHdrFilterDef ipHdrFilterDef;
typedef ipHdrFilterDef *ipHdrFilterDefPtr;
struct _ipHdrFilterDef { struct _ipHdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -259,7 +250,6 @@ struct _ipHdrFilterDef {
typedef struct _ipv6HdrFilterDef ipv6HdrFilterDef; typedef struct _ipv6HdrFilterDef ipv6HdrFilterDef;
typedef ipv6HdrFilterDef *ipv6HdrFilterDefPtr;
struct _ipv6HdrFilterDef { struct _ipv6HdrFilterDef {
ethHdrDataDef ethHdr; ethHdrDataDef ethHdr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -272,7 +262,6 @@ struct _ipv6HdrFilterDef {
typedef struct _icmpHdrFilterDef icmpHdrFilterDef; typedef struct _icmpHdrFilterDef icmpHdrFilterDef;
typedef icmpHdrFilterDef *icmpHdrFilterDefPtr;
struct _icmpHdrFilterDef { struct _icmpHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -283,7 +272,6 @@ struct _icmpHdrFilterDef {
typedef struct _allHdrFilterDef allHdrFilterDef; typedef struct _allHdrFilterDef allHdrFilterDef;
typedef allHdrFilterDef *allHdrFilterDefPtr;
struct _allHdrFilterDef { struct _allHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -291,7 +279,6 @@ struct _allHdrFilterDef {
typedef struct _igmpHdrFilterDef igmpHdrFilterDef; typedef struct _igmpHdrFilterDef igmpHdrFilterDef;
typedef igmpHdrFilterDef *igmpHdrFilterDefPtr;
struct _igmpHdrFilterDef { struct _igmpHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -299,7 +286,6 @@ struct _igmpHdrFilterDef {
typedef struct _tcpHdrFilterDef tcpHdrFilterDef; typedef struct _tcpHdrFilterDef tcpHdrFilterDef;
typedef tcpHdrFilterDef *tcpHdrFilterDefPtr;
struct _tcpHdrFilterDef { struct _tcpHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -310,7 +296,6 @@ struct _tcpHdrFilterDef {
typedef struct _udpHdrFilterDef udpHdrFilterDef; typedef struct _udpHdrFilterDef udpHdrFilterDef;
typedef udpHdrFilterDef *udpHdrFilterDefPtr;
struct _udpHdrFilterDef { struct _udpHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -319,7 +304,6 @@ struct _udpHdrFilterDef {
typedef struct _sctpHdrFilterDef sctpHdrFilterDef; typedef struct _sctpHdrFilterDef sctpHdrFilterDef;
typedef sctpHdrFilterDef *sctpHdrFilterDefPtr;
struct _sctpHdrFilterDef { struct _sctpHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -328,7 +312,6 @@ struct _sctpHdrFilterDef {
typedef struct _espHdrFilterDef espHdrFilterDef; typedef struct _espHdrFilterDef espHdrFilterDef;
typedef espHdrFilterDef *espHdrFilterDefPtr;
struct _espHdrFilterDef { struct _espHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -336,7 +319,6 @@ struct _espHdrFilterDef {
typedef struct _ahHdrFilterDef ahHdrFilterDef; typedef struct _ahHdrFilterDef ahHdrFilterDef;
typedef ahHdrFilterDef *ahHdrFilterDefPtr;
struct _ahHdrFilterDef { struct _ahHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -344,7 +326,6 @@ struct _ahHdrFilterDef {
typedef struct _udpliteHdrFilterDef udpliteHdrFilterDef; typedef struct _udpliteHdrFilterDef udpliteHdrFilterDef;
typedef udpliteHdrFilterDef *udpliteHdrFilterDefPtr;
struct _udpliteHdrFilterDef { struct _udpliteHdrFilterDef {
nwItemDesc dataSrcMACAddr; nwItemDesc dataSrcMACAddr;
ipHdrDataDef ipHdr; ipHdrDataDef ipHdr;
@ -457,13 +438,12 @@ typedef enum {
RULE_FLAG_STATE_INVALID | \ RULE_FLAG_STATE_INVALID | \
RULE_FLAG_STATE_NONE) RULE_FLAG_STATE_NONE)
void virNWFilterPrintStateMatchFlags(virBufferPtr buf, const char *prefix, void virNWFilterPrintStateMatchFlags(virBuffer *buf, const char *prefix,
int32_t flags, bool disp_none); int32_t flags, bool disp_none);
typedef int32_t virNWFilterRulePriority; typedef int32_t virNWFilterRulePriority;
typedef struct _virNWFilterRuleDef virNWFilterRuleDef; typedef struct _virNWFilterRuleDef virNWFilterRuleDef;
typedef virNWFilterRuleDef *virNWFilterRuleDefPtr;
struct _virNWFilterRuleDef { struct _virNWFilterRuleDef {
virNWFilterRulePriority priority; virNWFilterRulePriority priority;
virNWFilterRuleFlags flags; virNWFilterRuleFlags flags;
@ -489,7 +469,7 @@ struct _virNWFilterRuleDef {
} p; } p;
size_t nVarAccess; size_t nVarAccess;
virNWFilterVarAccessPtr *varAccess; virNWFilterVarAccess **varAccess;
size_t nstrings; size_t nstrings;
char **strings; char **strings;
@ -497,7 +477,6 @@ struct _virNWFilterRuleDef {
typedef struct _virNWFilterIncludeDef virNWFilterIncludeDef; typedef struct _virNWFilterIncludeDef virNWFilterIncludeDef;
typedef virNWFilterIncludeDef *virNWFilterIncludeDefPtr;
struct _virNWFilterIncludeDef { struct _virNWFilterIncludeDef {
char *filterref; char *filterref;
GHashTable *params; GHashTable *params;
@ -505,7 +484,6 @@ struct _virNWFilterIncludeDef {
typedef struct _virNWFilterEntry virNWFilterEntry; typedef struct _virNWFilterEntry virNWFilterEntry;
typedef virNWFilterEntry *virNWFilterEntryPtr;
struct _virNWFilterEntry { struct _virNWFilterEntry {
virNWFilterRuleDef *rule; virNWFilterRuleDef *rule;
virNWFilterIncludeDef *include; virNWFilterIncludeDef *include;
@ -530,8 +508,6 @@ typedef enum {
typedef int32_t virNWFilterChainPriority; typedef int32_t virNWFilterChainPriority;
typedef struct _virNWFilterDef virNWFilterDef; typedef struct _virNWFilterDef virNWFilterDef;
typedef virNWFilterDef *virNWFilterDefPtr;
struct _virNWFilterDef { struct _virNWFilterDef {
char *name; char *name;
unsigned char uuid[VIR_UUID_BUFLEN]; unsigned char uuid[VIR_UUID_BUFLEN];
@ -541,24 +517,24 @@ struct _virNWFilterDef {
virNWFilterChainPriority chainPriority; virNWFilterChainPriority chainPriority;
size_t nentries; size_t nentries;
virNWFilterEntryPtr *filterEntries; virNWFilterEntry **filterEntries;
}; };
void void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def); virNWFilterRuleDefFree(virNWFilterRuleDef *def);
void void
virNWFilterDefFree(virNWFilterDefPtr def); virNWFilterDefFree(virNWFilterDef *def);
int int
virNWFilterTriggerRebuild(void); virNWFilterTriggerRebuild(void);
int int
virNWFilterDeleteDef(const char *configDir, virNWFilterDeleteDef(const char *configDir,
virNWFilterDefPtr def); virNWFilterDef *def);
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseNode(xmlDocPtr xml, virNWFilterDefParseNode(xmlDocPtr xml,
xmlNodePtr root); xmlNodePtr root);
@ -567,12 +543,12 @@ virNWFilterDefFormat(const virNWFilterDef *def);
int int
virNWFilterSaveConfig(const char *configDir, virNWFilterSaveConfig(const char *configDir,
virNWFilterDefPtr def); virNWFilterDef *def);
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseString(const char *xml); virNWFilterDefParseString(const char *xml);
virNWFilterDefPtr virNWFilterDef *
virNWFilterDefParseFile(const char *filename); virNWFilterDefParseFile(const char *filename);
void void
@ -598,13 +574,13 @@ char *
virNWFilterPrintTCPFlags(uint8_t flags); virNWFilterPrintTCPFlags(uint8_t flags);
bool bool
virNWFilterRuleIsProtocolIPv4(virNWFilterRuleDefPtr rule); virNWFilterRuleIsProtocolIPv4(virNWFilterRuleDef *rule);
bool bool
virNWFilterRuleIsProtocolIPv6(virNWFilterRuleDefPtr rule); virNWFilterRuleIsProtocolIPv6(virNWFilterRuleDef *rule);
bool bool
virNWFilterRuleIsProtocolEthernet(virNWFilterRuleDefPtr rule); virNWFilterRuleIsProtocolEthernet(virNWFilterRuleDef *rule);
VIR_ENUM_DECL(virNWFilterRuleAction); VIR_ENUM_DECL(virNWFilterRuleAction);

View File

@ -51,7 +51,7 @@ virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr)
{ {
int ret = -1; int ret = -1;
char *addrCopy; char *addrCopy;
virNWFilterVarValuePtr val; virNWFilterVarValue *val;
addrCopy = g_strdup(addr); addrCopy = g_strdup(addr);
@ -100,7 +100,7 @@ int
virNWFilterIPAddrMapDelIPAddr(const char *ifname, const char *ipaddr) virNWFilterIPAddrMapDelIPAddr(const char *ifname, const char *ipaddr)
{ {
int ret = -1; int ret = -1;
virNWFilterVarValuePtr val = NULL; virNWFilterVarValue *val = NULL;
virMutexLock(&ipAddressMapLock); virMutexLock(&ipAddressMapLock);
@ -129,13 +129,13 @@ virNWFilterIPAddrMapDelIPAddr(const char *ifname, const char *ipaddr)
/* Get the list of IP addresses known to be in use by an interface /* Get the list of IP addresses known to be in use by an interface
* *
* This function returns NULL in case no IP address is known to be * This function returns NULL in case no IP address is known to be
* associated with the interface, a virNWFilterVarValuePtr otherwise * associated with the interface, a virNWFilterVarValue *otherwise
* that then can contain one or multiple entries. * that then can contain one or multiple entries.
*/ */
virNWFilterVarValuePtr virNWFilterVarValue *
virNWFilterIPAddrMapGetIPAddr(const char *ifname) virNWFilterIPAddrMapGetIPAddr(const char *ifname)
{ {
virNWFilterVarValuePtr res; virNWFilterVarValue *res;
virMutexLock(&ipAddressMapLock); virMutexLock(&ipAddressMapLock);

View File

@ -28,4 +28,4 @@ void virNWFilterIPAddrMapShutdown(void);
int virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr); int virNWFilterIPAddrMapAddIPAddr(const char *ifname, char *addr);
int virNWFilterIPAddrMapDelIPAddr(const char *ifname, int virNWFilterIPAddrMapDelIPAddr(const char *ifname,
const char *ipaddr); const char *ipaddr);
virNWFilterVarValuePtr virNWFilterIPAddrMapGetIPAddr(const char *ifname); virNWFilterVarValue *virNWFilterIPAddrMapGetIPAddr(const char *ifname);

View File

@ -36,12 +36,12 @@
VIR_LOG_INIT("conf.nwfilter_params"); VIR_LOG_INIT("conf.nwfilter_params");
static bool isValidVarValue(const char *value); static bool isValidVarValue(const char *value);
static void virNWFilterVarAccessSetIntIterId(virNWFilterVarAccessPtr, static void virNWFilterVarAccessSetIntIterId(virNWFilterVarAccess *,
unsigned int); unsigned int);
static unsigned int virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *); static unsigned int virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *);
void void
virNWFilterVarValueFree(virNWFilterVarValuePtr val) virNWFilterVarValueFree(virNWFilterVarValue *val)
{ {
size_t i; size_t i;
@ -63,10 +63,10 @@ virNWFilterVarValueFree(virNWFilterVarValuePtr val)
g_free(val); g_free(val);
} }
virNWFilterVarValuePtr virNWFilterVarValue *
virNWFilterVarValueCopy(const virNWFilterVarValue *val) virNWFilterVarValueCopy(const virNWFilterVarValue *val)
{ {
virNWFilterVarValuePtr res; virNWFilterVarValue *res;
size_t i; size_t i;
char *str; char *str;
@ -92,10 +92,10 @@ virNWFilterVarValueCopy(const virNWFilterVarValue *val)
return res; return res;
} }
virNWFilterVarValuePtr virNWFilterVarValue *
virNWFilterVarValueCreateSimple(char *value) virNWFilterVarValueCreateSimple(char *value)
{ {
virNWFilterVarValuePtr val; virNWFilterVarValue *val;
if (!isValidVarValue(value)) { if (!isValidVarValue(value)) {
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
@ -111,11 +111,11 @@ virNWFilterVarValueCreateSimple(char *value)
return val; return val;
} }
virNWFilterVarValuePtr virNWFilterVarValue *
virNWFilterVarValueCreateSimpleCopyValue(const char *value) virNWFilterVarValueCreateSimpleCopyValue(const char *value)
{ {
char *val; char *val;
virNWFilterVarValuePtr ret; virNWFilterVarValue *ret;
val = g_strdup(value); val = g_strdup(value);
ret = virNWFilterVarValueCreateSimple(val); ret = virNWFilterVarValueCreateSimple(val);
@ -203,7 +203,7 @@ virNWFilterVarValueEqual(const virNWFilterVarValue *a,
} }
int int
virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value) virNWFilterVarValueAddValue(virNWFilterVarValue *val, char *value)
{ {
char *tmp; char *tmp;
int rc = -1; int rc = -1;
@ -235,7 +235,7 @@ virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value)
int int
virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value) virNWFilterVarValueAddValueCopy(virNWFilterVarValue *val, const char *value)
{ {
char *valdup; char *valdup;
valdup = g_strdup(value); valdup = g_strdup(value);
@ -248,7 +248,7 @@ virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value)
static int static int
virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos) virNWFilterVarValueDelNthValue(virNWFilterVarValue *val, unsigned int pos)
{ {
switch (val->valType) { switch (val->valType) {
case NWFILTER_VALUE_TYPE_SIMPLE: case NWFILTER_VALUE_TYPE_SIMPLE:
@ -270,7 +270,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos)
} }
int int
virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value) virNWFilterVarValueDelValue(virNWFilterVarValue *val, const char *value)
{ {
size_t i; size_t i;
@ -292,7 +292,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
} }
void void
virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterFree(virNWFilterVarCombIter *ci)
{ {
size_t i; size_t i;
@ -308,7 +308,7 @@ virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
} }
static int static int
virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIter *ci,
unsigned int iterId) unsigned int iterId)
{ {
size_t i; size_t i;
@ -321,7 +321,7 @@ virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci,
} }
static void static void
virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie, virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntry *cie,
unsigned int iterId) unsigned int iterId)
{ {
memset(cie, 0, sizeof(*cie)); memset(cie, 0, sizeof(*cie));
@ -329,11 +329,11 @@ virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie,
} }
static int static int
virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie, virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntry *cie,
GHashTable *hash, GHashTable *hash,
const virNWFilterVarAccess *varAccess) const virNWFilterVarAccess *varAccess)
{ {
virNWFilterVarValuePtr varValue; virNWFilterVarValue *varValue;
unsigned int maxValue = 0, minValue = 0; unsigned int maxValue = 0, minValue = 0;
const char *varName = virNWFilterVarAccessGetVarName(varAccess); const char *varName = virNWFilterVarAccessGetVarName(varAccess);
@ -394,12 +394,12 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
* skip them since this pair has already been encountered in the 1st iteration * skip them since this pair has already been encountered in the 1st iteration
*/ */
static bool static bool
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie, virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntry *cie,
GHashTable *hash) GHashTable *hash)
{ {
size_t i, j; size_t i, j;
virNWFilterVarValuePtr varValue; virNWFilterVarValue *varValue;
virNWFilterVarValuePtr tmp; virNWFilterVarValue *tmp;
const char *value; const char *value;
varValue = virHashLookup(hash, cie->varNames[0]); varValue = virHashLookup(hash, cie->varNames[0]);
@ -453,12 +453,12 @@ virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
* which then would cause all combinations of the items of the two lists to * which then would cause all combinations of the items of the two lists to
* be created. * be created.
*/ */
virNWFilterVarCombIterPtr virNWFilterVarCombIter *
virNWFilterVarCombIterCreate(GHashTable *hash, virNWFilterVarCombIterCreate(GHashTable *hash,
virNWFilterVarAccessPtr *varAccess, virNWFilterVarAccess **varAccess,
size_t nVarAccess) size_t nVarAccess)
{ {
virNWFilterVarCombIterPtr res; virNWFilterVarCombIter *res;
size_t i; size_t i;
unsigned int iterId; unsigned int iterId;
int iterIndex = -1; int iterIndex = -1;
@ -510,8 +510,8 @@ virNWFilterVarCombIterCreate(GHashTable *hash,
return NULL; return NULL;
} }
virNWFilterVarCombIterPtr virNWFilterVarCombIter *
virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterNext(virNWFilterVarCombIter *ci)
{ {
size_t i; size_t i;
@ -535,14 +535,14 @@ virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci)
} }
const char * const char *
virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIter *ci,
const virNWFilterVarAccess *vap) const virNWFilterVarAccess *vap)
{ {
size_t i; size_t i;
unsigned int iterId; unsigned int iterId;
bool found = false; bool found = false;
const char *res = NULL; const char *res = NULL;
virNWFilterVarValuePtr value; virNWFilterVarValue *value;
int iterIndex = -1; int iterIndex = -1;
const char *varName = virNWFilterVarAccessGetVarName(vap); const char *varName = virNWFilterVarAccessGetVarName(vap);
@ -622,12 +622,12 @@ static int
addToTable(void *payload, const char *name, void *data) addToTable(void *payload, const char *name, void *data)
{ {
struct addToTableStruct *atts = (struct addToTableStruct *)data; struct addToTableStruct *atts = (struct addToTableStruct *)data;
virNWFilterVarValuePtr val; virNWFilterVarValue *val;
if (atts->errOccurred) if (atts->errOccurred)
return 0; return 0;
val = virNWFilterVarValueCopy((virNWFilterVarValuePtr)payload); val = virNWFilterVarValueCopy((virNWFilterVarValue *)payload);
if (!val) { if (!val) {
atts->errOccurred = 1; atts->errOccurred = 1;
return 0; return 0;
@ -689,7 +689,7 @@ isValidVarValue(const char *value)
return (value[strspn(value, VALID_VARVALUE)] == 0) && (strlen(value) != 0); return (value[strspn(value, VALID_VARVALUE)] == 0) && (strlen(value) != 0);
} }
static virNWFilterVarValuePtr static virNWFilterVarValue *
virNWFilterParseVarValue(const char *val) virNWFilterParseVarValue(const char *val)
{ {
return virNWFilterVarValueCreateSimpleCopyValue(val); return virNWFilterVarValueCreateSimpleCopyValue(val);
@ -699,7 +699,7 @@ GHashTable *
virNWFilterParseParamAttributes(xmlNodePtr cur) virNWFilterParseParamAttributes(xmlNodePtr cur)
{ {
char *nam, *val; char *nam, *val;
virNWFilterVarValuePtr value; virNWFilterVarValue *value;
GHashTable *table = virHashNew(virNWFilterVarValueHashFree); GHashTable *table = virHashNew(virNWFilterVarValueHashFree);
if (!table) if (!table)
@ -755,11 +755,11 @@ virNWFilterParseParamAttributes(xmlNodePtr cur)
int int
virNWFilterFormatParamAttributes(virBufferPtr buf, virNWFilterFormatParamAttributes(virBuffer *buf,
GHashTable *table, GHashTable *table,
const char *filterref) const char *filterref)
{ {
virHashKeyValuePairPtr items; virHashKeyValuePair *items;
size_t i, j; size_t i, j;
int card, numKeys; int card, numKeys;
@ -803,7 +803,7 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
} }
void void
virNWFilterVarAccessFree(virNWFilterVarAccessPtr varAccess) virNWFilterVarAccessFree(virNWFilterVarAccess *varAccess)
{ {
if (!varAccess) if (!varAccess)
return; return;
@ -838,11 +838,11 @@ virNWFilterVarAccessEqual(const virNWFilterVarAccess *a,
* Parse a variable access like * Parse a variable access like
* IP, IP[@2], IP[3] * IP, IP[@2], IP[3]
*/ */
virNWFilterVarAccessPtr virNWFilterVarAccess *
virNWFilterVarAccessParse(const char *varAccess) virNWFilterVarAccessParse(const char *varAccess)
{ {
size_t idx, varNameLen; size_t idx, varNameLen;
virNWFilterVarAccessPtr dest; virNWFilterVarAccess *dest;
const char *input = varAccess; const char *input = varAccess;
dest = g_new0(virNWFilterVarAccess, 1); dest = g_new0(virNWFilterVarAccess, 1);
@ -927,7 +927,7 @@ virNWFilterVarAccessParse(const char *varAccess)
} }
void void
virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap, virBufferPtr buf) virNWFilterVarAccessPrint(virNWFilterVarAccess *vap, virBuffer *buf)
{ {
virBufferAdd(buf, vap->varName, -1); virBufferAdd(buf, vap->varName, -1);
switch (vap->accessType) { switch (vap->accessType) {
@ -968,7 +968,7 @@ virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap)
} }
static void static void
virNWFilterVarAccessSetIntIterId(virNWFilterVarAccessPtr vap, virNWFilterVarAccessSetIntIterId(virNWFilterVarAccess *vap,
unsigned int intIterId) unsigned int intIterId)
{ {
vap->u.index.intIterId = intIterId; vap->u.index.intIterId = intIterId;
@ -987,7 +987,7 @@ virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
const char *varName = virNWFilterVarAccessGetVarName(varAccess); const char *varName = virNWFilterVarAccessGetVarName(varAccess);
const char *res; const char *res;
unsigned int idx; unsigned int idx;
virNWFilterVarValuePtr varValue; virNWFilterVarValue *varValue;
varValue = virHashLookup(hash, varName); varValue = virHashLookup(hash, varName);
if (!varValue) if (!varValue)

View File

@ -34,7 +34,6 @@ typedef enum {
} virNWFilterVarValueType; } virNWFilterVarValueType;
typedef struct _virNWFilterVarValue virNWFilterVarValue; typedef struct _virNWFilterVarValue virNWFilterVarValue;
typedef virNWFilterVarValue *virNWFilterVarValuePtr;
struct _virNWFilterVarValue { struct _virNWFilterVarValue {
virNWFilterVarValueType valType; virNWFilterVarValueType valType;
union { union {
@ -48,10 +47,10 @@ struct _virNWFilterVarValue {
} u; } u;
}; };
virNWFilterVarValuePtr virNWFilterVarValueCreateSimple(char *); virNWFilterVarValue *virNWFilterVarValueCreateSimple(char *);
virNWFilterVarValuePtr virNWFilterVarValueCreateSimpleCopyValue(const char *); virNWFilterVarValue *virNWFilterVarValueCreateSimpleCopyValue(const char *);
virNWFilterVarValuePtr virNWFilterVarValueCopy(const virNWFilterVarValue *); virNWFilterVarValue *virNWFilterVarValueCopy(const virNWFilterVarValue *);
void virNWFilterVarValueFree(virNWFilterVarValuePtr val); void virNWFilterVarValueFree(virNWFilterVarValue *val);
void virNWFilterVarValueHashFree(void *payload); void virNWFilterVarValueHashFree(void *payload);
const char *virNWFilterVarValueGetSimple(const virNWFilterVarValue *val); const char *virNWFilterVarValueGetSimple(const virNWFilterVarValue *val);
const char *virNWFilterVarValueGetNthValue(const virNWFilterVarValue *val, const char *virNWFilterVarValueGetNthValue(const virNWFilterVarValue *val,
@ -59,12 +58,12 @@ const char *virNWFilterVarValueGetNthValue(const virNWFilterVarValue *val,
unsigned int virNWFilterVarValueGetCardinality(const virNWFilterVarValue *); unsigned int virNWFilterVarValueGetCardinality(const virNWFilterVarValue *);
bool virNWFilterVarValueEqual(const virNWFilterVarValue *a, bool virNWFilterVarValueEqual(const virNWFilterVarValue *a,
const virNWFilterVarValue *b); const virNWFilterVarValue *b);
int virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value); int virNWFilterVarValueAddValue(virNWFilterVarValue *val, char *value);
int virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value); int virNWFilterVarValueAddValueCopy(virNWFilterVarValue *val, const char *value);
int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value); int virNWFilterVarValueDelValue(virNWFilterVarValue *val, const char *value);
GHashTable *virNWFilterParseParamAttributes(xmlNodePtr cur); GHashTable *virNWFilterParseParamAttributes(xmlNodePtr cur);
int virNWFilterFormatParamAttributes(virBufferPtr buf, int virNWFilterFormatParamAttributes(virBuffer *buf,
GHashTable *table, GHashTable *table,
const char *filterref); const char *filterref);
@ -92,7 +91,6 @@ typedef enum {
} virNWFilterVarAccessType; } virNWFilterVarAccessType;
typedef struct _virNWFilterVarAccess virNWFilterVarAccess; typedef struct _virNWFilterVarAccess virNWFilterVarAccess;
typedef virNWFilterVarAccess *virNWFilterVarAccessPtr;
struct _virNWFilterVarAccess { struct _virNWFilterVarAccess {
virNWFilterVarAccessType accessType; virNWFilterVarAccessType accessType;
union { union {
@ -107,12 +105,12 @@ struct _virNWFilterVarAccess {
#define VIR_NWFILTER_MAX_ITERID 1000 #define VIR_NWFILTER_MAX_ITERID 1000
void virNWFilterVarAccessFree(virNWFilterVarAccessPtr varAccess); void virNWFilterVarAccessFree(virNWFilterVarAccess *varAccess);
bool virNWFilterVarAccessEqual(const virNWFilterVarAccess *a, bool virNWFilterVarAccessEqual(const virNWFilterVarAccess *a,
const virNWFilterVarAccess *b); const virNWFilterVarAccess *b);
virNWFilterVarAccessPtr virNWFilterVarAccessParse(const char *varAccess); virNWFilterVarAccess *virNWFilterVarAccessParse(const char *varAccess);
void virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap, void virNWFilterVarAccessPrint(virNWFilterVarAccess *vap,
virBufferPtr buf); virBuffer *buf);
const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap); const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap);
virNWFilterVarAccessType virNWFilterVarAccessGetType( virNWFilterVarAccessType virNWFilterVarAccessGetType(
const virNWFilterVarAccess *vap); const virNWFilterVarAccess *vap);
@ -122,7 +120,6 @@ bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
GHashTable *hash); GHashTable *hash);
typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry; typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
struct _virNWFilterVarCombIterEntry { struct _virNWFilterVarCombIterEntry {
unsigned int iterId; unsigned int iterId;
const char **varNames; const char **varNames;
@ -133,19 +130,18 @@ struct _virNWFilterVarCombIterEntry {
}; };
typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter; typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter;
typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
struct _virNWFilterVarCombIter { struct _virNWFilterVarCombIter {
GHashTable *hashTable; GHashTable *hashTable;
size_t nIter; size_t nIter;
virNWFilterVarCombIterEntryPtr iter; virNWFilterVarCombIterEntry *iter;
}; };
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate( virNWFilterVarCombIter *virNWFilterVarCombIterCreate(
GHashTable *hash, GHashTable *hash,
virNWFilterVarAccessPtr *vars, virNWFilterVarAccess **vars,
size_t nVars); size_t nVars);
void virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci); void virNWFilterVarCombIterFree(virNWFilterVarCombIter *ci);
virNWFilterVarCombIterPtr virNWFilterVarCombIterNext( virNWFilterVarCombIter *virNWFilterVarCombIterNext(
virNWFilterVarCombIterPtr ci); virNWFilterVarCombIter *ci);
const char *virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, const char *virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIter *ci,
const virNWFilterVarAccess *); const virNWFilterVarAccess *);

View File

@ -39,7 +39,7 @@ VIR_LOG_INIT("conf.object_event");
struct _virObjectEventCallback { struct _virObjectEventCallback {
int callbackID; int callbackID;
virClassPtr klass; virClass *klass;
int eventID; int eventID;
virConnectPtr conn; virConnectPtr conn;
int remoteID; int remoteID;
@ -54,35 +54,33 @@ struct _virObjectEventCallback {
bool legacy; /* true if end user does not know callbackID */ bool legacy; /* true if end user does not know callbackID */
}; };
typedef struct _virObjectEventCallback virObjectEventCallback; typedef struct _virObjectEventCallback virObjectEventCallback;
typedef virObjectEventCallback *virObjectEventCallbackPtr;
struct _virObjectEventCallbackList { struct _virObjectEventCallbackList {
unsigned int nextID; unsigned int nextID;
size_t count; size_t count;
virObjectEventCallbackPtr *callbacks; virObjectEventCallback **callbacks;
}; };
struct _virObjectEventQueue { struct _virObjectEventQueue {
size_t count; size_t count;
virObjectEventPtr *events; virObjectEvent **events;
}; };
typedef struct _virObjectEventQueue virObjectEventQueue; typedef struct _virObjectEventQueue virObjectEventQueue;
typedef virObjectEventQueue *virObjectEventQueuePtr;
struct _virObjectEventState { struct _virObjectEventState {
virObjectLockable parent; virObjectLockable parent;
/* The list of domain event callbacks */ /* The list of domain event callbacks */
virObjectEventCallbackListPtr callbacks; virObjectEventCallbackList *callbacks;
/* The queue of object events */ /* The queue of object events */
virObjectEventQueuePtr queue; virObjectEventQueue *queue;
/* Timer for flushing events queue */ /* Timer for flushing events queue */
int timer; int timer;
/* Flag if we're in process of dispatching */ /* Flag if we're in process of dispatching */
bool isDispatching; bool isDispatching;
}; };
static virClassPtr virObjectEventClass; static virClass *virObjectEventClass;
static virClassPtr virObjectEventStateClass; static virClass *virObjectEventStateClass;
static void virObjectEventDispose(void *obj); static void virObjectEventDispose(void *obj);
static void virObjectEventStateDispose(void *obj); static void virObjectEventStateDispose(void *obj);
@ -107,7 +105,7 @@ VIR_ONCE_GLOBAL_INIT(virObjectEvent);
* Return the class object to be used as a parent when creating an * Return the class object to be used as a parent when creating an
* event subclass. * event subclass.
*/ */
virClassPtr virClass *
virClassForObjectEvent(void) virClassForObjectEvent(void)
{ {
if (virObjectEventInitialize() < 0) if (virObjectEventInitialize() < 0)
@ -119,7 +117,7 @@ virClassForObjectEvent(void)
static void static void
virObjectEventDispose(void *obj) virObjectEventDispose(void *obj)
{ {
virObjectEventPtr event = obj; virObjectEvent *event = obj;
VIR_DEBUG("obj=%p", event); VIR_DEBUG("obj=%p", event);
@ -134,7 +132,7 @@ virObjectEventDispose(void *obj)
* Free the memory in the domain event callback * Free the memory in the domain event callback
*/ */
static void static void
virObjectEventCallbackFree(virObjectEventCallbackPtr cb) virObjectEventCallbackFree(virObjectEventCallback *cb)
{ {
if (!cb) if (!cb)
return; return;
@ -151,7 +149,7 @@ virObjectEventCallbackFree(virObjectEventCallbackPtr cb)
* Free the memory in the domain event callback list * Free the memory in the domain event callback list
*/ */
static void static void
virObjectEventCallbackListFree(virObjectEventCallbackListPtr list) virObjectEventCallbackListFree(virObjectEventCallbackList *list)
{ {
size_t i; size_t i;
if (!list) if (!list)
@ -192,8 +190,8 @@ virObjectEventCallbackListFree(virObjectEventCallbackListPtr list)
*/ */
static int static int
virObjectEventCallbackListCount(virConnectPtr conn, virObjectEventCallbackListCount(virConnectPtr conn,
virObjectEventCallbackListPtr cbList, virObjectEventCallbackList *cbList,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
const char *key, const char *key,
bool serverFilter) bool serverFilter)
@ -202,7 +200,7 @@ virObjectEventCallbackListCount(virConnectPtr conn,
int ret = 0; int ret = 0;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
virObjectEventCallbackPtr cb = cbList->callbacks[i]; virObjectEventCallback *cb = cbList->callbacks[i];
if (cb->filter) if (cb->filter)
continue; continue;
@ -226,18 +224,18 @@ virObjectEventCallbackListCount(virConnectPtr conn,
* @callback: the callback to remove * @callback: the callback to remove
* @doFreeCb: Inhibit calling the freecb * @doFreeCb: Inhibit calling the freecb
* *
* Internal function to remove a callback from a virObjectEventCallbackListPtr * Internal function to remove a callback from a virObjectEventCallbackList *
*/ */
static int static int
virObjectEventCallbackListRemoveID(virConnectPtr conn, virObjectEventCallbackListRemoveID(virConnectPtr conn,
virObjectEventCallbackListPtr cbList, virObjectEventCallbackList *cbList,
int callbackID, int callbackID,
bool doFreeCb) bool doFreeCb)
{ {
size_t i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
virObjectEventCallbackPtr cb = cbList->callbacks[i]; virObjectEventCallback *cb = cbList->callbacks[i];
if (cb->callbackID == callbackID && cb->conn == conn) { if (cb->callbackID == callbackID && cb->conn == conn) {
int ret; int ret;
@ -268,13 +266,13 @@ virObjectEventCallbackListRemoveID(virConnectPtr conn,
static int static int
virObjectEventCallbackListMarkDeleteID(virConnectPtr conn, virObjectEventCallbackListMarkDeleteID(virConnectPtr conn,
virObjectEventCallbackListPtr cbList, virObjectEventCallbackList *cbList,
int callbackID) int callbackID)
{ {
size_t i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
virObjectEventCallbackPtr cb = cbList->callbacks[i]; virObjectEventCallback *cb = cbList->callbacks[i];
if (cb->callbackID == callbackID && cb->conn == conn) { if (cb->callbackID == callbackID && cb->conn == conn) {
cb->deleted = true; cb->deleted = true;
@ -294,7 +292,7 @@ virObjectEventCallbackListMarkDeleteID(virConnectPtr conn,
static int static int
virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList) virObjectEventCallbackListPurgeMarked(virObjectEventCallbackList *cbList)
{ {
size_t n; size_t n;
for (n = 0; n < cbList->count; n++) { for (n = 0; n < cbList->count; n++) {
@ -332,9 +330,9 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
*/ */
static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
virObjectEventCallbackLookup(virConnectPtr conn, virObjectEventCallbackLookup(virConnectPtr conn,
virObjectEventCallbackListPtr cbList, virObjectEventCallbackList *cbList,
const char *key, const char *key,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback callback, virConnectObjectEventGenericCallback callback,
bool legacy, bool legacy,
@ -346,7 +344,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
*remoteID = -1; *remoteID = -1;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
virObjectEventCallbackPtr cb = cbList->callbacks[i]; virObjectEventCallback *cb = cbList->callbacks[i];
if (cb->deleted) if (cb->deleted)
continue; continue;
@ -382,15 +380,15 @@ virObjectEventCallbackLookup(virConnectPtr conn,
* @callbackID: filled with callback ID * @callbackID: filled with callback ID
* @serverFilter: true if server supports object filtering * @serverFilter: true if server supports object filtering
* *
* Internal function to add a callback from a virObjectEventCallbackListPtr * Internal function to add a callback from a virObjectEventCallbackList *
*/ */
static int static int
virObjectEventCallbackListAddID(virConnectPtr conn, virObjectEventCallbackListAddID(virConnectPtr conn,
virObjectEventCallbackListPtr cbList, virObjectEventCallbackList *cbList,
const char *key, const char *key,
virObjectEventCallbackFilter filter, virObjectEventCallbackFilter filter,
void *filter_opaque, void *filter_opaque,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback callback, virConnectObjectEventGenericCallback callback,
void *opaque, void *opaque,
@ -399,7 +397,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
int *callbackID, int *callbackID,
bool serverFilter) bool serverFilter)
{ {
virObjectEventCallbackPtr cb; virObjectEventCallback *cb;
int ret = -1; int ret = -1;
int remoteID = -1; int remoteID = -1;
@ -469,7 +467,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
* Removes all elements from the queue * Removes all elements from the queue
*/ */
static void static void
virObjectEventQueueClear(virObjectEventQueuePtr queue) virObjectEventQueueClear(virObjectEventQueue *queue)
{ {
size_t i; size_t i;
if (!queue) if (!queue)
@ -488,7 +486,7 @@ virObjectEventQueueClear(virObjectEventQueuePtr queue)
* Free the memory in the queue. We process this like a list here * Free the memory in the queue. We process this like a list here
*/ */
static void static void
virObjectEventQueueFree(virObjectEventQueuePtr queue) virObjectEventQueueFree(virObjectEventQueue *queue)
{ {
if (!queue) if (!queue)
return; return;
@ -497,7 +495,7 @@ virObjectEventQueueFree(virObjectEventQueuePtr queue)
g_free(queue); g_free(queue);
} }
static virObjectEventQueuePtr static virObjectEventQueue *
virObjectEventQueueNew(void) virObjectEventQueueNew(void)
{ {
return g_new0(virObjectEventQueue, 1); return g_new0(virObjectEventQueue, 1);
@ -506,14 +504,14 @@ virObjectEventQueueNew(void)
/** /**
* virObjectEventStateDispose: * virObjectEventStateDispose:
* @list: virObjectEventStatePtr to free * @list: virObjectEventState * to free
* *
* Free a virObjectEventStatePtr and its members, and unregister the timer. * Free a virObjectEventState * and its members, and unregister the timer.
*/ */
static void static void
virObjectEventStateDispose(void *obj) virObjectEventStateDispose(void *obj)
{ {
virObjectEventStatePtr state = obj; virObjectEventState *state = obj;
VIR_DEBUG("obj=%p", state); VIR_DEBUG("obj=%p", state);
@ -525,7 +523,7 @@ virObjectEventStateDispose(void *obj)
} }
static void virObjectEventStateFlush(virObjectEventStatePtr state); static void virObjectEventStateFlush(virObjectEventState *state);
/** /**
@ -540,7 +538,7 @@ static void virObjectEventStateFlush(virObjectEventStatePtr state);
static void static void
virObjectEventTimer(int timer G_GNUC_UNUSED, void *opaque) virObjectEventTimer(int timer G_GNUC_UNUSED, void *opaque)
{ {
virObjectEventStatePtr state = opaque; virObjectEventState *state = opaque;
virObjectEventStateFlush(state); virObjectEventStateFlush(state);
} }
@ -551,10 +549,10 @@ virObjectEventTimer(int timer G_GNUC_UNUSED, void *opaque)
* *
* Allocate a new event state object. * Allocate a new event state object.
*/ */
virObjectEventStatePtr virObjectEventState *
virObjectEventStateNew(void) virObjectEventStateNew(void)
{ {
virObjectEventStatePtr state = NULL; virObjectEventState *state = NULL;
if (virObjectEventInitialize() < 0) if (virObjectEventInitialize() < 0)
return NULL; return NULL;
@ -590,7 +588,7 @@ virObjectEventStateNew(void)
* Create a new event, with the information common to all events. * Create a new event, with the information common to all events.
*/ */
void * void *
virObjectEventNew(virClassPtr klass, virObjectEventNew(virClass *klass,
virObjectEventDispatchFunc dispatcher, virObjectEventDispatchFunc dispatcher,
int eventID, int eventID,
int id, int id,
@ -598,7 +596,7 @@ virObjectEventNew(virClassPtr klass,
const unsigned char *uuid, const unsigned char *uuid,
const char *key) const char *key)
{ {
virObjectEventPtr event; virObjectEvent *event;
if (virObjectEventInitialize() < 0) if (virObjectEventInitialize() < 0)
return NULL; return NULL;
@ -638,8 +636,8 @@ virObjectEventNew(virClassPtr klass,
* Returns: 0 on success, -1 on failure * Returns: 0 on success, -1 on failure
*/ */
static int static int
virObjectEventQueuePush(virObjectEventQueuePtr evtQueue, virObjectEventQueuePush(virObjectEventQueue *evtQueue,
virObjectEventPtr event) virObjectEvent *event)
{ {
if (!evtQueue) if (!evtQueue)
return -1; return -1;
@ -651,8 +649,8 @@ virObjectEventQueuePush(virObjectEventQueuePtr evtQueue,
static bool static bool
virObjectEventDispatchMatchCallback(virObjectEventPtr event, virObjectEventDispatchMatchCallback(virObjectEvent *event,
virObjectEventCallbackPtr cb) virObjectEventCallback *cb)
{ {
if (!cb) if (!cb)
return false; return false;
@ -675,9 +673,9 @@ virObjectEventDispatchMatchCallback(virObjectEventPtr event,
static void static void
virObjectEventStateDispatchCallbacks(virObjectEventStatePtr state, virObjectEventStateDispatchCallbacks(virObjectEventState *state,
virObjectEventPtr event, virObjectEvent *event,
virObjectEventCallbackListPtr callbacks) virObjectEventCallbackList *callbacks)
{ {
size_t i; size_t i;
/* Cache this now, since we may be dropping the lock, /* Cache this now, since we may be dropping the lock,
@ -686,7 +684,7 @@ virObjectEventStateDispatchCallbacks(virObjectEventStatePtr state,
size_t cbCount = callbacks->count; size_t cbCount = callbacks->count;
for (i = 0; i < cbCount; i++) { for (i = 0; i < cbCount; i++) {
virObjectEventCallbackPtr cb = callbacks->callbacks[i]; virObjectEventCallback *cb = callbacks->callbacks[i];
if (!virObjectEventDispatchMatchCallback(event, cb)) if (!virObjectEventDispatchMatchCallback(event, cb))
continue; continue;
@ -700,9 +698,9 @@ virObjectEventStateDispatchCallbacks(virObjectEventStatePtr state,
static void static void
virObjectEventStateQueueDispatch(virObjectEventStatePtr state, virObjectEventStateQueueDispatch(virObjectEventState *state,
virObjectEventQueuePtr queue, virObjectEventQueue *queue,
virObjectEventCallbackListPtr callbacks) virObjectEventCallbackList *callbacks)
{ {
size_t i; size_t i;
@ -729,8 +727,8 @@ virObjectEventStateQueueDispatch(virObjectEventStatePtr state,
* id. * id.
*/ */
void void
virObjectEventStateQueueRemote(virObjectEventStatePtr state, virObjectEventStateQueueRemote(virObjectEventState *state,
virObjectEventPtr event, virObjectEvent *event,
int remoteID) int remoteID)
{ {
if (!event) if (!event)
@ -765,15 +763,15 @@ virObjectEventStateQueueRemote(virObjectEventStatePtr state,
* call. * call.
*/ */
void void
virObjectEventStateQueue(virObjectEventStatePtr state, virObjectEventStateQueue(virObjectEventState *state,
virObjectEventPtr event) virObjectEvent *event)
{ {
virObjectEventStateQueueRemote(state, event, -1); virObjectEventStateQueueRemote(state, event, -1);
} }
static void static void
virObjectEventStateCleanupTimer(virObjectEventStatePtr state, bool clear_queue) virObjectEventStateCleanupTimer(virObjectEventState *state, bool clear_queue)
{ {
/* There are still some callbacks, keep the timer. */ /* There are still some callbacks, keep the timer. */
if (state->callbacks->count) if (state->callbacks->count)
@ -792,7 +790,7 @@ virObjectEventStateCleanupTimer(virObjectEventStatePtr state, bool clear_queue)
static void static void
virObjectEventStateFlush(virObjectEventStatePtr state) virObjectEventStateFlush(virObjectEventState *state)
{ {
virObjectEventQueue tempQueue; virObjectEventQueue tempQueue;
@ -863,11 +861,11 @@ virObjectEventStateFlush(virObjectEventStatePtr state)
*/ */
int int
virObjectEventStateRegisterID(virConnectPtr conn, virObjectEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
const char *key, const char *key,
virObjectEventCallbackFilter filter, virObjectEventCallbackFilter filter,
void *filter_opaque, void *filter_opaque,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback cb, virConnectObjectEventGenericCallback cb,
void *opaque, void *opaque,
@ -929,7 +927,7 @@ virObjectEventStateRegisterID(virConnectPtr conn,
*/ */
int int
virObjectEventStateDeregisterID(virConnectPtr conn, virObjectEventStateDeregisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
bool doFreeCb) bool doFreeCb)
{ {
@ -966,8 +964,8 @@ virObjectEventStateDeregisterID(virConnectPtr conn,
*/ */
int int
virObjectEventStateCallbackID(virConnectPtr conn, virObjectEventStateCallbackID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback callback, virConnectObjectEventGenericCallback callback,
int *remoteID) int *remoteID)
@ -1004,17 +1002,17 @@ virObjectEventStateCallbackID(virConnectPtr conn,
*/ */
int int
virObjectEventStateEventID(virConnectPtr conn, virObjectEventStateEventID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
int *remoteID) int *remoteID)
{ {
int ret = -1; int ret = -1;
size_t i; size_t i;
virObjectEventCallbackListPtr cbList = state->callbacks; virObjectEventCallbackList *cbList = state->callbacks;
virObjectLock(state); virObjectLock(state);
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
virObjectEventCallbackPtr cb = cbList->callbacks[i]; virObjectEventCallback *cb = cbList->callbacks[i];
if (cb->deleted) if (cb->deleted)
continue; continue;
@ -1050,7 +1048,7 @@ virObjectEventStateEventID(virConnectPtr conn,
*/ */
void void
virObjectEventStateSetRemote(virConnectPtr conn, virObjectEventStateSetRemote(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
int remoteID) int remoteID)
{ {
@ -1058,7 +1056,7 @@ virObjectEventStateSetRemote(virConnectPtr conn,
virObjectLock(state); virObjectLock(state);
for (i = 0; i < state->callbacks->count; i++) { for (i = 0; i < state->callbacks->count; i++) {
virObjectEventCallbackPtr cb = state->callbacks->callbacks[i]; virObjectEventCallback *cb = state->callbacks->callbacks[i];
if (cb->deleted) if (cb->deleted)
continue; continue;

View File

@ -31,13 +31,11 @@
* in a call / response rpc * in a call / response rpc
*/ */
typedef struct _virObjectEvent virObjectEvent; typedef struct _virObjectEvent virObjectEvent;
typedef virObjectEvent *virObjectEventPtr;
typedef struct _virObjectEventState virObjectEventState; typedef struct _virObjectEventState virObjectEventState;
typedef virObjectEventState *virObjectEventStatePtr;
virObjectEventStatePtr virObjectEventState *
virObjectEventStateNew(void); virObjectEventStateNew(void);
/** /**
@ -57,33 +55,33 @@ typedef void (*virConnectObjectEventGenericCallback)(virConnectPtr conn,
((virConnectObjectEventGenericCallback)(cb)) ((virConnectObjectEventGenericCallback)(cb))
void void
virObjectEventStateQueue(virObjectEventStatePtr state, virObjectEventStateQueue(virObjectEventState *state,
virObjectEventPtr event) virObjectEvent *event)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void void
virObjectEventStateQueueRemote(virObjectEventStatePtr state, virObjectEventStateQueueRemote(virObjectEventState *state,
virObjectEventPtr event, virObjectEvent *event,
int remoteID) int remoteID)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int int
virObjectEventStateDeregisterID(virConnectPtr conn, virObjectEventStateDeregisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
bool doFreeCb) bool doFreeCb)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int int
virObjectEventStateEventID(virConnectPtr conn, virObjectEventStateEventID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
int *remoteID) int *remoteID)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void void
virObjectEventStateSetRemote(virConnectPtr conn, virObjectEventStateSetRemote(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
int callbackID, int callbackID,
int remoteID) int remoteID)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

View File

@ -31,14 +31,12 @@ struct _virObjectMeta {
char *key; char *key;
}; };
typedef struct _virObjectMeta virObjectMeta; typedef struct _virObjectMeta virObjectMeta;
typedef virObjectMeta *virObjectMetaPtr;
typedef struct _virObjectEventCallbackList virObjectEventCallbackList; typedef struct _virObjectEventCallbackList virObjectEventCallbackList;
typedef virObjectEventCallbackList *virObjectEventCallbackListPtr;
typedef void typedef void
(*virObjectEventDispatchFunc)(virConnectPtr conn, (*virObjectEventDispatchFunc)(virConnectPtr conn,
virObjectEventPtr event, virObjectEvent *event,
virConnectObjectEventGenericCallback cb, virConnectObjectEventGenericCallback cb,
void *cbopaque); void *cbopaque);
@ -61,19 +59,19 @@ struct __attribute__((aligned(8))) _virObjectEvent {
* be sent to @conn. * be sent to @conn.
*/ */
typedef bool (*virObjectEventCallbackFilter)(virConnectPtr conn, typedef bool (*virObjectEventCallbackFilter)(virConnectPtr conn,
virObjectEventPtr event, virObjectEvent *event,
void *opaque); void *opaque);
virClassPtr virClass *
virClassForObjectEvent(void); virClassForObjectEvent(void);
int int
virObjectEventStateRegisterID(virConnectPtr conn, virObjectEventStateRegisterID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
const char *key, const char *key,
virObjectEventCallbackFilter filter, virObjectEventCallbackFilter filter,
void *filter_opaque, void *filter_opaque,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback cb, virConnectObjectEventGenericCallback cb,
void *opaque, void *opaque,
@ -86,8 +84,8 @@ virObjectEventStateRegisterID(virConnectPtr conn,
int int
virObjectEventStateCallbackID(virConnectPtr conn, virObjectEventStateCallbackID(virConnectPtr conn,
virObjectEventStatePtr state, virObjectEventState *state,
virClassPtr klass, virClass *klass,
int eventID, int eventID,
virConnectObjectEventGenericCallback callback, virConnectObjectEventGenericCallback callback,
int *remoteID) int *remoteID)
@ -95,7 +93,7 @@ virObjectEventStateCallbackID(virConnectPtr conn,
ATTRIBUTE_NONNULL(5); ATTRIBUTE_NONNULL(5);
void * void *
virObjectEventNew(virClassPtr klass, virObjectEventNew(virClass *klass,
virObjectEventDispatchFunc dispatcher, virObjectEventDispatchFunc dispatcher,
int eventID, int eventID,
int id, int id,

View File

@ -38,7 +38,7 @@
VIR_LOG_INIT("conf.secret_conf"); VIR_LOG_INIT("conf.secret_conf");
void void
virSecretDefFree(virSecretDefPtr def) virSecretDefFree(virSecretDef *def)
{ {
if (def == NULL) if (def == NULL)
return; return;
@ -50,7 +50,7 @@ virSecretDefFree(virSecretDefPtr def)
static int static int
virSecretDefParseUsage(xmlXPathContextPtr ctxt, virSecretDefParseUsage(xmlXPathContextPtr ctxt,
virSecretDefPtr def) virSecretDef *def)
{ {
g_autofree char *type_str = NULL; g_autofree char *type_str = NULL;
int type; int type;
@ -126,7 +126,7 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
return 0; return 0;
} }
static virSecretDefPtr static virSecretDef *
secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root) secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
{ {
g_autoptr(xmlXPathContext) ctxt = NULL; g_autoptr(xmlXPathContext) ctxt = NULL;
@ -189,12 +189,12 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
return g_steal_pointer(&def); return g_steal_pointer(&def);
} }
static virSecretDefPtr static virSecretDef *
virSecretDefParse(const char *xmlStr, virSecretDefParse(const char *xmlStr,
const char *filename) const char *filename)
{ {
xmlDocPtr xml; xmlDocPtr xml;
virSecretDefPtr ret = NULL; virSecretDef *ret = NULL;
if ((xml = virXMLParse(filename, xmlStr, _("(definition_of_secret)")))) { if ((xml = virXMLParse(filename, xmlStr, _("(definition_of_secret)")))) {
ret = secretXMLParseNode(xml, xmlDocGetRootElement(xml)); ret = secretXMLParseNode(xml, xmlDocGetRootElement(xml));
@ -204,20 +204,20 @@ virSecretDefParse(const char *xmlStr,
return ret; return ret;
} }
virSecretDefPtr virSecretDef *
virSecretDefParseString(const char *xmlStr) virSecretDefParseString(const char *xmlStr)
{ {
return virSecretDefParse(xmlStr, NULL); return virSecretDefParse(xmlStr, NULL);
} }
virSecretDefPtr virSecretDef *
virSecretDefParseFile(const char *filename) virSecretDefParseFile(const char *filename)
{ {
return virSecretDefParse(NULL, filename); return virSecretDefParse(NULL, filename);
} }
static int static int
virSecretDefFormatUsage(virBufferPtr buf, virSecretDefFormatUsage(virBuffer *buf,
const virSecretDef *def) const virSecretDef *def)
{ {
const char *type; const char *type;

View File

@ -23,7 +23,6 @@
#include "internal.h" #include "internal.h"
typedef struct _virSecretDef virSecretDef; typedef struct _virSecretDef virSecretDef;
typedef virSecretDef *virSecretDefPtr;
struct _virSecretDef { struct _virSecretDef {
bool isephemeral; bool isephemeral;
bool isprivate; bool isprivate;
@ -33,11 +32,11 @@ struct _virSecretDef {
char *usage_id; /* May be NULL */ char *usage_id; /* May be NULL */
}; };
void virSecretDefFree(virSecretDefPtr def); void virSecretDefFree(virSecretDef *def);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSecretDef, virSecretDefFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSecretDef, virSecretDefFree);
virSecretDefPtr virSecretDefParseString(const char *xml); virSecretDef *virSecretDefParseString(const char *xml);
virSecretDefPtr virSecretDefParseFile(const char *filename); virSecretDef *virSecretDefParseFile(const char *filename);
char *virSecretDefFormat(const virSecretDef *def); char *virSecretDefFormat(const virSecretDef *def);
#define VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL \ #define VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL \

Some files were not shown because too many files have changed in this diff Show More