1 /*- 2 * Copyright (c) 2009 Rick Macklem, University of Guelph 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29 #ifndef _NFS_NFSKPIPORT_H_ 30 #define _NFS_NFSKPIPORT_H_ 31 /* 32 * These definitions are needed since the generic code is now using Darwin8 33 * KPI stuff. (I know, seems a bit silly, but I want the code to build on 34 * Darwin8 and hopefully subsequent releases from Apple.) 35 */ 36 typedef struct mount * mount_t; 37 #define vfs_statfs(m) (&((m)->mnt_stat)) 38 #define vfs_flags(m) ((m)->mnt_flag) 39 40 typedef struct vnode * vnode_t; 41 #define vnode_mount(v) ((v)->v_mount) 42 #define vnode_vtype(v) ((v)->v_type) 43 44 typedef struct mbuf * mbuf_t; 45 #define mbuf_freem(m) m_freem(m) 46 #define mbuf_data(m) mtod((m), void *) 47 #define mbuf_len(m) ((m)->m_len) 48 #define mbuf_next(m) ((m)->m_next) 49 #define mbuf_setlen(m, l) ((m)->m_len = (l)) 50 #define mbuf_setnext(m, p) ((m)->m_next = (p)) 51 #define mbuf_pkthdr_len(m) ((m)->m_pkthdr.len) 52 #define mbuf_pkthdr_setlen(m, l) ((m)->m_pkthdr.len = (l)) 53 #define mbuf_pkthdr_setrcvif(m, p) ((m)->m_pkthdr.rcvif = (p)) 54 55 /* 56 * This stuff is needed by Darwin for handling the uio structure. 57 */ 58 #define CAST_USER_ADDR_T(a) (a) 59 #define CAST_DOWN(c, a) ((c) (a)) 60 #define uio_uio_resid(p) ((p)->uio_resid) 61 #define uio_uio_resid_add(p, v) ((p)->uio_resid += (v)) 62 #define uio_uio_resid_set(p, v) ((p)->uio_resid = (v)) 63 #define uio_iov_base(p) ((p)->uio_iov->iov_base) 64 #define uio_iov_base_add(p, v) do { \ 65 char *pp; \ 66 pp = (char *)(p)->uio_iov->iov_base; \ 67 pp += (v); \ 68 (p)->uio_iov->iov_base = (void *)pp; \ 69 } while (0) 70 #define uio_iov_len(p) ((p)->uio_iov->iov_len) 71 #define uio_iov_len_add(p, v) ((p)->uio_iov->iov_len += (v)) 72 73 #endif /* _NFS_NFSKPIPORT_H */ 74