2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2014 The FreeBSD Foundation
7 * This software was developed by Edward Tomasz Napierala under sponsorship
8 * from the FreeBSD Foundation.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * This file is used to provide the initiator and target with a prettier
36 * interface. It must not be included by ICL modules, such as icl_soft.c.
39 #ifndef ICL_WRAPPERS_H
40 #define ICL_WRAPPERS_H
44 #include <dev/iscsi/icl.h>
45 #include <icl_conn_if.h>
47 static inline struct icl_pdu *
48 icl_pdu_new(struct icl_conn *ic, int flags)
51 return (ICL_CONN_NEW_PDU(ic, flags));
55 icl_pdu_data_segment_length(const struct icl_pdu *ip)
58 return (ICL_CONN_PDU_DATA_SEGMENT_LENGTH(ip->ip_conn, ip));
62 icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags)
65 return (ICL_CONN_PDU_APPEND_DATA(ip->ip_conn, ip, addr, len, flags));
69 icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len)
72 ICL_CONN_PDU_GET_DATA(ip->ip_conn, ip, off, addr, len);
76 icl_pdu_queue(struct icl_pdu *ip)
79 ICL_CONN_PDU_QUEUE(ip->ip_conn, ip);
83 icl_pdu_free(struct icl_pdu *ip)
86 ICL_CONN_PDU_FREE(ip->ip_conn, ip);
90 icl_conn_free(struct icl_conn *ic)
97 icl_conn_handoff(struct icl_conn *ic, int fd)
100 return (ICL_CONN_HANDOFF(ic, fd));
104 icl_conn_close(struct icl_conn *ic)
111 icl_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
112 struct ccb_scsiio *csio, uint32_t *task_tagp, void **prvp)
115 return (ICL_CONN_TASK_SETUP(ic, ip, csio, task_tagp, prvp));
119 icl_conn_task_done(struct icl_conn *ic, void *prv)
122 ICL_CONN_TASK_DONE(ic, prv);
126 icl_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
127 uint32_t *transfer_tagp, void **prvp)
130 return (ICL_CONN_TRANSFER_SETUP(ic, io, transfer_tagp, prvp));
134 icl_conn_transfer_done(struct icl_conn *ic, void *prv)
137 ICL_CONN_TRANSFER_DONE(ic, prv);
141 * The function below is only used with ICL_KERNEL_PROXY.
144 icl_conn_connect(struct icl_conn *ic, int domain, int socktype,
145 int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
148 return (ICL_CONN_CONNECT(ic, domain, socktype, protocol,
152 #endif /* !ICL_WRAPPERS_H */