]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/test/lib/iscsi/common.c
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / spdk / test / lib / iscsi / common.c
CommitLineData
7c673cae
FG
1#include "iscsi/task.h"
2#include "iscsi/iscsi.h"
3#include "iscsi/conn.h"
4
5#include "spdk/env.h"
6#include "spdk/event.h"
7
8#include "spdk_internal/log.h"
9
10SPDK_LOG_REGISTER_TRACE_FLAG("iscsi", SPDK_TRACE_ISCSI)
11
12struct spdk_iscsi_task *
13spdk_iscsi_task_get(uint32_t *owner_task_ctr, struct spdk_iscsi_task *parent)
14{
15 struct spdk_iscsi_task *task;
16
17 task = calloc(1, sizeof(*task));
18
19 return task;
20}
21
22void
23spdk_scsi_task_put(struct spdk_scsi_task *task)
24{
25 free(task);
26}
27
28void
29spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
30{
31 if (!pdu)
32 return;
33
34 if (pdu->ref < 0) {
35 CU_FAIL("negative ref count");
36 pdu->ref = 0;
37 }
38
39 if (pdu->ref == 0) {
40 if (pdu->data && !pdu->data_from_mempool) {
41 free(pdu->data);
42 }
43 free(pdu);
44 }
45}
46
47struct spdk_iscsi_pdu *
48spdk_get_pdu(void)
49{
50 struct spdk_iscsi_pdu *pdu;
51
52 pdu = malloc(sizeof(*pdu));
53 if (!pdu) {
54 return NULL;
55 }
56
57 memset(pdu, 0, offsetof(struct spdk_iscsi_pdu, ahs_data));
58 pdu->ref = 1;
59
60 return pdu;
61}
62
63void
64spdk_scsi_task_process_null_lun(struct spdk_scsi_task *task)
65{
66}
67
68void
69spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
70 struct spdk_scsi_task *task)
71{
72}
73
74struct spdk_scsi_port *
75spdk_scsi_dev_find_port_by_id(struct spdk_scsi_dev *dev, uint64_t id)
76{
77 return NULL;
78}
79
80int
81spdk_scsi_port_construct(struct spdk_scsi_port *port, uint64_t id, uint16_t index,
82 const char *name)
83{
84 return 0;
85}
86
87void
88spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
89 struct spdk_scsi_task *task)
90{
91}
92
93uint32_t
94spdk_env_get_current_core(void)
95{
96 return 0;
97}
98
99struct spdk_event *
100spdk_event_allocate(uint32_t core, spdk_event_fn fn, void *arg1, void *arg2)
101{
102 return NULL;
103}
104
105struct spdk_scsi_dev *
106 spdk_scsi_dev_construct(const char *name, char **lun_name_list,
107 int *lun_id_list, int num_luns)
108{
109 return NULL;
110}
111
112void
113spdk_scsi_dev_destruct(struct spdk_scsi_dev *dev)
114{
115}
116
117int
118spdk_scsi_dev_add_port(struct spdk_scsi_dev *dev, uint64_t id, const char *name)
119{
120 return 0;
121}
122
123int
124spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match,
125 int drop_all)
126{
127 return 0;
128}
129
130void
131spdk_shutdown_iscsi_conns(void)
132{
133}
134
135void
136process_task_completion(void *arg1, void *arg2)
137{
138}
139
140void
141process_task_mgmt_completion(void *arg1, void *arg2)
142{
143}
144
145int
146spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes,
147 void *buf)
148{
149 return 0;
150}
151
152void
153spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn)
154{
155}
156
157void
158spdk_scsi_dev_print(struct spdk_scsi_dev *dev)
159{
160}
161
162void
163spdk_scsi_task_set_status(struct spdk_scsi_task *task, int sc, int sk, int asc, int ascq)
164{
165}
166
167void
168spdk_scsi_task_set_data(struct spdk_scsi_task *task, void *data, uint32_t len)
169{
170 task->iovs[0].iov_base = data;
171 task->iovs[0].iov_len = len;
172}