All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andre Przywara" <andre.przywara@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 5/5] [ioemu]: miscellaneous warnings
Date: Wed, 09 Jan 2008 15:06:17 +0100	[thread overview]
Message-ID: <4784D4D9.30804@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Some minor things:
- double definition of NDEBUG (aes.c)
- static functions only needed in debug builds
- missing header for passthrough
- missing prototype for e100 device
- using intptr_t for opaque pointers
- unneeded declarations
- fixing strange pointer acrobatics in ide.c

-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: misc.diff --]
[-- Type: text/plain, Size: 7801 bytes --]

diff -r 0f0d67f29ccb tools/ioemu/aes.c
--- a/tools/ioemu/aes.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/aes.c	Tue Jan 08 14:48:38 2008 +0100
@@ -30,7 +30,10 @@
 #include "vl.h"
 #include "aes.h"
 
+#ifndef NDEBUG
 #define NDEBUG
+#endif
+
 #include <assert.h>
 
 typedef uint32_t u32;
diff -r 0f0d67f29ccb tools/ioemu/block-vvfat.c
--- a/tools/ioemu/block-vvfat.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/block-vvfat.c	Tue Jan 08 14:48:38 2008 +0100
@@ -1734,7 +1734,7 @@ DLOG(fprintf(stderr, "read cluster %d (s
 	}
 
 	for (i = 0; i < 0x10 * s->sectors_per_cluster; i++) {
-	    int cluster_count;
+	    int cluster_count=0;
 
 DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i));
 	    if (is_volume_label(direntries + i) || is_dot(direntries + i) ||
@@ -2409,10 +2409,12 @@ static int handle_commits(BDRVVVFATState
 	    fail = -2;
 	    break;
 	case ACTION_WRITEOUT: {
+#ifndef NDEBUG
 	    direntry_t* entry = array_get(&(s->directory),
 		    commit->param.writeout.dir_index);
 	    uint32_t begin = begin_of_direntry(entry);
 	    mapping_t* mapping = find_mapping_for_cluster(s, begin);
+#endif
 
 	    assert(mapping);
 	    assert(mapping->begin == begin);
diff -r 0f0d67f29ccb tools/ioemu/hw/acpi.c
--- a/tools/ioemu/hw/acpi.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/acpi.c	Tue Jan 08 14:48:38 2008 +0100
@@ -473,7 +473,7 @@ void piix4_pm_init(PCIBus *bus, int devf
 {
     PIIX4PMState *s;
     uint8_t *pci_conf;
-    uint32_t pm_io_base, smb_io_base;
+    uint32_t smb_io_base;
 
     s = (PIIX4PMState *)pci_register_device(bus,
                                          "PM", sizeof(PIIX4PMState),
diff -r 0f0d67f29ccb tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/ide.c	Tue Jan 08 14:48:38 2008 +0100
@@ -573,8 +573,8 @@ static void padstr(char *str, const char
             v = *src++;
         else
             v = ' ';
-        *(char *)((long)str ^ 1) = v;
-        str++;
+        str[i^1] = v;
+
     }
 }
 
diff -r 0f0d67f29ccb tools/ioemu/hw/pc.c
--- a/tools/ioemu/hw/pc.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/pc.c	Tue Jan 08 14:48:38 2008 +0100
@@ -23,6 +23,10 @@
  */
 #include "vl.h"
 
+#ifdef CONFIG_PASSTHROUGH
+#include "pass-through.h"
+#endif
+
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
 
diff -r 0f0d67f29ccb tools/ioemu/monitor.c
--- a/tools/ioemu/monitor.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/monitor.c	Tue Jan 08 14:48:38 2008 +0100
@@ -2234,7 +2234,7 @@ static void monitor_handle_command(const
                 }
                 if (nb_args >= MAX_ARGS)
                     goto error_args;
-                args[nb_args++] = (void *)has_option;
+                args[nb_args++] = (void *)(intptr_t)has_option;
             }
             break;
 #ifdef CONFIG_DM
diff -r 0f0d67f29ccb tools/ioemu/vl.c
--- a/tools/ioemu/vl.c	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/vl.c	Tue Jan 08 14:48:38 2008 +0100
@@ -2030,7 +2030,7 @@ static CharDriverState *qemu_chr_open_tt
 #if defined(__linux__)
 static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
 {
-    int fd = (int)chr->opaque;
+    int fd = (intptr_t)chr->opaque;
     uint8_t b;
 
     switch(cmd) {
@@ -2084,7 +2084,7 @@ static CharDriverState *qemu_chr_open_pp
         close(fd);
         return NULL;
     }
-    chr->opaque = (void *)fd;
+    chr->opaque = (void *)(intptr_t)fd;
     chr->chr_write = null_chr_write;
     chr->chr_ioctl = pp_ioctl;
 
@@ -3833,7 +3833,8 @@ static NetSocketState *net_socket_fd_ini
 {
     int so_type=-1, optlen=sizeof(so_type);
 
-    if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type, &optlen)< 0) {
+    if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type,
+        (socklen_t *)&optlen)< 0) {
 	fprintf(stderr, "qemu: error: setsockopt(SO_TYPE) for fd=%d failed\n", fd);
 	return NULL;
     }
@@ -4969,6 +4970,79 @@ static BlockDriverState *get_bs_snapshot
     bs_snapshots = bs;
     return bs;
 }
+
+
+#ifdef CONFIG_DM
+/* We use simpler state save/load functions for Xen */
+void do_savevm(const char *name)
+{
+    QEMUFile *f;
+    int saved_vm_running, ret;
+
+    f = qemu_fopen(name, "wb");
+    
+    /* ??? Should this occur after vm_stop?  */
+    qemu_aio_flush();
+
+    saved_vm_running = vm_running;
+    vm_stop(0);
+
+    if (!f) {
+        fprintf(logfile, "Failed to open savevm file '%s'\n", name);
+        goto the_end;
+    }
+    
+    ret = qemu_savevm_state(f);
+    qemu_fclose(f);
+
+    if (ret < 0)
+        fprintf(logfile, "Error %d while writing VM to savevm file '%s'\n",
+                ret, name);
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+
+    return;
+}
+void do_loadvm(const char *name)
+{
+    QEMUFile *f;
+    int saved_vm_running, ret;
+
+    /* Flush all IO requests so they don't interfere with the new state.  */
+    qemu_aio_flush();
+
+    saved_vm_running = vm_running;
+    vm_stop(0);
+
+    /* restore the VM state */
+    f = qemu_fopen(name, "rb");
+    if (!f) {
+        fprintf(logfile, "Could not open VM state file\n");
+        goto the_end;
+    }
+
+    ret = qemu_loadvm_state(f);
+    qemu_fclose(f);
+    if (ret < 0) {
+        fprintf(logfile, "Error %d while loading savevm file '%s'\n",
+                ret, name);
+        goto the_end; 
+    }
+
+#if 0 
+    /* del tmp file */
+    if (unlink(name) == -1)
+        fprintf(stderr, "delete tmp qemu state file failed.\n");
+#endif
+
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+}
+#else 
 
 static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info,
                               const char *name)
@@ -4992,77 +5066,6 @@ static int bdrv_snapshot_find(BlockDrive
     return ret;
 }
 
-#ifdef CONFIG_DM
-/* We use simpler state save/load functions for Xen */
-void do_savevm(const char *name)
-{
-    QEMUFile *f;
-    int saved_vm_running, ret;
-
-    f = qemu_fopen(name, "wb");
-    
-    /* ??? Should this occur after vm_stop?  */
-    qemu_aio_flush();
-
-    saved_vm_running = vm_running;
-    vm_stop(0);
-
-    if (!f) {
-        fprintf(logfile, "Failed to open savevm file '%s'\n", name);
-        goto the_end;
-    }
-    
-    ret = qemu_savevm_state(f);
-    qemu_fclose(f);
-
-    if (ret < 0)
-        fprintf(logfile, "Error %d while writing VM to savevm file '%s'\n",
-                ret, name);
-
- the_end:
-    if (saved_vm_running)
-        vm_start();
-
-    return;
-}
-void do_loadvm(const char *name)
-{
-    QEMUFile *f;
-    int saved_vm_running, ret;
-
-    /* Flush all IO requests so they don't interfere with the new state.  */
-    qemu_aio_flush();
-
-    saved_vm_running = vm_running;
-    vm_stop(0);
-
-    /* restore the VM state */
-    f = qemu_fopen(name, "rb");
-    if (!f) {
-        fprintf(logfile, "Could not open VM state file\n");
-        goto the_end;
-    }
-
-    ret = qemu_loadvm_state(f);
-    qemu_fclose(f);
-    if (ret < 0) {
-        fprintf(logfile, "Error %d while loading savevm file '%s'\n",
-                ret, name);
-        goto the_end; 
-    }
-
-#if 0 
-    /* del tmp file */
-    if (unlink(name) == -1)
-        fprintf(stderr, "delete tmp qemu state file failed.\n");
-#endif
-
-
- the_end:
-    if (saved_vm_running)
-        vm_start();
-}
-#else 
 void do_savevm(const char *name)
 {
     BlockDriverState *bs, *bs1;
diff -r 0f0d67f29ccb tools/ioemu/vl.h
--- a/tools/ioemu/vl.h	Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/vl.h	Tue Jan 08 14:48:38 2008 +0100
@@ -1026,6 +1026,10 @@ void pcnet_h_reset(void *opaque);
 void pcnet_h_reset(void *opaque);
 void *lance_init(NICInfo *nd, uint32_t leaddr, void *dma_opaque);
 
+/* e100.c */
+
+void pci_e100_init(PCIBus *bus, NICInfo *nd);
+
 
 /* pckbd.c */
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2008-01-09 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4784D4D9.30804@amd.com \
    --to=andre.przywara@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.