qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/6] Block patches
@ 2011-05-03 11:08 Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 1/6] qemu-img resize: Fix option parsing Kevin Wolf
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

The following changes since commit 57aa265d462a64a06268be26d49020729cff56c1:

  lm32: add Milkymist Minimac2 support (2011-05-03 10:48:40 +0200)

are available in the git repository at:
  git://repo.or.cz/qemu/kevin.git for-anthony

Alon Levy (1):
      ide/atapi: fix set but unused

Amit Shah (2):
      atapi: Move comment to proper place
      atapi: Explain why we need a 'media not present' state

Jes Sorensen (1):
      qemu-progress.c: printf isn't signal safe

Kevin Wolf (1):
      qemu-img resize: Fix option parsing

Nick Thomas (1):
      NBD: Avoid leaking a couple of strings when the NBD device is closed

 block/nbd.c     |    4 ++++
 hw/ide/atapi.c  |   14 +++++++++-----
 qemu-img.c      |   13 +++++++++++--
 qemu-progress.c |    7 ++++++-
 4 files changed, 30 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 1/6] qemu-img resize: Fix option parsing
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 2/6] atapi: Move comment to proper place Kevin Wolf
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

For shrinking images, you're supposed to use a negative size. However, the
leading minus makes getopt think that it's an option and so you get the help
text if you don't use -- like in 'qemu-img resize test.img -- -1G'.

This patch handles the size first and removes it from the argument list so that
getopt won't even try to interpret it and you don't need -- any more.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index ed5ba91..e825123 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1442,6 +1442,16 @@ static int img_resize(int argc, char **argv)
         { NULL }
     };
 
+    /* Remove size from argv manually so that negative numbers are not treated
+     * as options by getopt. */
+    if (argc < 3) {
+        help();
+        return 1;
+    }
+
+    size = argv[--argc];
+
+    /* Parse getopt arguments */
     fmt = NULL;
     for(;;) {
         c = getopt(argc, argv, "f:h");
@@ -1458,11 +1468,10 @@ static int img_resize(int argc, char **argv)
             break;
         }
     }
-    if (optind + 1 >= argc) {
+    if (optind >= argc) {
         help();
     }
     filename = argv[optind++];
-    size = argv[optind++];
 
     /* Choose grow, shrink, or absolute resize mode */
     switch (size[0]) {
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 2/6] atapi: Move comment to proper place
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 1/6] qemu-img resize: Fix option parsing Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 3/6] atapi: Explain why we need a 'media not present' state Kevin Wolf
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Amit Shah <amit.shah@redhat.com>

Move misplaced comment for media_is_dvd()

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/atapi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 690a0ab..86b18d8 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -71,12 +71,12 @@ static void lba_to_msf(uint8_t *buf, int lba)
     buf[2] = lba % 75;
 }
 
-/* XXX: DVDs that could fit on a CD will be reported as a CD */
 static inline int media_present(IDEState *s)
 {
     return (s->nb_sectors > 0);
 }
 
+/* XXX: DVDs that could fit on a CD will be reported as a CD */
 static inline int media_is_dvd(IDEState *s)
 {
     return (media_present(s) && s->nb_sectors > CD_MAX_SECTORS);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 3/6] atapi: Explain why we need a 'media not present' state
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 1/6] qemu-img resize: Fix option parsing Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 2/6] atapi: Move comment to proper place Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 4/6] ide/atapi: fix set but unused Kevin Wolf
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Amit Shah <amit.shah@redhat.com>

After the re-org of the atapi code, it might not be intuitive for a
reader of the code to understand why we're inserting a 'media not
present' state between cd changes.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/atapi.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 86b18d8..58febc0 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1106,7 +1106,13 @@ void ide_atapi_cmd(IDEState *s)
         ide_atapi_cmd_check_status(s);
         return;
     }
-
+    /*
+     * When a CD gets changed, we have to report an ejected state and
+     * then a loaded state to guests so that they detect tray
+     * open/close and media change events.  Guests that do not use
+     * GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close
+     * states rely on this behavior.
+     */
     if (bdrv_is_inserted(s->bs) && s->cdrom_changed) {
         ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 4/6] ide/atapi: fix set but unused
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 3/6] atapi: Explain why we need a 'media not present' state Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 5/6] qemu-progress.c: printf isn't signal safe Kevin Wolf
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Alon Levy <alevy@redhat.com>

