18d59ecb2SHans Petter Selasky /*-
28d59ecb2SHans Petter Selasky * Copyright (c) 2010 Isilon Systems, Inc.
38d59ecb2SHans Petter Selasky * Copyright (c) 2010 iX Systems, Inc.
48d59ecb2SHans Petter Selasky * Copyright (c) 2010 Panasas, Inc.
58d59ecb2SHans Petter Selasky * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
68d59ecb2SHans Petter Selasky * All rights reserved.
78d59ecb2SHans Petter Selasky *
88d59ecb2SHans Petter Selasky * Redistribution and use in source and binary forms, with or without
98d59ecb2SHans Petter Selasky * modification, are permitted provided that the following conditions
108d59ecb2SHans Petter Selasky * are met:
118d59ecb2SHans Petter Selasky * 1. Redistributions of source code must retain the above copyright
128d59ecb2SHans Petter Selasky * notice unmodified, this list of conditions, and the following
138d59ecb2SHans Petter Selasky * disclaimer.
148d59ecb2SHans Petter Selasky * 2. Redistributions in binary form must reproduce the above copyright
158d59ecb2SHans Petter Selasky * notice, this list of conditions and the following disclaimer in the
168d59ecb2SHans Petter Selasky * documentation and/or other materials provided with the distribution.
178d59ecb2SHans Petter Selasky *
188d59ecb2SHans Petter Selasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
198d59ecb2SHans Petter Selasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
208d59ecb2SHans Petter Selasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
218d59ecb2SHans Petter Selasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
228d59ecb2SHans Petter Selasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
238d59ecb2SHans Petter Selasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
248d59ecb2SHans Petter Selasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
258d59ecb2SHans Petter Selasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
268d59ecb2SHans Petter Selasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
278d59ecb2SHans Petter Selasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
288d59ecb2SHans Petter Selasky */
29307f78f3SVladimir Kondratyev #ifndef _LINUXKPI_LINUX_SOCKET_H_
30307f78f3SVladimir Kondratyev #define _LINUXKPI_LINUX_SOCKET_H_
318d59ecb2SHans Petter Selasky
328d59ecb2SHans Petter Selasky #include <sys/socket.h>
338d59ecb2SHans Petter Selasky
34*d544b53cSBjoern A. Zeeb #define AF_QIPCRTR 42
35*d544b53cSBjoern A. Zeeb
36*d544b53cSBjoern A. Zeeb static inline int
kernel_connect(int sd,struct sockaddr * sa,size_t salen,int flags)37*d544b53cSBjoern A. Zeeb kernel_connect(int sd, struct sockaddr *sa, size_t salen, int flags)
38*d544b53cSBjoern A. Zeeb {
39*d544b53cSBjoern A. Zeeb
40*d544b53cSBjoern A. Zeeb /* kern_connectat()? It is used for sockaddr_qrtr by ath1xk/qmi. */
41*d544b53cSBjoern A. Zeeb pr_debug("%s: TODO\n", __func__);
42*d544b53cSBjoern A. Zeeb return (-EINVAL);
43*d544b53cSBjoern A. Zeeb }
44*d544b53cSBjoern A. Zeeb
458d59ecb2SHans Petter Selasky #ifdef notyet
468d59ecb2SHans Petter Selasky static inline int
memcpy_toiovec(struct iovec * v,unsigned char * kdata,int len)478d59ecb2SHans Petter Selasky memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len)
488d59ecb2SHans Petter Selasky {
498d59ecb2SHans Petter Selasky struct uio uio;
508d59ecb2SHans Petter Selasky int error;
518d59ecb2SHans Petter Selasky
528d59ecb2SHans Petter Selasky uio.uio_iov = v;
538d59ecb2SHans Petter Selasky uio.uio_iovcnt = -1;
548d59ecb2SHans Petter Selasky uio.uio_offset = 0;
558d59ecb2SHans Petter Selasky uio.uio_resid = len;
568d59ecb2SHans Petter Selasky uio.uio_segflag = UIO_USERSPACE;
578d59ecb2SHans Petter Selasky uio.uio_rw = UIO_READ;
588d59ecb2SHans Petter Selasky error = -uiomove(kdata, len, &uio);
598d59ecb2SHans Petter Selasky return (error);
608d59ecb2SHans Petter Selasky }
618d59ecb2SHans Petter Selasky
628d59ecb2SHans Petter Selasky static inline int
memcpy_fromiovec(unsigned char * kdata,struct iovec * iov,int len)638d59ecb2SHans Petter Selasky memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
648d59ecb2SHans Petter Selasky {
658d59ecb2SHans Petter Selasky struct uio uio;
668d59ecb2SHans Petter Selasky int error;
678d59ecb2SHans Petter Selasky
688d59ecb2SHans Petter Selasky uio.uio_iov = v;
698d59ecb2SHans Petter Selasky uio.uio_iovcnt = -1;
708d59ecb2SHans Petter Selasky uio.uio_offset = 0;
718d59ecb2SHans Petter Selasky uio.uio_resid = len;
728d59ecb2SHans Petter Selasky uio.uio_segflag = UIO_USERSPACE;
738d59ecb2SHans Petter Selasky uio.uio_rw = UIO_WRITE;
748d59ecb2SHans Petter Selasky error = -uiomove(kdata, len, &uio);
758d59ecb2SHans Petter Selasky }
768d59ecb2SHans Petter Selasky #endif
778d59ecb2SHans Petter Selasky
78307f78f3SVladimir Kondratyev #endif /* _LINUXKPI_LINUX_SOCKET_H_ */
79