Skip to contentSkip to conversation

scsi: Clean up BlockDriverState use

PATCH Applied Markus Armbruster 3 participants 5 messages Jun 5, 2012 – Jun 6, 2012

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover scsi: Clean up BlockDriverState use

With this and the related fix for xen applied, block_int.h is finally gone from hw/.

Markus Armbruster (2):
block: New bdrv_get_flags()
scsi-disk: Don't peek behind the BlockDriverState abstraction

 block.c        |    5 +++++
 block.h        |    1 +
 hw/scsi-disk.c |    3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH 1/2 block: New bdrv_get_flags()

---
 block.c |    5 +++++
 block.h |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)
block.c +5 -0
index 7547051..9a50843 100644
@@ -2466,6 +2466,11 @@ const char *bdrv_get_device_name(BlockDriverState *bs)
     return bs->device_name;
 }
 
+int bdrv_get_flags(BlockDriverState *bs)
+{
+    return bs->open_flags;
+}
+
 void bdrv_flush_all(void)
 {
     BlockDriverState *bs;
block.h +1 -0
index 7408acc..d42dfb3 100644
@@ -296,6 +296,7 @@ int bdrv_query_missing_keys(void);
 void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
                          void *opaque);
 const char *bdrv_get_device_name(BlockDriverState *bs);
+int bdrv_get_flags(BlockDriverState *bs);
 int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
                           const uint8_t *buf, int nb_sectors);
 int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
Signature · 1 line
1.7.6.5
#2 lore raw

PATCH 2/2 scsi-disk: Don't peek behind the BlockDriverState abstraction

In reply to Markus Armbruster

Use the appropriate interface instead.

---
 hw/scsi-disk.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
hw/scsi-disk.c +1 -2
index 045c764..1bfefb2 100644
@@ -34,7 +34,6 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 #include "scsi-defs.h"
 #include "sysemu.h"
 #include "blockdev.h"
-#include "block_int.h"
 #include "dma.h"
 
 #ifdef __linux
@@ -1877,7 +1876,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag,
 	 * ones (such as WRITE SAME or EXTENDED COPY, etc.).  So, without
 	 * O_DIRECT everything must go through SG_IO.
          */
-        if (!(s->qdev.conf.bs->open_flags & BDRV_O_NOCACHE)) {
+        if (bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE) {
             break;
         }
 
Signature · 1 line
1.7.6.5
Acked-by on the v1 series
#3 lore raw
In reply to Markus Armbruster

Il 05/06/2012 16:49, Markus Armbruster ha scritto:

Quoted 12 lines

With this and the related fix for xen applied, block_int.h is finally gone from hw/.

Markus Armbruster (2):
block: New bdrv_get_flags()
scsi-disk: Don't peek behind the BlockDriverState abstraction

 block.c        |    5 +++++
 block.h        |    1 +
 hw/scsi-disk.c |    3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)

Paolo

Applied
#4 lore raw

Am 05.06.2012 23:32, schrieb Paolo Bonzini:

Quoted 8 lines

Il 05/06/2012 16:49, Markus Armbruster ha scritto:

Quoted 7 lines

With this and the related fix for xen applied, block_int.h is finally gone from hw/.

Markus Armbruster (2):
block: New bdrv_get_flags()
scsi-disk: Don't peek behind the BlockDriverState abstraction

Quoted 7 lines
Quoted 5 lines
 block.c        |    5 +++++
 block.h        |    1 +
 hw/scsi-disk.c |    3 +--
 3 files changed, 7 insertions(+), 2 deletions(-)

Thanks, applied to the block branch.

Kevin