7 Star 1 Fork 10

src-openEuler / libiscsi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0008-test-tool-BlockEraseReserved-override-driver-queue_p.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
markeryang 提交于 2021-07-30 17:52 . fix multiple define for gcc10
From b705f9e5240583fb862f16d603e5cf2120e5d54c Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Mon, 16 Sep 2019 14:46:28 +0200
Subject: [PATCH 07/12] test-tool/BlockEraseReserved: override driver
queue_pdu() callback
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
test-tool/test_sanitize_block_erase_reserved.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c
index fcb862e..4a0d2cb 100644
--- a/test-tool/test_sanitize_block_erase_reserved.c
+++ b/test-tool/test_sanitize_block_erase_reserved.c
@@ -25,8 +25,9 @@
#include "iscsi-test-cu.h"
static int change_num;
+static struct iscsi_transport iscsi_drv_orig;
-static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu *pdu)
+static int my_iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
{
switch (change_num) {
case 1:
@@ -43,12 +44,12 @@ static int my_iscsi_queue_pdu(struct iscsi_context *iscsi _U_, struct iscsi_pdu
break;
}
- change_num = 0;
- return 0;
+ change_num = 0;
+ return iscsi_drv_orig.queue_pdu(iscsi, pdu);
}
void test_sanitize_block_erase_reserved(void)
-{
+{
int i;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
@@ -64,8 +65,9 @@ void test_sanitize_block_erase_reserved(void)
return;
}
- local_iscsi_queue_pdu = my_iscsi_queue_pdu;
-
+ /* override transport queue_pdu callback for PDU manipulation */
+ iscsi_drv_orig = *sd->iscsi_ctx->drv;
+ sd->iscsi_ctx->drv->queue_pdu = my_iscsi_queue_pdu;
logging(LOG_VERBOSE, "Send SANITIZE command with the reserved "
"bit in byte 1 set to 1");
@@ -81,4 +83,7 @@ void test_sanitize_block_erase_reserved(void)
SANITIZE(sd, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);
}
+
+ /* restore transport callbacks */
+ *(sd->iscsi_ctx->drv) = iscsi_drv_orig;
}
--
1.8.3.1
1
https://gitee.com/src-openeuler/libiscsi.git
git@gitee.com:src-openeuler/libiscsi.git
src-openeuler
libiscsi
libiscsi
master

搜索帮助