Remove most of the typedefs.
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 28 Mar 2009 02:30:33 +0000 (03:30 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 28 Mar 2009 02:30:33 +0000 (03:30 +0100)
Signed-off-by: Matthias Bolte <matthias.bolte@googlemail.com>

41 files changed:
cli/cli.c
daemon/daemon.c
include/libvscmgmt/checkpoint.h
include/libvscmgmt/core.h
include/libvscmgmt/error.h
include/libvscmgmt/host.h
include/libvscmgmt/ipv4.h
include/libvscmgmt/network.h
include/libvscmgmt/suspension.h
include/libvscmgmt/types.h
include/libvscmgmt/uuid.h
include/libvscmgmt/vm.h
lib/core.c
lib/host.c
lib/host.h
lib/internal-file.c
lib/internal.h
lib/network-dhcp.c
lib/network.h
proxy/proxy.c
tests/host.c
tests/ipv4.c
tests/uuid.c
utils/error.c
utils/error.h
utils/host.c
utils/host.h
utils/ipv4.c
utils/ipv4.h
utils/list.c
utils/list.h
utils/memory.c
utils/memory.h
utils/mutex-none.c
utils/mutex-pthread.c
utils/mutex.h
utils/string.c
utils/string.h
utils/types.h
utils/uuid.c
utils/uuid.h

index f7fcfb1..f0d1f10 100644 (file)
--- a/cli/cli.c
+++ b/cli/cli.c
@@ -27,8 +27,8 @@ int
 main (int argc ATTR_UNUSED, const char **argv ATTR_UNUSED)
 {
        int result = 0;
-       VscMgmtError error;
-       VscMgmtHostInfo host_info;
+       struct VscMgmtError error;
+       struct VscMgmtHostInfo host_info;
 
        vsc_mgmt_error_init (&error);
 
index 94c8da4..f3c2dab 100644 (file)
@@ -57,10 +57,10 @@ xmlrpc_vsc_mgmt_host_add (xmlrpc_env *env,
                           void *server_info ATTR_UNUSED,
                           void *channel_info ATTR_UNUSED)
 {
-       VscMgmtError error;
+       struct VscMgmtError error;
        char* host_ipv4_string = NULL;
        char* host_type_string = NULL;
-       VscMgmtHostInfo host_info;
+       struct VscMgmtHostInfo host_info;
        xmlrpc_value *result = NULL;
 
        host_info.host_username = NULL;
@@ -125,9 +125,9 @@ xmlrpc_vsc_mgmt_host_remove (xmlrpc_env *env,
                              void *server_info ATTR_UNUSED,
                              void *channel_info ATTR_UNUSED)
 {
-       VscMgmtError error;
+       struct VscMgmtError error;
        char* host_ipv4_string = NULL;
-       VscMgmtIpv4 host_ipv4;
+       struct VscMgmtIpv4 host_ipv4;
        xmlrpc_value *result = NULL;
 
        vsc_mgmt_error_init (&error);
@@ -182,7 +182,7 @@ static struct xmlrpc_method_info3 method_info_list[] = {
 int
 main (int argc ATTR_UNUSED, const char **argv ATTR_UNUSED)
 {
-       VscMgmtError error;
+       struct VscMgmtError error;
        xmlrpc_env env;
        xmlrpc_registry *registry;
        xmlrpc_server_abyss_parms server_parms;
index e19f5a8..9984144 100644 (file)
@@ -28,22 +28,25 @@ extern "C" {
 #endif
 
 void
-vsc_mgmt_checkpoint_create (VscMgmtError *error,
-                            const VscMgmtUuid *vm_uuid_list,
-                            VscMgmtUuid *checkpoint_uuid);
+vsc_mgmt_checkpoint_create (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *vm_uuid_list,
+                            struct VscMgmtUuid *checkpoint_uuid);
 
 void
-vsc_mgmt_checkpoint_delete (VscMgmtError *error,
-                            const VscMgmtUuid *checkpoint_uuid);
+vsc_mgmt_checkpoint_delete (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *checkpoint_uuid);
 
 void
-vsc_mgmt_checkpoint_restore (VscMgmtError *error,
-                             const VscMgmtUuid *checkpoint_uuid);
+vsc_mgmt_checkpoint_restore (struct VscMgmtError *error,
+                             const struct VscMgmtUuid *checkpoint_uuid);
 
 void
-vsc_mgmt_checkpoint_get_info (VscMgmtError *error,
-                              const VscMgmtUuid *checkpoint_uuid,
-                              VscMgmtCheckpointInfo *checkpoint_info);
+vsc_mgmt_checkpoint_get_info (struct VscMgmtError *error,
+                              const struct VscMgmtUuid *checkpoint_uuid,
+                              struct VscMgmtCheckpointInfo *checkpoint_info);
+
+struct VscMgmtUuid * /* checkpoint_uuid_list */
+vsc_mgmt_checkpoint_get_list (struct VscMgmtError *error);
 
 #ifdef __cplusplus
 }
index 2a7a3f9..19b07a2 100644 (file)
@@ -36,8 +36,8 @@ extern "C" {
  * Function is not threadsafe.
  */
 void
-vsc_mgmt_init (VscMgmtError *error, const char *config,
-               const VscMgmtNetwork *network_list);
+vsc_mgmt_init (struct VscMgmtError *error, const char *config,
+               const struct VscMgmtNetwork *network_list);
 
 /**
  *
@@ -47,31 +47,17 @@ void
 vsc_mgmt_cleanup (void);
 
 void
-vsc_mgmt_backup (VscMgmtError *error);
+vsc_mgmt_backup (struct VscMgmtError *error);
 
 void
-vsc_mgmt_recover (VscMgmtError *error);
+vsc_mgmt_recover (struct VscMgmtError *error);
 
 void
 vsc_mgmt_get_version (int *major, int *minor, int *patch);
 
-VscMgmtUuid * /* suspension_uuid_list */
-vsc_mgmt_get_suspension_list (VscMgmtError *error);
-
-VscMgmtUuid * /* checkpoint_uuid_list */
-vsc_mgmt_get_checkpoint_list (VscMgmtError *error);
-
-/**
- * Returns an IPv4 list representing all currently known host.
- *
- * The list must be freed by the caller via the vsc_mgmt_ipv4_list_free
- * function.
- */
-VscMgmtIpv4 * /* host_ipv4_list */
-vsc_mgmt_get_host_list (VscMgmtError *error);
-
-VscMgmtUuidType /* uuid_type */
-vsc_mgmt_get_uuid_type (VscMgmtError *error, const VscMgmtUuid *uuid);
+enum VscMgmtUuidType /* uuid_type */
+vsc_mgmt_uuid_get_type (struct VscMgmtError *error,
+                        const struct VscMgmtUuid *uuid);
 
 #ifdef __cplusplus
 }
index c06c6bc..a2e3d83 100644 (file)
@@ -30,10 +30,10 @@ extern "C" {
 #endif
 
 void
-vsc_mgmt_error_init (VscMgmtError *error);
+vsc_mgmt_error_init (struct VscMgmtError *error);
 
 void
-vsc_mgmt_error_cleanup (VscMgmtError *error);
+vsc_mgmt_error_cleanup (struct VscMgmtError *error);
 
 /**
  * Returns the string representaion of the error code.
@@ -41,10 +41,10 @@ vsc_mgmt_error_cleanup (VscMgmtError *error);
  * The string must not be freed by the caller.
  */
 const char * /* error_string */
-vsc_mgmt_error_string (VscMgmtCode code);
+vsc_mgmt_error_string (enum VscMgmtCode code);
 
 void
-vsc_mgmt_error_fprint (VscMgmtError *error, FILE *stream);
+vsc_mgmt_error_fprint (struct VscMgmtError *error, FILE *stream);
 
 #ifdef __cplusplus
 }
index f947639..95cab9d 100644 (file)
@@ -26,14 +26,17 @@ extern "C" {
 #endif
 
 void
-vsc_mgmt_host_add (VscMgmtError *error, const VscMgmtHostInfo *host_info);
+vsc_mgmt_host_add (struct VscMgmtError *error,
+                   const struct VscMgmtHostInfo *host_info);
 
 void
-vsc_mgmt_host_remove (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4);
+vsc_mgmt_host_remove (struct VscMgmtError *error,
+                      const struct VscMgmtIpv4 *host_ipv4);
 
 void
-vsc_mgmt_host_get_info (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4,
-                        VscMgmtHostInfo *host_info);
+vsc_mgmt_host_get_info (struct VscMgmtError *error,
+                        const struct VscMgmtIpv4 *host_ipv4,
+                        struct VscMgmtHostInfo *host_info);
 
 /**
  * Returns a UUID list representing all virtual machines currently available
@@ -42,14 +45,25 @@ vsc_mgmt_host_get_info (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4,
  * The list must be freed by the caller via the vsc_mgmt_uuid_list_free
  * function.
  */
-VscMgmtUuid * /* vm_uuid_list */
-vsc_mgmt_host_get_vm_list (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4);
+struct VscMgmtUuid * /* vm_uuid_list */
+vsc_mgmt_host_get_vm_list (struct VscMgmtError *error,
+                           const struct VscMgmtIpv4 *host_ipv4);
+
+/**
+ * Returns an IPv4 list representing all currently known host.
+ *
+ * The list must be freed by the caller via the vsc_mgmt_ipv4_list_free
+ * function.
+ */
+struct VscMgmtIpv4 * /* host_ipv4_list */
+vsc_mgmt_host_get_list (struct VscMgmtError *error);
 
 /**
  * Parses a host type from its string representation and returns it.
  */
-VscMgmtHostType /* host_type */
-vsc_mgmt_host_type_parse (VscMgmtError *error, const char *host_type_string);
+enum VscMgmtHostType /* host_type */
+vsc_mgmt_host_type_parse (struct VscMgmtError *error,
+                          const char *host_type_string);
 
 /**
  * Returns the string representaion of the host type.
@@ -57,7 +71,7 @@ vsc_mgmt_host_type_parse (VscMgmtError *error, const char *host_type_string);
  * The string must not be freed by the caller.
  */
 const char * /* host_type_string */
-vsc_mgmt_host_type_string (VscMgmtHostType host_type);
+vsc_mgmt_host_type_string (enum VscMgmtHostType host_type);
 
 #ifdef __cplusplus
 }
index 0696d07..0d5cbce 100644 (file)
@@ -31,14 +31,14 @@ extern "C" {
  * Parses an IPv4 from its string representation.
  */
 void
-vsc_mgmt_ipv4_parse (VscMgmtError *error, const char *ipv4_string,
-                     VscMgmtIpv4 *ipv4);
+vsc_mgmt_ipv4_parse (struct VscMgmtError *error, const char *ipv4_string,
+                     struct VscMgmtIpv4 *ipv4);
 
 /**
  * Formats an IPv4 to its string representation.
  */
 void
-vsc_mgmt_ipv4_format (const VscMgmtIpv4 *ipv4, char *ipv4_string);
+vsc_mgmt_ipv4_format (const struct VscMgmtIpv4 *ipv4, char *ipv4_string);
 
 /**
  * Appends a duplicate of the IPv4 to the list.
@@ -48,15 +48,16 @@ vsc_mgmt_ipv4_format (const VscMgmtIpv4 *ipv4, char *ipv4_string);
  *
  * If an error occurs then the list is still untouched.
  */
-VscMgmtIpv4 * /* ipv4_list */
-vsc_mgmt_ipv4_list_append (VscMgmtError *error, VscMgmtIpv4 *ipv4_list,
-                           const VscMgmtIpv4 *ipv4);
+struct VscMgmtIpv4 * /* ipv4_list */
+vsc_mgmt_ipv4_list_append (struct VscMgmtError *error,
+                           struct VscMgmtIpv4 *ipv4_list,
+                           const struct VscMgmtIpv4 *ipv4);
 
 /**
  * Recursively frees the IPv4 list.
  */
 void
-vsc_mgmt_ipv4_list_free (VscMgmtIpv4 *ipv4_list);
+vsc_mgmt_ipv4_list_free (struct VscMgmtIpv4 *ipv4_list);
 
 #ifdef __cplusplus
 }
index 0a74b40..49830e0 100644 (file)
 extern "C" {
 #endif
 
-VscMgmtUuid * /* network_uuid */
-vsc_mgmt_network_setup (VscMgmtError *error, int num_hosts);
+struct VscMgmtUuid * /* network_uuid */
+vsc_mgmt_network_setup (struct VscMgmtError *error, int num_hosts);
 
 void
-vsc_mgmt_network_teardown (VscMgmtError *error,
-                           const VscMgmtUuid *network_uuid);
+vsc_mgmt_network_teardown (struct VscMgmtError *error,
+                           const struct VscMgmtUuid *network_uuid);
 
 #ifdef __cplusplus
 }
index 545c7d1..ac55796 100644 (file)
@@ -28,18 +28,21 @@ extern "C" {
 #endif
 
 void
-vsc_mgmt_suspension_create (VscMgmtError *error,
-                            const VscMgmtUuid *vm_uuid_list,
-                            VscMgmtUuid *suspension_uuid);
+vsc_mgmt_suspension_create (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *vm_uuid_list,
+                            struct VscMgmtUuid *suspension_uuid);
 
 void
-vsc_mgmt_suspension_resume (VscMgmtError *error,
-                            const VscMgmtUuid *suspension_uuid);
+vsc_mgmt_suspension_resume (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *suspension_uuid);
 
 void
-vsc_mgmt_suspension_get_info (VscMgmtError *error,
-                              const VscMgmtUuid *suspension_uuid,
-                              VscMgmtSuspensionInfo *suspension_info);
+vsc_mgmt_suspension_get_info (struct VscMgmtError *error,
+                              const struct VscMgmtUuid *suspension_uuid,
+                              struct VscMgmtSuspensionInfo *suspension_info);
+
+struct VscMgmtUuid * /* suspension_uuid_list */
+vsc_mgmt_suspension_get_list (struct VscMgmtError *error);
 
 #ifdef __cplusplus
 }
index 4ef8aa6..8063e99 100644 (file)
 extern "C" {
 #endif
 
-typedef enum _VscMgmtCode VscMgmtCode;
-typedef enum _VscMgmtVmState VscMgmtVmState;
-typedef enum _VscMgmtHostType VscMgmtHostType;
-typedef enum _VscMgmtUuidType VscMgmtUuidType;
-typedef struct _VscMgmtError VscMgmtError;
-typedef struct _VscMgmtUuid VscMgmtUuid;
-typedef struct _VscMgmtIpv4 VscMgmtIpv4;
-typedef struct _VscMgmtNetwork VscMgmtNetwork;
-typedef struct _VscMgmtVmInfo VscMgmtVmInfo;
-typedef struct _VscMgmtVmResourceConfig VscMgmtVmResourceConfig;
-typedef struct _VscMgmtSuspensionInfo VscMgmtSuspensionInfo;
-typedef struct _VscMgmtCheckpointInfo VscMgmtCheckpointInfo;
-typedef struct _VscMgmtHostInfo VscMgmtHostInfo;
-
-enum _VscMgmtCode {
+enum VscMgmtCode {
        VSC_MGMT__CODE__UNDEFINED = 0,
        VSC_MGMT__CODE__INTERNAL_ERROR,
        VSC_MGMT__CODE__OUT_OF_MEMORY,
@@ -66,14 +52,14 @@ enum _VscMgmtCode {
        VSC_MGMT__CODE__TRACE,
 };
 
-enum _VscMgmtVmState {
+enum VscMgmtVmState {
        VSC_MGMT__VM_STATE__UNDEFINED = 0,
        VSC_MGMT__VM_STATE__RUNNING,
        VSC_MGMT__VM_STATE__SUSPENDED,
        VSC_MGMT__VM_STATE__ERROR,
 };
 
-enum _VscMgmtHostType {
+enum VscMgmtHostType {
        VSC_MGMT__HOST_TYPE__UNDEFINED = 0,
        VSC_MGMT__HOST_TYPE__VIRTUAL,
        VSC_MGMT__HOST_TYPE__XEN,
@@ -82,7 +68,7 @@ enum _VscMgmtHostType {
        VSC_MGMT__HOST_TYPE__KVM,
 };
 
-enum _VscMgmtUuidType {
+enum VscMgmtUuidType {
        VSC_MGMT__UUID_TYPE__UNDEFINED = 0,
        VSC_MGMT__UUID_TYPE__INVALID,
        VSC_MGMT__UUID_TYPE__NETWORK,
@@ -91,10 +77,10 @@ enum _VscMgmtUuidType {
        VSC_MGMT__UUID_TYPE__CHECKPOINT,
 };
 
-struct _VscMgmtError {
-       VscMgmtError *next;
+struct VscMgmtError {
+       struct VscMgmtError *next;
        int occured;
-       VscMgmtCode code;
+       enum VscMgmtCode code;
        char *message;
        const char *file;
        int line;
@@ -102,50 +88,50 @@ struct _VscMgmtError {
        struct timeval timestamp;
 };
 
-struct _VscMgmtUuid {
-       VscMgmtUuid *next;
+struct VscMgmtUuid {
+       struct VscMgmtUuid *next;
        unsigned char bytes[VSC_MGMT__UUID__SIZE];
 };
 
-struct _VscMgmtIpv4 {
-       VscMgmtIpv4 *next;
+struct VscMgmtIpv4 {
+       struct VscMgmtIpv4 *next;
        unsigned char bytes[VSC_MGMT__IPV4__SIZE];
 };
 
-struct _VscMgmtNetwork {
-       VscMgmtNetwork *next;
-       VscMgmtIpv4 subnet;
-       VscMgmtIpv4 subnet_mask;
+struct VscMgmtNetwork {
+       struct VscMgmtNetwork *next;
+       struct VscMgmtIpv4 subnet;
+       struct VscMgmtIpv4 subnet_mask;
 };
 
-struct _VscMgmtVmResourceConfig {
+struct VscMgmtVmResourceConfig {
        int dummy;
 };
 
-struct _VscMgmtVmInfo {
-       VscMgmtUuid vm_uuid;
-       VscMgmtIpv4 vm_ipv4;
-       VscMgmtIpv4 host_ipv4;
-       VscMgmtVmState vm_state;
-       VscMgmtUuid suspension_uuid;
-       VscMgmtUuid *checkpoint_uuid_list;
-       VscMgmtVmResourceConfig vm_resource_config;
-       VscMgmtUuid network_uuid;
+struct VscMgmtVmInfo {
+       struct VscMgmtUuid vm_uuid;
+       struct VscMgmtIpv4 vm_ipv4;
+       struct VscMgmtIpv4 host_ipv4;
+       enum VscMgmtVmState vm_state;
+       struct VscMgmtUuid suspension_uuid;
+       struct VscMgmtUuid *checkpoint_uuid_list;
+       struct VscMgmtVmResourceConfig vm_resource_config;
+       struct VscMgmtUuid network_uuid;
        char *image_path;
 };
 
-struct _VscMgmtSuspensionInfo {
+struct VscMgmtSuspensionInfo {
        int dummy;
 };
 
-struct _VscMgmtCheckpointInfo {
+struct VscMgmtCheckpointInfo {
        int dummy;
 };
 
-struct _VscMgmtHostInfo {
-       VscMgmtHostInfo *next;
-       VscMgmtIpv4 host_ipv4;
-       VscMgmtHostType host_type;
+struct VscMgmtHostInfo {
+       struct VscMgmtHostInfo *next;
+       struct VscMgmtIpv4 host_ipv4;
+       enum VscMgmtHostType host_type;
        char *host_username;
        char *host_password;
 };
index a6c3f5c..b97f6ac 100644 (file)
@@ -31,14 +31,14 @@ extern "C" {
  * Parses a UUID from its string representation.
  */
 void
-vsc_mgmt_uuid_parse (VscMgmtError *error, const char *uuid_string,
-                     VscMgmtUuid *uuid);
+vsc_mgmt_uuid_parse (struct VscMgmtError *error, const char *uuid_string,
+                     struct VscMgmtUuid *uuid);
 
 /**
  * Formats a UUID to its string representation.
  */
 void
-vsc_mgmt_uuid_format (const VscMgmtUuid *uuid, char *uuid_string);
+vsc_mgmt_uuid_format (const struct VscMgmtUuid *uuid, char *uuid_string);
 
 /**
  * Appends a duplicate of the UUID to the list.
@@ -48,15 +48,16 @@ vsc_mgmt_uuid_format (const VscMgmtUuid *uuid, char *uuid_string);
  *
  * If an error occurs then the list is still untouched.
  */
-VscMgmtUuid * /* uuid_list */
-vsc_mgmt_uuid_list_append (VscMgmtError *error, VscMgmtUuid *uuid_list,
-                           const VscMgmtUuid *uuid);
+struct VscMgmtUuid * /* uuid_list */
+vsc_mgmt_uuid_list_append (struct VscMgmtError *error,
+                           struct VscMgmtUuid *uuid_list,
+                           const struct VscMgmtUuid *uuid);
 
 /**
  * Recursively frees the UUID list.
  */
 void
-vsc_mgmt_uuid_list_free (VscMgmtUuid *uuid_list);
+vsc_mgmt_uuid_list_free (struct VscMgmtUuid *uuid_list);
 
 #ifdef __cplusplus
 }
index ea9b401..a4ab771 100644 (file)
 extern "C" {
 #endif
 
-VscMgmtUuid * /* vm_uuid_list */
-vsc_mgmt_vm_deploy (VscMgmtError *error, const char* image_path,
-                    const VscMgmtIpv4 *host_ipv4_list,
-                    const VscMgmtVmResourceConfig *vm_resource_config,
-                    const VscMgmtUuid *network_uuid);
+struct VscMgmtUuid * /* vm_uuid_list */
+vsc_mgmt_vm_deploy (struct VscMgmtError *error, const char* image_path,
+                    const struct VscMgmtIpv4 *host_ipv4_list,
+                    const struct VscMgmtVmResourceConfig *vm_resource_config,
+                    const struct VscMgmtUuid *network_uuid);
 
 void
-vsc_mgmt_vm_retract (VscMgmtError *error, const VscMgmtUuid *vm_uuid_list,
+vsc_mgmt_vm_retract (struct VscMgmtError *error,
+                     const struct VscMgmtUuid *vm_uuid_list,
                      const char* image_directory);
 
 void
-vsc_mgmt_vm_power_on (VscMgmtError *error, const VscMgmtUuid *vm_uuid_list);
+vsc_mgmt_vm_power_on (struct VscMgmtError *error,
+                      const struct VscMgmtUuid *vm_uuid_list);
 
 void
-vsc_mgmt_vm_power_off (VscMgmtError *error, const VscMgmtUuid *vm_uuid_list);
+vsc_mgmt_vm_power_off (struct VscMgmtError *error,
+                       const struct VscMgmtUuid *vm_uuid_list);
 
 void
-vsc_mgmt_vm_reboot (VscMgmtError *error, const VscMgmtUuid *vm_uuid_list);
+vsc_mgmt_vm_reboot (struct VscMgmtError *error,
+                    const struct VscMgmtUuid *vm_uuid_list);
 
 void
-vsc_mgmt_vm_migrate (VscMgmtError *error, const VscMgmtUuid *vm_uuid,
-                     const VscMgmtIpv4 *host_ipv4);
+vsc_mgmt_vm_migrate (struct VscMgmtError *error,
+                     const struct VscMgmtUuid *vm_uuid,
+                     const struct VscMgmtIpv4 *host_ipv4);
 
 void
-vsc_mgmt_vm_get_info (VscMgmtError *error, const VscMgmtUuid *vm_uuid,
-                      VscMgmtVmInfo *vm_info);
+vsc_mgmt_vm_get_info (struct VscMgmtError *error,
+                      const struct VscMgmtUuid *vm_uuid,
+                      struct VscMgmtVmInfo *vm_info);
 
 void
-vsc_mgmt_vm_get_uuid (VscMgmtError *error, const VscMgmtIpv4 *vm_ipv4,
-                      VscMgmtUuid *vm_uuid);
+vsc_mgmt_vm_get_uuid (struct VscMgmtError *error,
+                      const struct VscMgmtIpv4 *vm_ipv4,
+                      struct VscMgmtUuid *vm_uuid);
 
 void
-vsc_mgmt_vm_get_ipv4 (VscMgmtError *error, const VscMgmtUuid *vm_uuid,
-                      VscMgmtIpv4 *vm_ipv4);
+vsc_mgmt_vm_get_ipv4 (struct VscMgmtError *error,
+                      const struct VscMgmtUuid *vm_uuid,
+                      struct VscMgmtIpv4 *vm_ipv4);
 
 void
-vsc_mgmt_vm_get_host (VscMgmtError *error, const VscMgmtUuid *vm_uuid,
-                      VscMgmtIpv4 *host_ipv4);
+vsc_mgmt_vm_get_host (struct VscMgmtError *error,
+                      const struct VscMgmtUuid *vm_uuid,
+                      struct VscMgmtIpv4 *host_ipv4);
 
-VscMgmtVmState /* vm_state */
-vsc_mgmt_vm_get_state (VscMgmtError *error, const VscMgmtUuid *vm_uuid);
+enum VscMgmtVmState /* vm_state */
+vsc_mgmt_vm_get_state (struct VscMgmtError *error,
+                       const struct VscMgmtUuid *vm_uuid);
 
 void
-vsc_mgmt_vm_get_suspension (VscMgmtError *error,
-                            const VscMgmtUuid *vm_uuid,
-                            VscMgmtUuid *suspension_uuid);
+vsc_mgmt_vm_get_suspension (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *vm_uuid,
+                            struct VscMgmtUuid *suspension_uuid);
 
-VscMgmtUuid * /* checkpoint_uuid_list */
-vsc_mgmt_vm_get_checkpoint_list (VscMgmtError *error,
-                                 const VscMgmtUuid *vm_uuid);
+struct VscMgmtUuid * /* checkpoint_uuid_list */
+vsc_mgmt_vm_get_checkpoint_list (struct VscMgmtError *error,
+                                 const struct VscMgmtUuid *vm_uuid);
 
 void
-vsc_mgmt_vm_set_resource_config (VscMgmtError *error,
-                                 const VscMgmtUuid *vm_uuid,
-                                 const VscMgmtVmResourceConfig *vm_resource_config);
+vsc_mgmt_vm_set_resource_config (struct VscMgmtError *error,
+                                 const struct VscMgmtUuid *vm_uuid,
+                                 const struct VscMgmtVmResourceConfig *vm_resource_config);
 
 void
-vsc_mgmt_vm_get_resource_config (VscMgmtError *error,
-                                 const VscMgmtUuid *vm_uuid,
-                                 VscMgmtVmResourceConfig *vm_resource_config);
+vsc_mgmt_vm_get_resource_config (struct VscMgmtError *error,
+                                 const struct VscMgmtUuid *vm_uuid,
+                                 struct VscMgmtVmResourceConfig *vm_resource_config);
 
 void
-vsc_mgmt_vm_get_network (VscMgmtError *error, const VscMgmtUuid *vm_uuid,
-                         VscMgmtUuid *network_uuid);
+vsc_mgmt_vm_get_network (struct VscMgmtError *error,
+                         const struct VscMgmtUuid *vm_uuid,
+                         struct VscMgmtUuid *network_uuid);
 
 char *
-vsc_mgmt_vm_get_image_path (VscMgmtError *error, const VscMgmtUuid *vm_uuid);
+vsc_mgmt_vm_get_image_path (struct VscMgmtError *error,
+                            const struct VscMgmtUuid *vm_uuid);
 
 #ifdef __cplusplus
 }
index 505d2d2..468ab12 100644 (file)
@@ -27,8 +27,8 @@ static int _initialized = FALSE;
  * Function is not threadsafe.
  */
 void
-vsc_mgmt_init (VscMgmtError *error, const char *config,
-               const VscMgmtNetwork *network_list)
+vsc_mgmt_init (struct VscMgmtError *error, const char *config,
+               const struct VscMgmtNetwork *network_list)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -75,7 +75,7 @@ vsc_mgmt_cleanup (void)
 }
 
 void
-vsc_mgmt_backup (VscMgmtError *error)
+vsc_mgmt_backup (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -94,7 +94,7 @@ unlock:
 }
 
 void
-vsc_mgmt_recover (VscMgmtError *error)
+vsc_mgmt_recover (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
index 2f81047..3d6a878 100644 (file)
 #include <malloc.h>
 #include <string.h>
 
-typedef struct _HostConnection HostConnection;
-
-struct _HostConnection {
-       HostConnection *next;
-       VscMgmtIpv4 host_ipv4;
+struct HostConnection {
+       struct HostConnection *next;
+       struct VscMgmtIpv4 host_ipv4;
        int refcount;
        virConnectPtr connection;
 };
 
-static HostConnection *_host_connection_list = NULL;
+static struct HostConnection *_host_connection_list = NULL;
 
 static void
-_host_connection_free (HostConnection *host_connection)
+_host_connection_free (struct HostConnection *host_connection)
 {
        if (host_connection != NULL) {
                virConnectClose (host_connection->connection);
@@ -45,10 +43,10 @@ _host_connection_free (HostConnection *host_connection)
 }
 
 static int
-_host_connection_match (VscMgmtList *item, void *match_data)
+_host_connection_match (struct VscMgmtList *item, void *match_data)
 {
-       return _vsc_mgmt_ipv4_compare (&((HostConnection *) item)->host_ipv4,
-                                      (VscMgmtIpv4 *) match_data) == 0;
+       return _vsc_mgmt_ipv4_compare (&((struct HostConnection *) item)->host_ipv4,
+                                      (struct VscMgmtIpv4 *) match_data) == 0;
 }
 
 static int
@@ -56,7 +54,8 @@ _host_connection_cred_callback (virConnectCredentialPtr cred,
                                 unsigned int ncred, void *cbdata)
 {
        int i;
-       const VscMgmtHostInfo *host_info = (const VscMgmtHostInfo *) cbdata;
+       const struct VscMgmtHostInfo *host_info
+         = (const struct VscMgmtHostInfo *) cbdata;
 
        if (host_info == NULL) {
                return -1;
@@ -94,24 +93,25 @@ _host_connection_cred_callback (virConnectCredentialPtr cred,
        return 0;
 }
 
-static HostConnection * /* host_connection */
-_host_connection_list_lookup (const VscMgmtIpv4 *host_ipv4)
+static struct HostConnection * /* host_connection */
+_host_connection_list_lookup (const struct VscMgmtIpv4 *host_ipv4)
 {
-       return (HostConnection *)
-              _vsc_mgmt_list_lookup
-              ((VscMgmtList *) _host_connection_list,
-               (VscMgmtList_MatchFunction) _host_connection_match,
-               (void *) host_ipv4);
+       return (struct HostConnection *)
+                 _vsc_mgmt_list_lookup
+                    ((struct VscMgmtList *) _host_connection_list,
+                     (VscMgmtList_MatchFunction) _host_connection_match,
+                     (void *) host_ipv4);
 }
 
 static void
-_host_connection_list_remove (HostConnection *host_connection)
+_host_connection_list_remove (struct HostConnection *host_connection)
 {
-       _host_connection_list = (HostConnection *)
-                               _vsc_mgmt_list_remove
-                               ((VscMgmtList *) _host_connection_list,
-                                (VscMgmtList *) host_connection,
-                                (VscMgmtList_FreeFunction) _host_connection_free);
+       _host_connection_list =
+          (struct HostConnection *)
+             _vsc_mgmt_list_remove
+                ((struct VscMgmtList *) _host_connection_list,
+                 (struct VscMgmtList *) host_connection,
+                 (VscMgmtList_FreeFunction) _host_connection_free);
 }
 
 static int _host_connection_cred_types[] = {
@@ -129,7 +129,8 @@ static virConnectAuth _host_connection_auth = {
 };
 
 void
-vsc_mgmt_host_add (VscMgmtError *error, const VscMgmtHostInfo *host_info)
+vsc_mgmt_host_add (struct VscMgmtError *error,
+                   const struct VscMgmtHostInfo *host_info)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -176,7 +177,8 @@ disconnect:
 }
 
 void
-vsc_mgmt_host_remove (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4)
+vsc_mgmt_host_remove (struct VscMgmtError *error,
+                      const struct VscMgmtIpv4 *host_ipv4)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -208,9 +210,9 @@ unlock:
 }
 
 void
-vsc_mgmt_host_get_info (VscMgmtError *error,
-                        const VscMgmtIpv4 *host_ipv4 ATTR_UNUSED,
-                        VscMgmtHostInfo *host_info ATTR_UNUSED)
+vsc_mgmt_host_get_info (struct VscMgmtError *error,
+                        const struct VscMgmtIpv4 *host_ipv4 ATTR_UNUSED,
+                        struct VscMgmtHostInfo *host_info ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -225,9 +227,9 @@ vsc_mgmt_host_get_info (VscMgmtError *error,
  * The list must be freed by the caller via the vsc_mgmt_uuid_list_free
  * function.
  */
-VscMgmtUuid * /* vm_uuid_list */
-vsc_mgmt_host_get_vm_list (VscMgmtError *error,
-                           const VscMgmtIpv4 *host_ipv4 ATTR_UNUSED)
+struct VscMgmtUuid * /* vm_uuid_list */
+vsc_mgmt_host_get_vm_list (struct VscMgmtError *error,
+                           const struct VscMgmtIpv4 *host_ipv4 ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -249,10 +251,10 @@ vsc_mgmt_host_get_vm_list (VscMgmtError *error,
  * Caller must lock the internal mutex before calling.
  */
 virConnectPtr
-_vsc_mgmt_host_connect (VscMgmtError *error,
-                        const VscMgmtHostInfo *host_info)
+_vsc_mgmt_host_connect (struct VscMgmtError *error,
+                        const struct VscMgmtHostInfo *host_info)
 {
-       HostConnection *host_connection = NULL;
+       struct HostConnection *host_connection = NULL;
        char ipv4_string[VSC_MGMT__IPV4__STRING_SIZE] = "";
        char uri[256];
 
@@ -262,12 +264,12 @@ _vsc_mgmt_host_connect (VscMgmtError *error,
        host_connection = _host_connection_list_lookup (&host_info->host_ipv4);
 
        if (host_connection != NULL) {
-               host_connection->refcount++;
+               ++host_connection->refcount;
 
                return host_connection->connection;
        }
 
-       host_connection = calloc (1, sizeof (HostConnection));
+       host_connection = calloc (1, sizeof (struct HostConnection));
 
        if (host_connection == NULL) {
                _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__OUT_OF_MEMORY);
@@ -318,7 +320,8 @@ _vsc_mgmt_host_connect (VscMgmtError *error,
        }
 
        _host_connection_auth.cbdata = (void *) host_info;
-       host_connection->connection = virConnectOpenAuth (uri, &_host_connection_auth, 0);
+       host_connection->connection = virConnectOpenAuth
+                                        (uri, &_host_connection_auth, 0);
        _host_connection_auth.cbdata = NULL;
 
        if (host_connection->connection == NULL) {
@@ -329,8 +332,8 @@ _vsc_mgmt_host_connect (VscMgmtError *error,
        if (_host_connection_list == NULL) {
                _host_connection_list = host_connection;
        } else {
-               _vsc_mgmt_list_get_last
-               ((VscMgmtList *) _host_connection_list)->next = (VscMgmtList *) host_connection;
+               _vsc_mgmt_list_get_last ((struct VscMgmtList *) _host_connection_list)
+                  ->next = (struct VscMgmtList *) host_connection;
        }
 
        return host_connection->connection;
@@ -349,10 +352,10 @@ failure:
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_host_disconnect (VscMgmtError *error,
-                           const VscMgmtIpv4 *host_ipv4)
+_vsc_mgmt_host_disconnect (struct VscMgmtError *error,
+                           const struct VscMgmtIpv4 *host_ipv4)
 {
-       HostConnection *host_connection = NULL;
+       struct HostConnection *host_connection = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -367,7 +370,7 @@ _vsc_mgmt_host_disconnect (VscMgmtError *error,
 
        _VSC_MGMT__ASSERT (host_connection->refcount > 0);
 
-       host_connection->refcount--;
+       --host_connection->refcount;
 
        if (host_connection->refcount == 0) {
                _host_connection_list_remove (host_connection);
index 7ab8096..17fc812 100644 (file)
@@ -37,8 +37,8 @@
  * Caller must lock the internal mutex before calling.
  */
 virConnectPtr
-_vsc_mgmt_host_connect (VscMgmtError *error,
-                        const VscMgmtHostInfo *host_info);
+_vsc_mgmt_host_connect (struct VscMgmtError *error,
+                        const struct VscMgmtHostInfo *host_info);
 
 /**
  * Decreases the refcount for the connection to this host.
@@ -48,6 +48,7 @@ _vsc_mgmt_host_connect (VscMgmtError *error,
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_host_disconnect (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4);
+_vsc_mgmt_host_disconnect (struct VscMgmtError *error,
+                           const struct VscMgmtIpv4 *host_ipv4);
 
 #endif /* __VSC_MGMT__LIB__HOST_H__ */
index 66267c4..b319850 100644 (file)
 
 static int _internal_initialized = FALSE;
 static char *_internal_config;
-static VscMgmtMutex *_internal_mutex = NULL;
+static struct VscMgmtMutex *_internal_mutex = NULL;
 /*
  * FIXME: Replace the host list with a data structure that allows faster lookup.
  */
-static VscMgmtHostInfo *_internal_host_info_list = NULL;
+static struct VscMgmtHostInfo *_internal_host_info_list = NULL;
 
 void
-_vsc_mgmt_internal_init (VscMgmtError *error, const char *config)
+_vsc_mgmt_internal_init (struct VscMgmtError *error, const char *config)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -92,7 +92,7 @@ _vsc_mgmt_internal_unlock (void)
 }
 
 void
-_vsc_mgmt_internal_backup (VscMgmtError *error)
+_vsc_mgmt_internal_backup (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -101,7 +101,7 @@ _vsc_mgmt_internal_backup (VscMgmtError *error)
 }
 
 void
-_vsc_mgmt_internal_recover (VscMgmtError *error)
+_vsc_mgmt_internal_recover (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -110,8 +110,8 @@ _vsc_mgmt_internal_recover (VscMgmtError *error)
 }
 
 void
-_vsc_mgmt_internal_host_add (VscMgmtError *error,
-                             const VscMgmtHostInfo *host_info)
+_vsc_mgmt_internal_host_add (struct VscMgmtError *error,
+                             const struct VscMgmtHostInfo *host_info)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -124,7 +124,7 @@ _vsc_mgmt_internal_host_add (VscMgmtError *error,
        }
 
        _internal_host_info_list = _vsc_mgmt_host_info_list_append
-                                  (error, _internal_host_info_list, host_info);
+                                     (error, _internal_host_info_list, host_info);
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -133,10 +133,10 @@ _vsc_mgmt_internal_host_add (VscMgmtError *error,
 }
 
 void
-_vsc_mgmt_internal_host_remove (VscMgmtError *error,
-                                const VscMgmtIpv4 *host_ipv4)
+_vsc_mgmt_internal_host_remove (struct VscMgmtError *error,
+                                const struct VscMgmtIpv4 *host_ipv4)
 {
-       VscMgmtHostInfo *host_info = NULL;
+       struct VscMgmtHostInfo *host_info = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -151,13 +151,13 @@ _vsc_mgmt_internal_host_remove (VscMgmtError *error,
        }
 
        _internal_host_info_list = _vsc_mgmt_host_info_list_remove
-                                  (_internal_host_info_list, host_info);
+                                     (_internal_host_info_list, host_info);
 }
 
 void
-_vsc_mgmt_internal_host_get_info (VscMgmtError *error,
-                                  const VscMgmtIpv4 *host_ipv4 ATTR_UNUSED,
-                                  VscMgmtHostInfo *host_info ATTR_UNUSED)
+_vsc_mgmt_internal_host_get_info (struct VscMgmtError *error,
+                                  const struct VscMgmtIpv4 *host_ipv4 ATTR_UNUSED,
+                                  struct VscMgmtHostInfo *host_info ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -165,8 +165,8 @@ _vsc_mgmt_internal_host_get_info (VscMgmtError *error,
        _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__NOT_IMPLEMENTED_YET);
 }
 
-VscMgmtIpv4 * /* host_ipv4_list */
-_vsc_mgmt_internal_get_host_list (VscMgmtError *error)
+struct VscMgmtIpv4 * /* host_ipv4_list */
+_vsc_mgmt_internal_host_get_list (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
index 15a7ad6..e2f3f17 100644 (file)
@@ -28,7 +28,7 @@
  * Function is not threadsafe.
  */
 void
-_vsc_mgmt_internal_init (VscMgmtError *error, const char *config);
+_vsc_mgmt_internal_init (struct VscMgmtError *error, const char *config);
 
 /**
  *
@@ -48,45 +48,45 @@ _vsc_mgmt_internal_unlock (void);
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_internal_backup (VscMgmtError *error);
+_vsc_mgmt_internal_backup (struct VscMgmtError *error);
 
 /**
  *
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_internal_recover (VscMgmtError *error);
+_vsc_mgmt_internal_recover (struct VscMgmtError *error);
 
 /**
  *
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_internal_host_add (VscMgmtError *error,
-                             const VscMgmtHostInfo *host_info);
+_vsc_mgmt_internal_host_add (struct VscMgmtError *error,
+                             const struct VscMgmtHostInfo *host_info);
 
 /**
  *
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_internal_host_remove (VscMgmtError *error,
-                                const VscMgmtIpv4 *host_ipv4);
+_vsc_mgmt_internal_host_remove (struct VscMgmtError *error,
+                                const struct VscMgmtIpv4 *host_ipv4);
 
 /**
  *
  * Caller must lock the internal mutex before calling.
  */
 void
-_vsc_mgmt_internal_host_get_info (VscMgmtError *error,
-                                  const VscMgmtIpv4 *host_ipv4,
-                                  VscMgmtHostInfo *host_info);
+_vsc_mgmt_internal_host_get_info (struct VscMgmtError *error,
+                                  const struct VscMgmtIpv4 *host_ipv4,
+                                  struct VscMgmtHostInfo *host_info);
 
 /**
  *
  * Caller must lock the internal mutex before calling.
  */
-VscMgmtIpv4 * /* host_ipv4_list */
-_vsc_mgmt_internal_get_host_list (VscMgmtError *error);
+struct VscMgmtIpv4 * /* host_ipv4_list */
+_vsc_mgmt_internal_host_get_list (struct VscMgmtError *error);
 
 #endif /* __VSC_MGMT__LIB__INTERNAL_H__ */
index afcc987..c7b478b 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "lib.h"
 
-VscMgmtUuid * /* network_uuid */
-vsc_mgmt_network_setup (VscMgmtError *error, int num_hosts ATTR_UNUSED)
+struct VscMgmtUuid * /* network_uuid */
+vsc_mgmt_network_setup (struct VscMgmtError *error, int num_hosts ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -32,8 +32,8 @@ vsc_mgmt_network_setup (VscMgmtError *error, int num_hosts ATTR_UNUSED)
 }
 
 void
-vsc_mgmt_network_teardown (VscMgmtError *error,
-                           const VscMgmtUuid *network_uuid ATTR_UNUSED)
+vsc_mgmt_network_teardown (struct VscMgmtError *error,
+                           const struct VscMgmtUuid *network_uuid ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -42,8 +42,8 @@ vsc_mgmt_network_teardown (VscMgmtError *error,
 }
 
 void
-_vsc_mgmt_network_init (VscMgmtError *error,
-                        const VscMgmtNetwork *network_list ATTR_UNUSED)
+_vsc_mgmt_network_init (struct VscMgmtError *error,
+                        const struct VscMgmtNetwork *network_list ATTR_UNUSED)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
index 8ec2c5e..c9997ef 100644 (file)
@@ -24,8 +24,8 @@
 #include "../include/libvscmgmt/types.h"
 
 void
-_vsc_mgmt_network_init (VscMgmtError *error,
-                        const VscMgmtNetwork *network_list);
+_vsc_mgmt_network_init (struct VscMgmtError *error,
+                        const struct VscMgmtNetwork *network_list);
 
 void
 _vsc_mgmt_network_cleanup (void);
index d868810..5e3288e 100644 (file)
@@ -27,7 +27,7 @@
 #include "../utils/utils.h"
 
 static void
-_error_from_xmlrpc (VscMgmtError *error, const xmlrpc_env *env,
+_error_from_xmlrpc (struct VscMgmtError *error, const xmlrpc_env *env,
                     const char *file, const char *function, int line)
 {
        _vsc_mgmt_error_report (error, VSC_MGMT__CODE__XMLRPC_ERROR, file, line,
@@ -45,8 +45,8 @@ _error_from_xmlrpc (VscMgmtError *error, const xmlrpc_env *env,
 static char *_proxy_url = NULL;
 
 void
-vsc_mgmt_init (VscMgmtError *error, const char *config ATTR_UNUSED,
-               const VscMgmtNetwork *network_list ATTR_UNUSED)
+vsc_mgmt_init (struct VscMgmtError *error, const char *config ATTR_UNUSED,
+               const struct VscMgmtNetwork *network_list ATTR_UNUSED)
 {
        xmlrpc_env env;
        char *proxy_url = NULL;
@@ -113,7 +113,8 @@ vsc_mgmt_cleanup (void)
  */
 
 void
-vsc_mgmt_host_add (VscMgmtError *error, const VscMgmtHostInfo *host_info)
+vsc_mgmt_host_add (struct VscMgmtError *error,
+                   const struct VscMgmtHostInfo *host_info)
 {
        xmlrpc_env env;
        char host_ipv4_string[VSC_MGMT__IPV4__STRING_SIZE] = "";
@@ -155,7 +156,8 @@ cleanup:
 }
 
 void
-vsc_mgmt_host_remove (VscMgmtError *error, const VscMgmtIpv4 *host_ipv4)
+vsc_mgmt_host_remove (struct VscMgmtError *error,
+                      const struct VscMgmtIpv4 *host_ipv4)
 {
        xmlrpc_env env;
        char host_ipv4_string[VSC_MGMT__IPV4__STRING_SIZE] = "";
index 6a73732..aec67bf 100644 (file)
@@ -25,7 +25,7 @@
 static void
 setup (void)
 {
-       VscMgmtError error;
+       struct VscMgmtError error;
 
        vsc_mgmt_error_init (&error);
 
@@ -46,8 +46,8 @@ teardown (void)
 
 START_TEST (test_add_remove)
 {
-       VscMgmtError error;
-       VscMgmtHostInfo host_info;
+       struct VscMgmtError error;
+       struct VscMgmtHostInfo host_info;
 
        vsc_mgmt_error_init (&error);
 
index 5b5d59f..2d8f721 100644 (file)
@@ -24,8 +24,8 @@
 
 START_TEST (test_parse)
 {
-       VscMgmtError error;
-       VscMgmtIpv4 ipv4;
+       struct VscMgmtError error;
+       struct VscMgmtIpv4 ipv4;
 
        vsc_mgmt_error_init (&error);
 
index 94526b1..8a547bb 100644 (file)
@@ -24,8 +24,8 @@
 
 START_TEST (test_parse)
 {
-       VscMgmtError error;
-       VscMgmtUuid uuid;
+       struct VscMgmtError error;
+       struct VscMgmtUuid uuid;
 
        vsc_mgmt_error_init (&error);
 
index d8e33ee..8ec30db 100644 (file)
@@ -30,7 +30,7 @@
 static const char *_error_default_message
                    = "Could not allocate memory for error message";
 
-static VscMgmtError _error_default = {
+static struct VscMgmtError _error_default = {
        .next = NULL,
        .occured = TRUE,
        .code = VSC_MGMT__CODE__OUT_OF_MEMORY,
@@ -41,7 +41,7 @@ static VscMgmtError _error_default = {
 };
 
 static void
-_error_report_v (VscMgmtError *error, VscMgmtCode code,
+_error_report_v (struct VscMgmtError *error, enum VscMgmtCode code,
                  const char *file, int line, const char *function,
                  const char *message, va_list args)
 {
@@ -72,7 +72,7 @@ _error_report_v (VscMgmtError *error, VscMgmtCode code,
 }
 
 const char *
-vsc_mgmt_error_string (VscMgmtCode code)
+vsc_mgmt_error_string (enum VscMgmtCode code)
 {
        switch (code) {
        case VSC_MGMT__CODE__INTERNAL_ERROR:
@@ -126,10 +126,10 @@ vsc_mgmt_error_string (VscMgmtCode code)
 }
 
 void
-vsc_mgmt_error_fprint (VscMgmtError *error, FILE *stream)
+vsc_mgmt_error_fprint (struct VscMgmtError *error, FILE *stream)
 {
        struct tm time_info;
-       VscMgmtError *error_next = NULL;
+       struct VscMgmtError *error_next = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (error->occured);
@@ -168,7 +168,7 @@ vsc_mgmt_error_fprint (VscMgmtError *error, FILE *stream)
 }
 
 void
-vsc_mgmt_error_init (VscMgmtError *error)
+vsc_mgmt_error_init (struct VscMgmtError *error)
 {
        _VSC_MGMT__ASSERT (error != NULL);
 
@@ -184,10 +184,10 @@ vsc_mgmt_error_init (VscMgmtError *error)
 }
 
 void
-vsc_mgmt_error_cleanup (VscMgmtError *error)
+vsc_mgmt_error_cleanup (struct VscMgmtError *error)
 {
-       VscMgmtError *current;
-       VscMgmtError *next;
+       struct VscMgmtError *current;
+       struct VscMgmtError *next;
 
        _VSC_MGMT__ASSERT (error != NULL);
 
@@ -222,12 +222,8 @@ vsc_mgmt_error_cleanup (VscMgmtError *error)
        }
 }
 
-/*
- * Error (Utils)
- */
-
 void
-_vsc_mgmt_error_report (VscMgmtError *error, VscMgmtCode code,
+_vsc_mgmt_error_report (struct VscMgmtError *error, enum VscMgmtCode code,
                         const char *file, int line, const char *function,
                         const char *message, ...)
 {
@@ -239,20 +235,21 @@ _vsc_mgmt_error_report (VscMgmtError *error, VscMgmtCode code,
 }
 
 void
-_vsc_mgmt_error_append_report (VscMgmtError *error, VscMgmtCode code,
-                               const char *file, int line,
-                               const char *function, const char *message, ...)
+_vsc_mgmt_error_append_report (struct VscMgmtError *error,
+                               enum VscMgmtCode code, const char *file,
+                               int line, const char *function,
+                               const char *message, ...)
 {
        va_list args;
-       VscMgmtError *error_last;
-       VscMgmtError *error_next;
+       struct VscMgmtError *error_last;
+       struct VscMgmtError *error_next;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (error->occured);
        _VSC_MGMT__ASSERT (code != VSC_MGMT__CODE__UNDEFINED);
 
-       error_last = (VscMgmtError *) _vsc_mgmt_list_get_last
-                                     ((VscMgmtList *) error);
+       error_last = (struct VscMgmtError *)
+                       _vsc_mgmt_list_get_last ((struct VscMgmtList *) error);
 
        /*
         * Do not append to the default error, because if it is appended we are
@@ -262,7 +259,7 @@ _vsc_mgmt_error_append_report (VscMgmtError *error, VscMgmtCode code,
                return;
        }
 
-       error_next = calloc (1, sizeof (VscMgmtError));
+       error_next = calloc (1, sizeof (struct VscMgmtError));
 
        if (error_next == NULL) {
                error_next = &_error_default;
index 328c16d..ea819e9 100644 (file)
        _vsc_mgmt_error_append_report (error, code, __FILE__, __LINE__, __FUNCTION__, message, __VA_ARGS__)
 
 void
-_vsc_mgmt_error_report (VscMgmtError *error, VscMgmtCode code,
+_vsc_mgmt_error_report (struct VscMgmtError *error, enum VscMgmtCode code,
                         const char *file, int line, const char *function,
                         const char *message, ...) ATTR_PRINTF (6, 7);
 
 void
-_vsc_mgmt_error_append_report (VscMgmtError *error, VscMgmtCode code,
+_vsc_mgmt_error_append_report (struct VscMgmtError *error, enum VscMgmtCode code,
                                const char *file, int line, const char *function,
                                const char *message, ...) ATTR_PRINTF (6, 7);
 
index e55a110..474b5ee 100644 (file)
 #include <strings.h>
 
 static int
-_host_info_match (VscMgmtList *item, void *match_data)
+_host_info_match (struct VscMgmtList *item, void *match_data)
 {
-       return _vsc_mgmt_ipv4_compare (&((VscMgmtHostInfo *) item)->host_ipv4,
-                                      (VscMgmtIpv4 *) match_data) == 0;
+       return _vsc_mgmt_ipv4_compare (&((struct VscMgmtHostInfo *) item)->host_ipv4,
+                                      (struct VscMgmtIpv4 *) match_data) == 0;
 }
 
 /**
  * Parses a host type from its string representation and returns it.
  */
-VscMgmtHostType
-vsc_mgmt_host_type_parse (VscMgmtError *error,
+enum VscMgmtHostType
+vsc_mgmt_host_type_parse (struct VscMgmtError *error,
                           const char *host_type_string)
 {
        _VSC_MGMT__ASSERT (error != NULL);
@@ -64,7 +64,7 @@ vsc_mgmt_host_type_parse (VscMgmtError *error,
  * The string must not be freed by the caller.
  */
 const char *
-vsc_mgmt_host_type_string (VscMgmtHostType host_type)
+vsc_mgmt_host_type_string (enum VscMgmtHostType host_type)
 {
        switch (host_type) {
        case VSC_MGMT__HOST_TYPE__VIRTUAL:
@@ -88,7 +88,7 @@ vsc_mgmt_host_type_string (VscMgmtHostType host_type)
 }
 
 int /* is_invalid */
-_vsc_mgmt_host_type_is_invalid (VscMgmtHostType host_type)
+_vsc_mgmt_host_type_is_invalid (enum VscMgmtHostType host_type)
 {
        switch (host_type) {
        case VSC_MGMT__HOST_TYPE__VIRTUAL:
@@ -103,17 +103,17 @@ _vsc_mgmt_host_type_is_invalid (VscMgmtHostType host_type)
        }
 }
 
-VscMgmtHostInfo * /* host_info_duplicate */
-_vsc_mgmt_host_info_duplicate (VscMgmtError *error,
-                               const VscMgmtHostInfo *host_info)
+struct VscMgmtHostInfo * /* host_info_duplicate */
+_vsc_mgmt_host_info_duplicate (struct VscMgmtError *error,
+                               const struct VscMgmtHostInfo *host_info)
 {
-       VscMgmtHostInfo *host_info_duplicate = NULL;
+       struct VscMgmtHostInfo *host_info_duplicate = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
        host_info_duplicate = _vsc_mgmt_memdup (error, host_info,
-                                               sizeof (VscMgmtHostInfo));
+                                               sizeof (struct VscMgmtHostInfo));
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -121,7 +121,7 @@ _vsc_mgmt_host_info_duplicate (VscMgmtError *error,
        }
 
        host_info_duplicate->host_username = _vsc_mgmt_strdup
-                                            (error, host_info->host_username);
+                                              (error, host_info->host_username);
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -129,7 +129,7 @@ _vsc_mgmt_host_info_duplicate (VscMgmtError *error,
        }
 
        host_info_duplicate->host_password = _vsc_mgmt_strdup
-                                            (error, host_info->host_password);
+                                              (error, host_info->host_password);
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -147,7 +147,7 @@ failure:
 }
 
 void
-_vsc_mgmt_host_info_free (VscMgmtHostInfo *host_info)
+_vsc_mgmt_host_info_free (struct VscMgmtHostInfo *host_info)
 {
        if (host_info != NULL) {
                free (host_info->host_username);
@@ -158,7 +158,7 @@ _vsc_mgmt_host_info_free (VscMgmtHostInfo *host_info)
 }
 
 int /* is_invalid */
-_vsc_mgmt_host_info_is_invalid (const VscMgmtHostInfo *host_info)
+_vsc_mgmt_host_info_is_invalid (const struct VscMgmtHostInfo *host_info)
 {
        if (_vsc_mgmt_ipv4_is_invalid (&host_info->host_ipv4)) {
                return TRUE;
@@ -187,18 +187,19 @@ _vsc_mgmt_host_info_is_invalid (const VscMgmtHostInfo *host_info)
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtHostInfo * /* host_info_list */
-_vsc_mgmt_host_info_list_append (VscMgmtError *error,
-                                 VscMgmtHostInfo *host_info_list,
-                                 const VscMgmtHostInfo *host_info)
+struct VscMgmtHostInfo * /* host_info_list */
+_vsc_mgmt_host_info_list_append (struct VscMgmtError *error,
+                                 struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtHostInfo *host_info)
 {
        /*
         * FIXME: Error trace
         */
-       return (VscMgmtHostInfo *)
-              _vsc_mgmt_list_append
-              (error, (VscMgmtList *) host_info_list, (VscMgmtList *) host_info,
-               (VscMgmtList_DuplicateFunction) _vsc_mgmt_host_info_duplicate);
+       return (struct VscMgmtHostInfo *)
+                _vsc_mgmt_list_append
+                  (error, (struct VscMgmtList *) host_info_list,
+                   (struct VscMgmtList *) host_info,
+                   (VscMgmtList_DuplicateFunction) _vsc_mgmt_host_info_duplicate);
 }
 
 /**
@@ -207,14 +208,15 @@ _vsc_mgmt_host_info_list_append (VscMgmtError *error,
  * The first host info that the matchs the IPv4 is returned. If no match occurs
  * NULL is returned.
  */
-VscMgmtHostInfo * /* host_info */
-_vsc_mgmt_host_info_list_lookup (const VscMgmtHostInfo *host_info_list,
-                                 const VscMgmtIpv4 *host_ipv4)
+struct VscMgmtHostInfo * /* host_info */
+_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtIpv4 *host_ipv4)
 {
-       return (VscMgmtHostInfo *) _vsc_mgmt_list_lookup
-                                  ((VscMgmtList *) host_info_list,
-                                   (VscMgmtList_MatchFunction) _host_info_match,
-                                   (void *) host_ipv4);
+       return (struct VscMgmtHostInfo *)
+                _vsc_mgmt_list_lookup
+                  ((struct VscMgmtList *) host_info_list,
+                   (VscMgmtList_MatchFunction) _host_info_match,
+                   (void *) host_ipv4);
 }
 
 /**
@@ -225,22 +227,23 @@ _vsc_mgmt_host_info_list_lookup (const VscMgmtHostInfo *host_info_list,
  *
  * If the host info is not in the list then the list is untouched.
  */
-VscMgmtHostInfo * /* host_info_list */
-_vsc_mgmt_host_info_list_remove (VscMgmtHostInfo *host_info_list,
-                                 VscMgmtHostInfo *host_info)
+struct VscMgmtHostInfo * /* host_info_list */
+_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo *host_info_list,
+                                 struct VscMgmtHostInfo *host_info)
 {
-       return (VscMgmtHostInfo *)
-               _vsc_mgmt_list_remove
-               ((VscMgmtList *) host_info_list, (VscMgmtList *) host_info,
-                (VscMgmtList_FreeFunction) _vsc_mgmt_host_info_free);
+       return (struct VscMgmtHostInfo *)
+                 _vsc_mgmt_list_remove
+                    ((struct VscMgmtList *) host_info_list,
+                     (struct VscMgmtList *) host_info,
+                     (VscMgmtList_FreeFunction) _vsc_mgmt_host_info_free);
 }
 
 /**
  * Recursively frees the host info list.
  */
 void
-_vsc_mgmt_host_info_list_free (VscMgmtHostInfo *host_info_list)
+_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo *host_info_list)
 {
-       _vsc_mgmt_list_free ((VscMgmtList *) host_info_list,
+       _vsc_mgmt_list_free ((struct VscMgmtList *) host_info_list,
                             (VscMgmtList_FreeFunction) _vsc_mgmt_host_info_free);
 }
index a4fb79b..cc95f4c 100644 (file)
 #include "../include/libvscmgmt/types.h"
 
 int /* is_invalid */
-_vsc_mgmt_host_type_is_invalid (VscMgmtHostType host_type);
+_vsc_mgmt_host_type_is_invalid (enum VscMgmtHostType host_type);
 
-VscMgmtHostInfo * /* host_info_duplicate */
-_vsc_mgmt_host_info_duplicate (VscMgmtError *error,
-                               const VscMgmtHostInfo *host_info);
+struct VscMgmtHostInfo * /* host_info_duplicate */
+_vsc_mgmt_host_info_duplicate (struct VscMgmtError *error,
+                               const struct VscMgmtHostInfo *host_info);
 
 void
-_vsc_mgmt_host_info_free (VscMgmtHostInfo *host_info);
+_vsc_mgmt_host_info_free (struct VscMgmtHostInfo *host_info);
 
 int /* is_invalid */
-_vsc_mgmt_host_info_is_invalid (const VscMgmtHostInfo *host_info);
+_vsc_mgmt_host_info_is_invalid (const struct VscMgmtHostInfo *host_info);
 
 /**
  * Appends a duplicate of the host info to the list.
@@ -44,10 +44,10 @@ _vsc_mgmt_host_info_is_invalid (const VscMgmtHostInfo *host_info);
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtHostInfo * /* host_info_list */
-_vsc_mgmt_host_info_list_append (VscMgmtError *error,
-                                 VscMgmtHostInfo *host_info_list,
-                                 const VscMgmtHostInfo *host_info);
+struct VscMgmtHostInfo * /* host_info_list */
+_vsc_mgmt_host_info_list_append (struct VscMgmtError *error,
+                                 struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtHostInfo *host_info);
 
 /**
  * Looks up an host info in the list.
@@ -55,9 +55,9 @@ _vsc_mgmt_host_info_list_append (VscMgmtError *error,
  * The first host info that the matchs the IPv4 is returned. If no match occurs
  * NULL is returned.
  */
-VscMgmtHostInfo * /* host_info */
-_vsc_mgmt_host_info_list_lookup (const VscMgmtHostInfo *host_info_list,
-                                 const VscMgmtIpv4 *host_ipv4);
+struct VscMgmtHostInfo * /* host_info */
+_vsc_mgmt_host_info_list_lookup (const struct VscMgmtHostInfo *host_info_list,
+                                 const struct VscMgmtIpv4 *host_ipv4);
 
 /**
  * Removes the host info from the list and frees it.
@@ -67,14 +67,14 @@ _vsc_mgmt_host_info_list_lookup (const VscMgmtHostInfo *host_info_list,
  *
  * If the host info is not in the list then the list is untouched.
  */
-VscMgmtHostInfo * /* host_info_list */
-_vsc_mgmt_host_info_list_remove (VscMgmtHostInfo *host_info_list,
-                                 VscMgmtHostInfo *host_info);
+struct VscMgmtHostInfo * /* host_info_list */
+_vsc_mgmt_host_info_list_remove (struct VscMgmtHostInfo *host_info_list,
+                                 struct VscMgmtHostInfo *host_info);
 
 /**
  * Recursively frees the host info list.
  */
 void
-_vsc_mgmt_host_info_list_free (VscMgmtHostInfo *host_info_list);
+_vsc_mgmt_host_info_list_free (struct VscMgmtHostInfo *host_info_list);
 
 #endif /* __VSC_MGMT__UTILS__HOST_H__ */
index f0137cd..4599ab3 100644 (file)
@@ -27,8 +27,8 @@
  * Parses an IPv4 from its string representation.
  */
 void
-vsc_mgmt_ipv4_parse (VscMgmtError *error, const char *ipv4_string,
-                     VscMgmtIpv4 *ipv4)
+vsc_mgmt_ipv4_parse (struct VscMgmtError *error, const char *ipv4_string,
+                     struct VscMgmtIpv4 *ipv4)
 {
        int i;
        char *tail = (char *) ipv4_string;
@@ -79,7 +79,7 @@ vsc_mgmt_ipv4_parse (VscMgmtError *error, const char *ipv4_string,
  * Formats an IPv4 to its string representation.
  */
 void
-vsc_mgmt_ipv4_format (const VscMgmtIpv4 *ipv4, char *ipv4_string)
+vsc_mgmt_ipv4_format (const struct VscMgmtIpv4 *ipv4, char *ipv4_string)
 {
        snprintf (ipv4_string, VSC_MGMT__IPV4__STRING_SIZE, "%u.%u.%u.%u",
                  ipv4->bytes[0], ipv4->bytes[1], ipv4->bytes[2], ipv4->bytes[3]);
@@ -93,31 +93,44 @@ vsc_mgmt_ipv4_format (const VscMgmtIpv4 *ipv4, char *ipv4_string)
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtIpv4 * /* ipv4_list */
-vsc_mgmt_ipv4_list_append (VscMgmtError *error, VscMgmtIpv4 *ipv4_list,
-                           const VscMgmtIpv4 *ipv4)
+struct VscMgmtIpv4 * /* ipv4_list */
+vsc_mgmt_ipv4_list_append (struct VscMgmtError *error,
+                           struct VscMgmtIpv4 *ipv4_list,
+                           const struct VscMgmtIpv4 *ipv4)
 {
-       /*
-        * FIXME: Error trace
-        */
-       return (VscMgmtIpv4 *)
-              _vsc_mgmt_list_append
-              (error, (VscMgmtList *) ipv4_list, (VscMgmtList *) ipv4,
-               (VscMgmtList_DuplicateFunction) _vsc_mgmt_ipv4_duplicate);
+       struct VscMgmtIpv4 *new_ipv4_list;
+
+       _VSC_MGMT__ASSERT (error != NULL);
+       _VSC_MGMT__ASSERT (! error->occured);
+
+       new_ipv4_list =
+          (struct VscMgmtIpv4 *)
+             _vsc_mgmt_list_append
+                (error, (struct VscMgmtList *) ipv4_list,
+                 (struct VscMgmtList *) ipv4,
+                 (VscMgmtList_DuplicateFunction) _vsc_mgmt_ipv4_duplicate);
+
+       if (error->occured) {
+               _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
+               return ipv4_list;
+       }
+
+       return new_ipv4_list;
 }
 
 /**
  * Recursively frees the IPv4 list.
  */
 void
-vsc_mgmt_ipv4_list_free (VscMgmtIpv4 *ipv4_list)
+vsc_mgmt_ipv4_list_free (struct VscMgmtIpv4 *ipv4_list)
 {
-       _vsc_mgmt_list_free ((VscMgmtList *) ipv4_list,
+       _vsc_mgmt_list_free ((struct VscMgmtList *) ipv4_list,
                             (VscMgmtList_FreeFunction) _vsc_mgmt_ipv4_free);
 }
 
 void
-_vsc_mgmt_ipv4_copy (VscMgmtIpv4 *ipv4_dest, const VscMgmtIpv4 *ipv4_src)
+_vsc_mgmt_ipv4_copy (struct VscMgmtIpv4 *ipv4_dest,
+                     const struct VscMgmtIpv4 *ipv4_src)
 {
        ipv4_dest->next = NULL;
 
@@ -125,15 +138,17 @@ _vsc_mgmt_ipv4_copy (VscMgmtIpv4 *ipv4_dest, const VscMgmtIpv4 *ipv4_src)
                VSC_MGMT__IPV4__SIZE * sizeof (unsigned char));
 }
 
-VscMgmtIpv4 * /* ipv4_duplicate */
-_vsc_mgmt_ipv4_duplicate (VscMgmtError *error, const VscMgmtIpv4 *ipv4)
+struct VscMgmtIpv4 * /* ipv4_duplicate */
+_vsc_mgmt_ipv4_duplicate (struct VscMgmtError *error,
+                          const struct VscMgmtIpv4 *ipv4)
 {
-       VscMgmtIpv4 *ipv4_duplicate = NULL;
+       struct VscMgmtIpv4 *ipv4_duplicate = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       ipv4_duplicate = _vsc_mgmt_memdup (error, ipv4, sizeof (VscMgmtIpv4));
+       ipv4_duplicate = _vsc_mgmt_memdup (error, ipv4,
+                                          sizeof (struct VscMgmtIpv4));
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -146,20 +161,21 @@ _vsc_mgmt_ipv4_duplicate (VscMgmtError *error, const VscMgmtIpv4 *ipv4)
 }
 
 void
-_vsc_mgmt_ipv4_free (VscMgmtIpv4 *ipv4)
+_vsc_mgmt_ipv4_free (struct VscMgmtIpv4 *ipv4)
 {
        free (ipv4);
 }
 
 int /* is_invalid */
-_vsc_mgmt_ipv4_is_invalid (const VscMgmtIpv4 *ipv4)
+_vsc_mgmt_ipv4_is_invalid (const struct VscMgmtIpv4 *ipv4)
 {
        return ipv4->bytes[0] == 0 && ipv4->bytes[1] == 0 &&
               ipv4->bytes[2] == 0 && ipv4->bytes[3] == 0;
 }
 
 int
-_vsc_mgmt_ipv4_compare (const VscMgmtIpv4 *ipv4a, const VscMgmtIpv4 *ipv4b)
+_vsc_mgmt_ipv4_compare (const struct VscMgmtIpv4 *ipv4a,
+                        const struct VscMgmtIpv4 *ipv4b)
 {
        int i;
 
index 2195974..5a939fe 100644 (file)
 #include "types.h"
 
 void
-_vsc_mgmt_ipv4_copy (VscMgmtIpv4 *ipv4_dest, const VscMgmtIpv4 *ipv4_src);
+_vsc_mgmt_ipv4_copy (struct VscMgmtIpv4 *ipv4_dest,
+                     const struct VscMgmtIpv4 *ipv4_src);
 
-VscMgmtIpv4 * /* ipv4_duplicate */
-_vsc_mgmt_ipv4_duplicate (VscMgmtError *error, const VscMgmtIpv4 *ipv4);
+struct VscMgmtIpv4 * /* ipv4_duplicate */
+_vsc_mgmt_ipv4_duplicate (struct VscMgmtError *error,
+                          const struct VscMgmtIpv4 *ipv4);
 
 void
-_vsc_mgmt_ipv4_free (VscMgmtIpv4 *ipv4);
+_vsc_mgmt_ipv4_free (struct VscMgmtIpv4 *ipv4);
 
 int /* is_invalid */
-_vsc_mgmt_ipv4_is_invalid (const VscMgmtIpv4 *ipv4);
+_vsc_mgmt_ipv4_is_invalid (const struct VscMgmtIpv4 *ipv4);
 
 int
-_vsc_mgmt_ipv4_compare (const VscMgmtIpv4 *ipv4a, const VscMgmtIpv4 *ipv4b);
+_vsc_mgmt_ipv4_compare (const struct VscMgmtIpv4 *ipv4a,
+                        const struct VscMgmtIpv4 *ipv4b);
 
 #endif /* __VSC_MGMT__UTILS__IPV4_H__ */
index 2c69efa..6c6c12e 100644 (file)
 /**
  * Returns the last item from the list.
  */
-VscMgmtList * /* last_item */
-_vsc_mgmt_list_get_last (VscMgmtList *list)
+struct VscMgmtList * /* last_item */
+_vsc_mgmt_list_get_last (struct VscMgmtList *list)
 {
-       VscMgmtList *item;
+       struct VscMgmtList *item;
 
        if (list == NULL) {
                return NULL;
@@ -51,12 +51,12 @@ _vsc_mgmt_list_get_last (VscMgmtList *list)
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtList * /* list */
-_vsc_mgmt_list_append (VscMgmtError *error, VscMgmtList *list,
-                       VscMgmtList *item,
+struct VscMgmtList * /* list */
+_vsc_mgmt_list_append (struct VscMgmtError *error, struct VscMgmtList *list,
+                       struct VscMgmtList *item,
                        VscMgmtList_DuplicateFunction duplicate_function)
 {
-       VscMgmtList *duplicate = NULL;
+       struct VscMgmtList *duplicate = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -83,14 +83,14 @@ _vsc_mgmt_list_append (VscMgmtError *error, VscMgmtList *list,
  * The first item for that the match function returns TRUE is returned. If no
  * match occurs NULL is returned.
  */
-VscMgmtList * /* item */
-_vsc_mgmt_list_lookup (const VscMgmtList *list,
+struct VscMgmtList * /* item */
+_vsc_mgmt_list_lookup (const struct VscMgmtList *list,
                        VscMgmtList_MatchFunction match_function,
                        void *match_data)
 {
-       VscMgmtList *item = NULL;
+       struct VscMgmtList *item = NULL;
 
-       for (item = (VscMgmtList *) list; item != NULL; item = item->next) {
+       for (item = (struct VscMgmtList *) list; item != NULL; item = item->next) {
                if (match_function (item, match_data)) {
                        return item;
                }
@@ -107,13 +107,13 @@ _vsc_mgmt_list_lookup (const VscMgmtList *list,
  *
  * If the item is not in the list then the list is untouched.
  */
-VscMgmtList * /* list */
-_vsc_mgmt_list_remove (VscMgmtList *list, VscMgmtList *item,
+struct VscMgmtList * /* list */
+_vsc_mgmt_list_remove (struct VscMgmtList *list, struct VscMgmtList *item,
                        VscMgmtList_FreeFunction free_function)
 {
-       VscMgmtList *previous_item = NULL;
-       VscMgmtList *current_item = NULL;
-       VscMgmtList *list_head = NULL;
+       struct VscMgmtList *previous_item = NULL;
+       struct VscMgmtList *current_item = NULL;
+       struct VscMgmtList *list_head = NULL;
 
        _VSC_MGMT__ASSERT (list != NULL);
        _VSC_MGMT__ASSERT (item != NULL);
@@ -148,11 +148,11 @@ _vsc_mgmt_list_remove (VscMgmtList *list, VscMgmtList *item,
  * Recursively frees the list.
  */
 void
-_vsc_mgmt_list_free (VscMgmtList *list,
+_vsc_mgmt_list_free (struct VscMgmtList *list,
                      VscMgmtList_FreeFunction free_function)
 {
-       VscMgmtList *item;
-       VscMgmtList *next_item;
+       struct VscMgmtList *item;
+       struct VscMgmtList *next_item;
 
        if (list == NULL) {
                return;
index 58716b0..04b90cc 100644 (file)
@@ -26,8 +26,8 @@
 /**
  * Returns the last item from the list.
  */
-VscMgmtList * /* last_item */
-_vsc_mgmt_list_get_last (VscMgmtList *list);
+struct VscMgmtList * /* last_item */
+_vsc_mgmt_list_get_last (struct VscMgmtList *list);
 
 /**
  * Appends a duplicate of the item to the list.
@@ -37,9 +37,9 @@ _vsc_mgmt_list_get_last (VscMgmtList *list);
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtList * /* list */
-_vsc_mgmt_list_append (VscMgmtError *error, VscMgmtList *list,
-                       VscMgmtList *item,
+struct VscMgmtList * /* list */
+_vsc_mgmt_list_append (struct VscMgmtError *error, struct VscMgmtList *list,
+                       struct VscMgmtList *item,
                        VscMgmtList_DuplicateFunction duplicate_function);
 
 /**
@@ -48,8 +48,8 @@ _vsc_mgmt_list_append (VscMgmtError *error, VscMgmtList *list,
  * The first item for that the match function returns TRUE is returned. If no
  * match occurs NULL is returned.
  */
-VscMgmtList * /* item */
-_vsc_mgmt_list_lookup (const VscMgmtList *list,
+struct VscMgmtList * /* item */
+_vsc_mgmt_list_lookup (const struct VscMgmtList *list,
                        VscMgmtList_MatchFunction match_function,
                        void *match_data);
 
@@ -61,15 +61,15 @@ _vsc_mgmt_list_lookup (const VscMgmtList *list,
  *
  * If the item is not in the list then the list is untouched.
  */
-VscMgmtList * /* list */
-_vsc_mgmt_list_remove (VscMgmtList *list, VscMgmtList *item,
+struct VscMgmtList * /* list */
+_vsc_mgmt_list_remove (struct VscMgmtList *list, struct VscMgmtList *item,
                        VscMgmtList_FreeFunction free_function);
 
 /**
  * Recursively frees the list.
  */
 void
-_vsc_mgmt_list_free (VscMgmtList *list,
+_vsc_mgmt_list_free (struct VscMgmtList *list,
                      VscMgmtList_FreeFunction free_function);
 
 #endif /* __VSC_MGMT__UTILS__LIST_H__ */
index 301311b..c6f7c85 100644 (file)
@@ -24,7 +24,7 @@
 #include <memory.h>
 
 void *
-_vsc_mgmt_memdup (VscMgmtError *error, const void *memory, size_t size)
+_vsc_mgmt_memdup (struct VscMgmtError *error, const void *memory, size_t size)
 {
        void *memory_duplicate = NULL;
 
index cd06a99..640cb82 100644 (file)
@@ -24,6 +24,6 @@
 #include "../include/libvscmgmt/types.h"
 
 void *
-_vsc_mgmt_memdup (VscMgmtError *error, const void *memory, size_t size);
+_vsc_mgmt_memdup (struct VscMgmtError *error, const void *memory, size_t size);
 
 #endif /* __VSC_MGMT__UTILS__MEMORY_H__ */
index ec846f9..afe6cfa 100644 (file)
 
 #include <malloc.h>
 
-struct _VscMgmtMutex {
+struct VscMgmtMutex {
     int nothing;
 };
 
 /**
  * Allocates and initializes an initially unlocked mutex and returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new (VscMgmtError *error)
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new (struct VscMgmtError *error)
 {
-       VscMgmtMutex *mutex = NULL;
+       struct VscMgmtMutex *mutex = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       mutex = calloc (1, sizeof (struct _VscMgmtMutex));
+       mutex = calloc (1, sizeof (struct VscMgmtMutex));
 
        if (mutex == NULL) {
                _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__OUT_OF_MEMORY);
@@ -51,15 +51,15 @@ _vsc_mgmt_mutex_new (VscMgmtError *error)
  * Allocates and initializes an initially unlocked, recursive mutex and
  * returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new_recursive (VscMgmtError *error)
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new_recursive (struct VscMgmtError *error)
 {
-       VscMgmtMutex *mutex = NULL;
+       struct VscMgmtMutex *mutex = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       mutex = calloc (1, sizeof (struct _VscMgmtMutex));
+       mutex = calloc (1, sizeof (struct VscMgmtMutex));
 
        if (mutex == NULL) {
                _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__OUT_OF_MEMORY);
@@ -73,17 +73,17 @@ _vsc_mgmt_mutex_new_recursive (VscMgmtError *error)
  * Cleans up a mutex and frees its memory.
  */
 void
-_vsc_mgmt_mutex_free (VscMgmtMutex *mutex)
+_vsc_mgmt_mutex_free (struct VscMgmtMutex *mutex)
 {
        free (mutex);
 }
 
 void
-_vsc_mgmt_mutex_lock (VscMgmtMutex *mutex ATTR_UNUSED)
+_vsc_mgmt_mutex_lock (struct VscMgmtMutex *mutex ATTR_UNUSED)
 {
 }
 
 void
-_vsc_mgmt_mutex_unlock (VscMgmtMutex *mutex ATTR_UNUSED)
+_vsc_mgmt_mutex_unlock (struct VscMgmtMutex *mutex ATTR_UNUSED)
 {
 }
index d65da81..655b89e 100644 (file)
 #include <pthread.h>
 #include <string.h>
 
-struct _VscMgmtMutex {
+struct VscMgmtMutex {
        pthread_mutex_t handle;
 };
 
 /**
  * Allocates and initializes an initially unlocked mutex and returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new (VscMgmtError *error)
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new (struct VscMgmtError *error)
 {
        int errnum = 0;
-       VscMgmtMutex *mutex = NULL;
+       struct VscMgmtMutex *mutex = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       mutex = calloc (1, sizeof (struct _VscMgmtMutex));
+       mutex = calloc (1, sizeof (struct VscMgmtMutex));
 
        if (mutex == NULL) {
                _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__OUT_OF_MEMORY);
@@ -70,17 +70,17 @@ failure:
  * Allocates and initializes an initially unlocked, recursive mutex and
  * returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new_recursive (VscMgmtError *error)
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new_recursive (struct VscMgmtError *error)
 {
        int errnum = 0;
-       VscMgmtMutex *mutex = NULL;
+       struct VscMgmtMutex *mutex = NULL;
        pthread_mutexattr_t mutexattr;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       mutex = calloc (1, sizeof (struct _VscMgmtMutex));
+       mutex = calloc (1, sizeof (struct VscMgmtMutex));
 
        if (mutex == NULL) {
                _VSC_MGMT__ERROR0 (error, VSC_MGMT__CODE__OUT_OF_MEMORY);
@@ -113,20 +113,20 @@ failure:
  * Cleans up a mutex and frees its memory.
  */
 void
-_vsc_mgmt_mutex_free (VscMgmtMutex *mutex)
+_vsc_mgmt_mutex_free (struct VscMgmtMutex *mutex)
 {
        pthread_mutex_destroy (&mutex->handle);
        free (mutex);
 }
 
 void
-_vsc_mgmt_mutex_lock (VscMgmtMutex *mutex)
+_vsc_mgmt_mutex_lock (struct VscMgmtMutex *mutex)
 {
        pthread_mutex_lock (&mutex->handle);
 }
 
 void
-_vsc_mgmt_mutex_unlock (VscMgmtMutex *mutex)
+_vsc_mgmt_mutex_unlock (struct VscMgmtMutex *mutex)
 {
        pthread_mutex_unlock (&mutex->handle);
 }
index 8e98f44..a35a83d 100644 (file)
 /**
  * Allocates and initializes an initially unlocked mutex and returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new (VscMgmtError *error);
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new (struct VscMgmtError *error);
 
 /**
  * Allocates and initializes an initially unlocked, recursive mutex and
  * returns it.
  */
-VscMgmtMutex * /* mutex */
-_vsc_mgmt_mutex_new_recursive (VscMgmtError *error);
+struct VscMgmtMutex * /* mutex */
+_vsc_mgmt_mutex_new_recursive (struct VscMgmtError *error);
 
 /**
  * Cleans up a mutex and frees its memory.
  */
 void
-_vsc_mgmt_mutex_free (VscMgmtMutex *mutex);
+_vsc_mgmt_mutex_free (struct VscMgmtMutex *mutex);
 
 void
-_vsc_mgmt_mutex_lock (VscMgmtMutex *mutex);
+_vsc_mgmt_mutex_lock (struct VscMgmtMutex *mutex);
 
 void
-_vsc_mgmt_mutex_unlock (VscMgmtMutex *mutex);
+_vsc_mgmt_mutex_unlock (struct VscMgmtMutex *mutex);
 
 #endif /* __VSC_MGMT__UTILS__MUTEX_H__ */
index d9eabcc..3a1971c 100644 (file)
@@ -25,7 +25,7 @@
 #include <string.h>
 
 char *
-_vsc_mgmt_strdup (VscMgmtError *error, const char *string)
+_vsc_mgmt_strdup (struct VscMgmtError *error, const char *string)
 {
        char *string_duplicate = NULL;
 
@@ -75,7 +75,7 @@ _vsc_mgmt_strerror (int errnum)
  * string, otherwise an error occurs.
  */
 int
-_vsc_mgmt_strtoi (VscMgmtError *error, const char *string, char **tail,
+_vsc_mgmt_strtoi (struct VscMgmtError *error, const char *string, char **tail,
                   int base)
 {
        long int value = 0;
index 102370c..87e9908 100644 (file)
@@ -24,7 +24,7 @@
 #include "../include/libvscmgmt/types.h"
 
 char *
-_vsc_mgmt_strdup (VscMgmtError *error, const char *string);
+_vsc_mgmt_strdup (struct VscMgmtError *error, const char *string);
 
 const char *
 _vsc_mgmt_strerror (int errnum);
@@ -36,7 +36,7 @@ _vsc_mgmt_strerror (int errnum);
  * string, otherwise an error occurs.
  */
 int
-_vsc_mgmt_strtoi (VscMgmtError *error, const char *string, char **tail,
+_vsc_mgmt_strtoi (struct VscMgmtError *error, const char *string, char **tail,
                   int base);
 
 #endif /* __VSC_MGMT__UTILS__STRING_H__ */
index 0a4019e..ef783f8 100644 (file)
 #endif
 
 #define ATTR_UNUSED __attribute__((__unused__))
-
 #define ATTR_PRINTF(a, b) __attribute__ ((format (printf, a, b)))
 
-typedef struct _VscMgmtList VscMgmtList;
-typedef struct _VscMgmtMutex VscMgmtMutex;
-
-struct _VscMgmtList {
-       VscMgmtList *next;
+struct VscMgmtList {
+       struct VscMgmtList *next;
 };
 
-typedef VscMgmtList * (*VscMgmtList_DuplicateFunction) (VscMgmtError *error,
-                                                        VscMgmtList *item);
-typedef int (*VscMgmtList_MatchFunction) (VscMgmtList *item, void *match_data);
-typedef int (*VscMgmtList_FreeFunction) (VscMgmtList *item);
+struct VscMgmtMutex;
+
+typedef struct VscMgmtList * (*VscMgmtList_DuplicateFunction) (struct VscMgmtError *error, struct VscMgmtList *item);
+typedef int (*VscMgmtList_MatchFunction) (struct VscMgmtList *item, void *match_data);
+typedef int (*VscMgmtList_FreeFunction) (struct VscMgmtList *item);
 
 #endif /* __VSC_MGMT__UTILS__TYPES_H__ */
index b58d799..fa67f5a 100644 (file)
@@ -27,8 +27,8 @@
  * Parses a UUID from string representation.
  */
 void
-vsc_mgmt_uuid_parse (VscMgmtError *error, const char *uuid_string,
-                     VscMgmtUuid *uuid)
+vsc_mgmt_uuid_parse (struct VscMgmtError *error, const char *uuid_string,
+                     struct VscMgmtUuid *uuid)
 {
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
@@ -43,7 +43,7 @@ vsc_mgmt_uuid_parse (VscMgmtError *error, const char *uuid_string,
  * Formats a UUID to string representation.
  */
 void
-vsc_mgmt_uuid_format (const VscMgmtUuid *uuid, char *uuid_string)
+vsc_mgmt_uuid_format (const struct VscMgmtUuid *uuid, char *uuid_string)
 {
        uuid_unparse_lower (uuid->bytes, uuid_string);
 }
@@ -56,38 +56,41 @@ vsc_mgmt_uuid_format (const VscMgmtUuid *uuid, char *uuid_string)
  *
  * If an error occurs then the list is untouched.
  */
-VscMgmtUuid * /* uuid_list */
-vsc_mgmt_uuid_list_append (VscMgmtError *error, VscMgmtUuid *uuid_list,
-                           const VscMgmtUuid *uuid)
+struct VscMgmtUuid * /* uuid_list */
+vsc_mgmt_uuid_list_append (struct VscMgmtError *error,
+                           struct VscMgmtUuid *uuid_list,
+                           const struct VscMgmtUuid *uuid)
 {
        /*
         * FIXME: Error trace
         */
-       return (VscMgmtUuid *)
-              _vsc_mgmt_list_append
-              (error, (VscMgmtList *) uuid_list, (VscMgmtList *) uuid,
-               (VscMgmtList_DuplicateFunction) _vsc_mgmt_uuid_duplicate);
+       return (struct VscMgmtUuid *)
+                 _vsc_mgmt_list_append
+                    (error, (struct VscMgmtList *) uuid_list,
+                     (struct VscMgmtList *) uuid,
+                     (VscMgmtList_DuplicateFunction) _vsc_mgmt_uuid_duplicate);
 }
 
 /**
  * Recursively frees the UUID list.
  */
 void
-vsc_mgmt_uuid_list_free (VscMgmtUuid *uuid_list)
+vsc_mgmt_uuid_list_free (struct VscMgmtUuid *uuid_list)
 {
-       _vsc_mgmt_list_free ((VscMgmtList *) uuid_list,
+       _vsc_mgmt_list_free ((struct VscMgmtList *) uuid_list,
                             (VscMgmtList_FreeFunction) _vsc_mgmt_uuid_free);
 }
 
-VscMgmtUuid * /* uuid_duplicate */
-_vsc_mgmt_uuid_duplicate (VscMgmtError *error, const VscMgmtUuid *uuid)
+struct VscMgmtUuid * /* uuid_duplicate */
+_vsc_mgmt_uuid_duplicate (struct VscMgmtError *error,
+                          const struct VscMgmtUuid *uuid)
 {
-       VscMgmtUuid *uuid_duplicate = NULL;
+       struct VscMgmtUuid *uuid_duplicate = NULL;
 
        _VSC_MGMT__ASSERT (error != NULL);
        _VSC_MGMT__ASSERT (! error->occured);
 
-       uuid_duplicate = _vsc_mgmt_memdup (error, uuid, sizeof (VscMgmtUuid));
+       uuid_duplicate = _vsc_mgmt_memdup (error, uuid, sizeof (struct VscMgmtUuid));
 
        if (error->occured) {
                _VSC_MGMT__APPEND_ERROR0 (error, VSC_MGMT__CODE__TRACE);
@@ -100,7 +103,7 @@ _vsc_mgmt_uuid_duplicate (VscMgmtError *error, const VscMgmtUuid *uuid)
 }
 
 void
-_vsc_mgmt_uuid_free (VscMgmtUuid *uuid)
+_vsc_mgmt_uuid_free (struct VscMgmtUuid *uuid)
 {
        free (uuid);
 }
index 9b2a9e8..f698f75 100644 (file)
 
 #include "../include/libvscmgmt/types.h"
 
-VscMgmtUuid * /* uuid_duplicate */
-_vsc_mgmt_uuid_duplicate (VscMgmtError *error, const VscMgmtUuid *uuid);
+struct VscMgmtUuid * /* uuid_duplicate */
+_vsc_mgmt_uuid_duplicate (struct VscMgmtError *error,
+                          const struct VscMgmtUuid *uuid);
 
 void
-_vsc_mgmt_uuid_free (VscMgmtUuid *uuid);
+_vsc_mgmt_uuid_free (struct VscMgmtUuid *uuid);
 
 #endif /* __VSC_MGMT__UTILS__UUID_H__ */