diff mbox

[v2,4/5] raw-posix: Use DPRINTF for DEBUG_FLOPPY

Message ID 1431107242-31947-5-git-send-email-dimara@arrikto.com
State New
Headers show

Commit Message

Dimitris Aragiorgis May 8, 2015, 5:47 p.m. UTC
Get rid of several #ifdef DEBUG_FLOPPY and substitute them with
DPRINTF.

Signed-off-by: Dimitris Aragiorgis <dimara@arrikto.com>
---
 block/raw-posix.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

Comments

Kevin Wolf May 11, 2015, 10:19 a.m. UTC | #1
Am 08.05.2015 um 19:47 hat Dimitris Aragiorgis geschrieben:
> Get rid of several #ifdef DEBUG_FLOPPY and substitute them with
> DPRINTF.
> 
> Signed-off-by: Dimitris Aragiorgis <dimara@arrikto.com>

Hm, this removes the option of selectively enabling debug messages. It's
probably not a big probem in this case, though.

However, please do remove the "//#define DEBUG_FLOPPY" line.

Kevin
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index fbccca8..8a38d02 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -2157,16 +2157,12 @@  static int fd_open(BlockDriverState *bs)
         (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_open_time) >= FD_OPEN_TIMEOUT) {
         qemu_close(s->fd);
         s->fd = -1;
-#ifdef DEBUG_FLOPPY
-        printf("Floppy closed\n");
-#endif
+        DPRINTF("Floppy closed\n");
     }
     if (s->fd < 0) {
         if (s->fd_got_error &&
             (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - s->fd_error_time) < FD_OPEN_TIMEOUT) {
-#ifdef DEBUG_FLOPPY
-            printf("No floppy (open delayed)\n");
-#endif
+            DPRINTF("No floppy (open delayed)\n");
             return -EIO;
         }
         s->fd = qemu_open(bs->filename, s->open_flags & ~O_NONBLOCK);
@@ -2175,14 +2171,10 @@  static int fd_open(BlockDriverState *bs)
             s->fd_got_error = 1;
             if (last_media_present)
                 s->fd_media_changed = 1;
-#ifdef DEBUG_FLOPPY
-            printf("No floppy\n");
-#endif
+            DPRINTF("No floppy\n");
             return -EIO;
         }
-#ifdef DEBUG_FLOPPY
-        printf("Floppy opened\n");
-#endif
+        DPRINTF("Floppy opened\n");
     }
     if (!last_media_present)
         s->fd_media_changed = 1;
@@ -2450,9 +2442,7 @@  static int floppy_media_changed(BlockDriverState *bs)
     fd_open(bs);
     ret = s->fd_media_changed;
     s->fd_media_changed = 0;
-#ifdef DEBUG_FLOPPY
-    printf("Floppy changed=%d\n", ret);
-#endif
+    DPRINTF("Floppy changed=%d\n", ret);
     return ret;
 }