qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bique Alexandre <alexandre.bique@citrix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 4/4] ATAPI pass through v3
Date: Thu, 6 Aug 2009 18:23:56 +0200	[thread overview]
Message-ID: <20090806162356.GD22841@lst.de> (raw)
In-Reply-To: <200908061650.05474.alexandre.bique@citrix.com>

On Thu, Aug 06, 2009 at 04:50:05PM +0100, Bique Alexandre wrote:
> The ATAPI pass through feature.

Again, this should be the subject, and the body should have a short
description on how it's done and why it's useful.


Is the firmware upgrade command really that special that we need to
filter it and not other harmfull commands?  That really needs
explanation in the patch description and/or a comment.

Some comments on the patch:


diff --git a/block/raw-posix.c b/block/raw-posix.c
index bdee07f..0510379 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -154,6 +154,12 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
     else if (!(bdrv_flags & BDRV_O_CACHE_WB))
         s->open_flags |= O_DSYNC;
 
+    /* If we open a cdrom device, and there is no media inside, we
+     * have to add O_NONBLOCK to open else it will fail */
+    if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM &&
+        bdrv_is_sg(bs))
+        s->open_flags |= O_NONBLOCK;

this should be in cdrom_open, that way you won't need the
bdrv_get_type_hint check either.

diff --git a/hw/atapi-pt.c b/hw/atapi-pt.c
new file mode 100644
index 0000000..85f6b6a
--- /dev/null
+++ b/hw/atapi-pt.c
@@ -0,0 +1,1002 @@
+int atapi_pt_allow_fw_upgrade = 0;
+

This seems to be missing any sort of author/copyright line.

+#define MSF_TO_FRAMES(M, S, F) (((M) * CD_SECS + (S)) * CD_FRAMES + (F))

Would be much nicer as a small (inline) function.

+/* The generic packet command opcodes for CD/DVD Logical Units,
+ * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
+static const struct {
+    unsigned short packet_command;
+    const char * const text;
+} packet_command_texts[] = {

Maybe move all these tables into a separate file?

@@ -1288,6 +1350,14 @@ static inline int ube16_to_cpu(const uint8_t *buf)
     return (buf[0] << 8) | buf[1];
 }
 
+#if CONFIG_ATAPI_PT /* only atapi-pt uses it so let's avoid unused
+                            * warning */
+static inline int ube24_to_cpu(const uint8_t *buf)
+{
+    return (buf[0] << 16) | (buf[1] << 8) | buf[2];
+}
+#endif /* CONFIG_ATAPI_PT */

When did gcc start issuing unused warnings for inlines?

@@ -1675,6 +1745,10 @@ static int ide_dvd_read_structure(IDEState *s, int format,
     }
 }
 
+#if CONFIG_ATAPI_PT
+#include "atapi-pt.c"
+#endif

Including .c files is areally horrible style, just make the function you
also need from atapi-pt.c non-static.

@@ -2872,6 +2946,16 @@ static void ide_init2(IDEState *ide_state,
 
             if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
                 s->is_cdrom = 1;
+                if (bdrv_is_sg(s->bs)) {

This check looks reversed to me.

  reply	other threads:[~2009-08-06 16:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 15:40 [Qemu-devel] [PATCH] ATAPI pass through v3 Bique Alexandre
2009-08-06 15:47 ` [Qemu-devel] [PATCH 1/4] " Bique Alexandre
2009-08-06 16:08   ` Christoph Hellwig
2009-08-06 15:48 ` [Qemu-devel] [PATCH 2/4] " Bique Alexandre
2009-08-06 16:09   ` Christoph Hellwig
2009-08-06 15:49 ` [Qemu-devel] [PATCH 3/4] " Bique Alexandre
2009-08-06 16:12   ` Christoph Hellwig
2009-08-06 16:17     ` Bique Alexandre
2009-08-07 15:49   ` [Qemu-devel] " Juan Quintela
2009-08-06 15:50 ` [Qemu-devel] [PATCH 4/4] " Bique Alexandre
2009-08-06 16:23   ` Christoph Hellwig [this message]
2009-08-06 17:49     ` Bique Alexandre
     [not found]   ` <m34osj8v77.fsf@neno.mitica>
2009-08-07 16:34     ` [Qemu-devel] " Bique Alexandre
     [not found]       ` <m3ws5f7et3.fsf@neno.mitica>
2009-08-07 17:10         ` Bique Alexandre

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=20090806162356.GD22841@lst.de \
    --to=hch@lst.de \
    --cc=alexandre.bique@citrix.com \
    --cc=qemu-devel@nongnu.org \
    /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 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).