Signed-off-by: Alon Levy <alevy@redhat.com>
Acked-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/ide/atapi.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 58febc0..fe2fb0b 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1080,17 +1080,15 @@ static const struct {
 
 void ide_atapi_cmd(IDEState *s)
 {
-    const uint8_t *packet;
     uint8_t *buf;
 
-    packet = s->io_buffer;
     buf = s->io_buffer;
 #ifdef DEBUG_IDE_ATAPI
     {
         int i;
         printf("ATAPI limit=0x%x packet:", s->lcyl | (s->hcyl << 8));
         for(i = 0; i < ATAPI_PACKET_SIZE; i++) {
-            printf(" %02x", packet[i]);
+            printf(" %02x", buf[i]);
         }
         printf("\n");
     }
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 5/6] qemu-progress.c: printf isn't signal safe
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 4/6] ide/atapi: fix set but unused Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 6/6] NBD: Avoid leaking a couple of strings when the NBD device is closed Kevin Wolf
  2011-05-03 12:44 ` [Qemu-devel] [PULL 0/6] Block patches Anthony Liguori
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Change the signal handling to indicate a signal is pending, rather
then printing directly from the signal handler.

In addition make the signal prints go to stderr, rather than stdout.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-progress.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/qemu-progress.c b/qemu-progress.c
index e1feb89..a4894c0 100644
--- a/qemu-progress.c
+++ b/qemu-progress.c
@@ -37,6 +37,7 @@ struct progress_state {
 };
 
 static struct progress_state state;
+static volatile sig_atomic_t print_pending;
 
 /*
  * Simple progress print function.
@@ -63,12 +64,16 @@ static void progress_simple_init(void)
 #ifdef CONFIG_POSIX
 static void sigusr_print(int signal)
 {
-    printf("    (%3.2f/100%%)\n", state.current);
+    print_pending = 1;
 }
 #endif
 
 static void progress_dummy_print(void)
 {
+    if (print_pending) {
+        fprintf(stderr, "    (%3.2f/100%%)\n", state.current);
+        print_pending = 0;
+    }
 }
 
 static void progress_dummy_end(void)
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 6/6] NBD: Avoid leaking a couple of strings when the NBD device is closed
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 5/6] qemu-progress.c: printf isn't signal safe Kevin Wolf
@ 2011-05-03 11:08 ` Kevin Wolf
  2011-05-03 12:44 ` [Qemu-devel] [PULL 0/6] Block patches Anthony Liguori
  6 siblings, 0 replies; 8+ messages in thread
From: Kevin Wolf @ 2011-05-03 11:08 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel

From: Nick Thomas <nick@bytemark.co.uk>

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/nbd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/block/nbd.c b/block/nbd.c
index 1d6b225..7a52f62 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -239,6 +239,10 @@ static int nbd_write(BlockDriverState *bs, int64_t sector_num,
 
 static void nbd_close(BlockDriverState *bs)
 {
+    BDRVNBDState *s = bs->opaque;
+    qemu_free(s->export_name);
+    qemu_free(s->host_spec);
+
     nbd_teardown_connection(bs);
 }
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/6] Block patches
  2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2011-05-03 11:08 ` [Qemu-devel] [PATCH 6/6] NBD: Avoid leaking a couple of strings when the NBD device is closed Kevin Wolf
@ 2011-05-03 12:44 ` Anthony Liguori
  6 siblings, 0 replies; 8+ messages in thread
From: Anthony Liguori @ 2011-05-03 12:44 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On 05/03/2011 06:08 AM, Kevin Wolf wrote:
> The following changes since commit 57aa265d462a64a06268be26d49020729cff56c1:
>
>    lm32: add Milkymist Minimac2 support (2011-05-03 10:48:40 +0200)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/kevin.git for-anthony

Pulled.  Thanks.

Regards,

Anthony Liguori

> Alon Levy (1):
>        ide/atapi: fix set but unused
>
> Amit Shah (2):
>        atapi: Move comment to proper place
>        atapi: Explain why we need a 'media not present' state
>
> Jes Sorensen (1):
>        qemu-progress.c: printf isn't signal safe
>
> Kevin Wolf (1):
>        qemu-img resize: Fix option parsing
>
> Nick Thomas (1):
>        NBD: Avoid leaking a couple of strings when the NBD device is closed
>
>   block/nbd.c     |    4 ++++
>   hw/ide/atapi.c  |   14 +++++++++-----
>   qemu-img.c      |   13 +++++++++++--
>   qemu-progress.c |    7 ++++++-
>   4 files changed, 30 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-05-03 12:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 11:08 [Qemu-devel] [PULL 0/6] Block patches Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 1/6] qemu-img resize: Fix option parsing Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 2/6] atapi: Move comment to proper place Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 3/6] atapi: Explain why we need a 'media not present' state Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 4/6] ide/atapi: fix set but unused Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 5/6] qemu-progress.c: printf isn't signal safe Kevin Wolf
2011-05-03 11:08 ` [Qemu-devel] [PATCH 6/6] NBD: Avoid leaking a couple of strings when the NBD device is closed Kevin Wolf
2011-05-03 12:44 ` [Qemu-devel] [PULL 0/6] Block patches Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).