2 * Copyright (c) 2014 The FreeBSD Foundation
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * This file is used to provide the initiator and target with a prettier
34 * interface. It must not be included by ICL modules, such as icl_soft.c.
37 #ifndef ICL_WRAPPERS_H
38 #define ICL_WRAPPERS_H
42 #include <dev/iscsi/icl.h>
43 #include <icl_conn_if.h>
45 static inline struct icl_pdu *
46 icl_pdu_new(struct icl_conn *ic, int flags)
49 return (ICL_CONN_NEW_PDU(ic, flags));
53 icl_pdu_data_segment_length(const struct icl_pdu *ip)
56 return (ICL_CONN_PDU_DATA_SEGMENT_LENGTH(ip->ip_conn, ip));
60 icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags)
63 return (ICL_CONN_PDU_APPEND_DATA(ip->ip_conn, ip, addr, len, flags));
67 icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len)
70 ICL_CONN_PDU_GET_DATA(ip->ip_conn, ip, off, addr, len);
74 icl_pdu_queue(struct icl_pdu *ip)
77 ICL_CONN_PDU_QUEUE(ip->ip_conn, ip);
81 icl_pdu_free(struct icl_pdu *ip)
84 ICL_CONN_PDU_FREE(ip->ip_conn, ip);
88 icl_conn_free(struct icl_conn *ic)
95 icl_conn_handoff(struct icl_conn *ic, int fd)
98 return (ICL_CONN_HANDOFF(ic, fd));
102 icl_conn_close(struct icl_conn *ic)
109 icl_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
110 struct ccb_scsiio *csio, uint32_t *task_tagp, void **prvp)
113 return (ICL_CONN_TASK_SETUP(ic, ip, csio, task_tagp, prvp));
117 icl_conn_task_done(struct icl_conn *ic, void *prv)
120 ICL_CONN_TASK_DONE(ic, prv);
124 icl_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
125 uint32_t *transfer_tagp, void **prvp)
128 return (ICL_CONN_TRANSFER_SETUP(ic, io, transfer_tagp, prvp));
132 icl_conn_transfer_done(struct icl_conn *ic, void *prv)
135 ICL_CONN_TRANSFER_DONE(ic, prv);
139 * The function below is only used with ICL_KERNEL_PROXY.
142 icl_conn_connect(struct icl_conn *ic, int domain, int socktype,
143 int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
146 return (ICL_CONN_CONNECT(ic, domain, socktype, protocol,
150 #endif /* !ICL_WRAPPERS_H */