2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2014 The FreeBSD Foundation
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * This file is used to provide the initiator and target with a prettier
35 * interface. It must not be included by ICL modules, such as icl_soft.c.
38 #ifndef ICL_WRAPPERS_H
39 #define ICL_WRAPPERS_H
43 #include <dev/iscsi/icl.h>
44 #include <icl_conn_if.h>
46 static inline struct icl_pdu *
47 icl_pdu_new(struct icl_conn *ic, int flags)
50 return (ICL_CONN_NEW_PDU(ic, flags));
54 icl_pdu_data_segment_length(const struct icl_pdu *ip)
57 return (ICL_CONN_PDU_DATA_SEGMENT_LENGTH(ip->ip_conn, ip));
61 icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags)
64 return (ICL_CONN_PDU_APPEND_DATA(ip->ip_conn, ip, addr, len, flags));
68 icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len)
71 ICL_CONN_PDU_GET_DATA(ip->ip_conn, ip, off, addr, len);
75 icl_pdu_queue(struct icl_pdu *ip)
78 ICL_CONN_PDU_QUEUE(ip->ip_conn, ip);
82 icl_pdu_queue_cb(struct icl_pdu *ip, icl_pdu_cb cb)
85 ICL_CONN_PDU_QUEUE_CB(ip->ip_conn, ip, cb);
89 icl_pdu_free(struct icl_pdu *ip)
92 ICL_CONN_PDU_FREE(ip->ip_conn, ip);
96 icl_conn_free(struct icl_conn *ic)
103 icl_conn_handoff(struct icl_conn *ic, int fd)
106 return (ICL_CONN_HANDOFF(ic, fd));
110 icl_conn_close(struct icl_conn *ic)
117 icl_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
118 struct ccb_scsiio *csio, uint32_t *task_tagp, void **prvp)
121 return (ICL_CONN_TASK_SETUP(ic, ip, csio, task_tagp, prvp));
125 icl_conn_task_done(struct icl_conn *ic, void *prv)
128 ICL_CONN_TASK_DONE(ic, prv);
132 icl_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
133 uint32_t *transfer_tagp, void **prvp)
136 return (ICL_CONN_TRANSFER_SETUP(ic, io, transfer_tagp, prvp));
140 icl_conn_transfer_done(struct icl_conn *ic, void *prv)
143 ICL_CONN_TRANSFER_DONE(ic, prv);
147 * The function below is only used with ICL_KERNEL_PROXY.
150 icl_conn_connect(struct icl_conn *ic, int domain, int socktype,
151 int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
154 return (ICL_CONN_CONNECT(ic, domain, socktype, protocol,
158 #endif /* !ICL_WRAPPERS_H */