[PATCH 03/22] bhyve: Fix misaligned arguments and misaligned conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes misaligned arguments and misaligned conditions.

Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
 src/bhyve/bhyve_capabilities.c  |  7 +++----
 src/bhyve/bhyve_command.c       |  6 +++---
 src/bhyve/bhyve_driver.c        | 10 +++++-----
 src/bhyve/bhyve_monitor.c       |  4 ++--
 src/bhyve/bhyve_parse_command.c | 16 ++++++++--------
 src/bhyve/bhyve_process.c       |  6 +++---
 6 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index 6feaded..1984c85 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -139,12 +139,11 @@ virBhyveDomainCapsBuild(bhyveConnPtr conn,
     if (virDirOpenIfExists(&dir, firmware_dir) > 0) {
         while ((virDirRead(dir, &entry, firmware_dir)) > 0) {
             if (VIR_RESIZE_N(firmwares->values,
-                firmwares_alloc, firmwares->nvalues, 1) < 0)
+                             firmwares_alloc, firmwares->nvalues, 1) < 0)
                 goto cleanup;
 
-            if (virAsprintf(
-                    &firmwares->values[firmwares->nvalues],
-                    "%s/%s", firmware_dir, entry->d_name) < 0)
+            if (virAsprintf(&firmwares->values[firmwares->nvalues],
+                            "%s/%s", firmware_dir, entry->d_name) < 0)
                 goto cleanup;
 
             firmwares->nvalues++;
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 6149c93..7f2d2f5 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -293,8 +293,8 @@ bhyveBuildUSBControllerArgStr(const virDomainDef *def,
 
 static int
 bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
-                     virDomainDiskDefPtr disk,
-                     virCommandPtr cmd)
+                           virDomainDiskDefPtr disk,
+                           virCommandPtr cmd)
 {
     const char *disk_source;
 
@@ -516,7 +516,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Installed bhyve binary does not support "
-                          "UTC clock"));
+                             "UTC clock"));
             goto error;
         }
         break;
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 4d4f85f..06c7012 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -727,12 +727,12 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
         if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) == 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Installed bhyve binary does not support "
-                          "bootrom"));
+                             "bootrom"));
             goto cleanup;
         }
     } else {
         if (!(loadcmd = virBhyveProcessBuildLoadCmd(conn, def, "<device.map>",
-                                                NULL)))
+                                                    NULL)))
             goto cleanup;
 
         virBufferAdd(&buf, virCommandToString(loadcmd), -1);
@@ -1107,9 +1107,9 @@ bhyveDomainSetMetadata(virDomainPtr dom,
 
 static char *
 bhyveDomainGetMetadata(virDomainPtr dom,
-                      int type,
-                      const char *uri,
-                      unsigned int flags)
+                       int type,
+                       const char *uri,
+                       unsigned int flags)
 {
     virDomainObjPtr vm;
     char *ret = NULL;
diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c
index 4d5262c..ba1879d 100644
--- a/src/bhyve/bhyve_monitor.c
+++ b/src/bhyve/bhyve_monitor.c
@@ -79,8 +79,8 @@ bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
     if (kev.filter == EVFILT_PROC && (kev.fflags & NOTE_EXIT) != 0) {
         if ((pid_t)kev.ident != vm->pid) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                        _("event from unexpected proc %ju!=%ju"),
-                        (uintmax_t)vm->pid, (uintmax_t)kev.ident);
+                           _("event from unexpected proc %ju!=%ju"),
+                           (uintmax_t)vm->pid, (uintmax_t)kev.ident);
             return;
         }
 
diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
index 14137d1..5424d97 100644
--- a/src/bhyve/bhyve_parse_command.c
+++ b/src/bhyve/bhyve_parse_command.c
@@ -63,7 +63,7 @@ bhyveParseCommandLineUnescape(const char *command)
     /* Iterate over characters in the command, skipping "\\\n", "\\\r" as well
      * as "\\\r\n". */
     for (curr_src = (char*) command, curr_dst = unescaped; *curr_src != '\0';
-        curr_src++, curr_dst++) {
+         curr_src++, curr_dst++) {
         if (*curr_src == '\\') {
             switch (*(curr_src + 1)) {
                 case '\n': /* \LF */
@@ -122,10 +122,10 @@ bhyveParseMemsize(const char *arg, size_t *ret_memsize)
  */
 static int
 bhyveCommandLineToArgv(const char *nativeConfig,
-                      int *loader_argc,
-                      char ***loader_argv,
-                      int *bhyve_argc,
-                      char ***bhyve_argv)
+                       int *loader_argc,
+                       char ***loader_argv,
+                       int *bhyve_argc,
+                       char ***bhyve_argv)
 {
     const char *curr = NULL;
     char *nativeConfig_unescaped = NULL;
@@ -663,7 +663,7 @@ bhyveParseBhyveCommandLine(virDomainDefPtr def,
         goto error;
 
     while ((c = _getopt_internal_r(argc, argv, optstr,
-            NULL, NULL, 0, parser, 0)) != -1) {
+                                   NULL, NULL, 0, parser, 0)) != -1) {
         switch (c) {
         case 'A':
             def->features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
@@ -700,7 +700,7 @@ bhyveParseBhyveCommandLine(virDomainDefPtr def,
             }
             if (def->mem.cur_balloon != 0 && def->mem.cur_balloon != memory) {
                 virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                           _("Failed to parse memory: size mismatch"));
+                               _("Failed to parse memory: size mismatch"));
                 goto error;
             }
             def->mem.cur_balloon = memory;
@@ -778,7 +778,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def,
         goto error;
 
     while ((c = _getopt_internal_r(argc, argv, optstr,
-            NULL, NULL, 0, parser, 0)) != -1) {
+                                   NULL, NULL, 0, parser, 0)) != -1) {
         switch (c) {
         case 'd':
             arguments |= 1;
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 4dab6e5..089f4ae 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -77,9 +77,9 @@ bhyveNetCleanup(virDomainObjPtr vm)
 
         if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
             if (net->ifname) {
-                ignore_value(virNetDevBridgeRemovePort(
-                                virDomainNetGetActualBridgeName(net),
-                                net->ifname));
+                const char *brname = virDomainNetGetActualBridgeName(net);
+                ignore_value(virNetDevBridgeRemovePort(brname,
+                                                       net->ifname));
                 ignore_value(virNetDevTapDelete(net->ifname, NULL));
             }
         }
-- 
2.17.1


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux