[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/23] raw-posix: Don't use bdrv_ioctl()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 05/23] raw-posix: Don't use bdrv_ioctl() |
Date: |
Thu, 27 Oct 2016 20:08:49 +0200 |
Instead of letting raw-posix use the bdrv_ioctl() abstraction to issue
an ioctl to itself, just call ioctl() directly.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/raw-posix.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index f481e57..247e47b 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -2069,13 +2069,23 @@ static bool hdev_is_sg(BlockDriverState *bs)
#if defined(__linux__)
+ BDRVRawState *s = bs->opaque;
struct stat st;
struct sg_scsi_id scsiid;
int sg_version;
+ int ret;
+
+ if (stat(bs->filename, &st) < 0 || !S_ISCHR(st.st_mode)) {
+ return false;
+ }
- if (stat(bs->filename, &st) >= 0 && S_ISCHR(st.st_mode) &&
- !bdrv_ioctl(bs, SG_GET_VERSION_NUM, &sg_version) &&
- !bdrv_ioctl(bs, SG_GET_SCSI_ID, &scsiid)) {
+ ret = ioctl(s->fd, SG_GET_VERSION_NUM, &sg_version);
+ if (ret < 0) {
+ return false;
+ }
+
+ ret = ioctl(s->fd, SG_GET_SCSI_ID, &scsiid);
+ if (ret >= 0) {
DPRINTF("SG device found: type=%d, version=%d\n",
scsiid.scsi_type, sg_version);
return true;
--
1.8.3.1
- [Qemu-devel] [PULL 22/23] block: More operations for meta dirty bitmap, (continued)
- [Qemu-devel] [PULL 22/23] block: More operations for meta dirty bitmap, Kevin Wolf, 2016/10/24
- [Qemu-devel] [PULL 21/23] tests: Add test code for hbitmap serialization, Kevin Wolf, 2016/10/24
- [Qemu-devel] [PULL 20/23] block: BdrvDirtyBitmap serialization interface, Kevin Wolf, 2016/10/24
- [Qemu-devel] [PULL 23/23] block/replication: Clarify 'top-id' parameter usage, Kevin Wolf, 2016/10/24
- Re: [Qemu-devel] [PULL 00/23] Block layer patches, Peter Maydell, 2016/10/24
- [Qemu-devel] [PULL 00/23] Block layer patches, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 01/23] block: Use blk_co_flush() for all BB level flushes, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 03/23] block: Remove bdrv_aio_pdiscard(), Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 02/23] block: Use blk_co_pdiscard() for all BB level discard, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 04/23] block: Use blk_co_ioctl() for all BB level ioctls, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 05/23] raw-posix: Don't use bdrv_ioctl(),
Kevin Wolf <=
- [Qemu-devel] [PULL 06/23] block: Remove bdrv_ioctl(), Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 07/23] block: Introduce .bdrv_co_ioctl() driver callback, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 08/23] raw: Implement .bdrv_co_ioctl instead of .bdrv_aio_ioctl, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 09/23] block: Remove bdrv_aio_ioctl(), Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 11/23] block/nbd: Drop trailing "." in error messages, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 12/23] block/nbd: Reject port parameter without host, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 13/23] block/nbd: Default port in nbd_refresh_filename(), Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 10/23] qemu-iotests: Fix typo for NFS with IMGOPTSSYNTAX, Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 15/23] block/nbd: Add nbd_has_filename_options_conflict(), Kevin Wolf, 2016/10/27
- [Qemu-devel] [PULL 14/23] block/nbd: Use qdict_put(), Kevin Wolf, 2016/10/27