X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/91447636331957f3d9b5ca5b508f07c526b0074d..89b3af67bb32e691275bf6fa803d1834b2284115:/bsd/kern/uipc_mbuf.c diff --git a/bsd/kern/uipc_mbuf.c b/bsd/kern/uipc_mbuf.c index 84100312a..422284a6c 100644 --- a/bsd/kern/uipc_mbuf.c +++ b/bsd/kern/uipc_mbuf.c @@ -1,23 +1,29 @@ /* * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /* @@ -145,7 +151,7 @@ static void mbuf_expand_thread(void); static int m_expand(int ); static caddr_t m_bigalloc(int ); static void m_bigfree(caddr_t , u_int , caddr_t ); -static struct mbuf * m_mbigget(struct mbuf *, int ); +__private_extern__ struct mbuf * m_mbigget(struct mbuf *, int ); void mbinit(void); static void m_range_check(void *addr); @@ -216,11 +222,9 @@ mbinit(void) nclpp = round_page_32(MCLBYTES) / MCLBYTES; /* see mbufgc() */ if (nclpp < 1) nclpp = 1; mbuf_mlock_grp_attr = lck_grp_attr_alloc_init(); - lck_grp_attr_setdefault(mbuf_mlock_grp_attr); mbuf_mlock_grp = lck_grp_alloc_init("mbuf", mbuf_mlock_grp_attr); mbuf_mlock_attr = lck_attr_alloc_init(); - lck_attr_setdefault(mbuf_mlock_attr); mbuf_mlock = lck_mtx_alloc_init(mbuf_mlock_grp, mbuf_mlock_attr); @@ -812,8 +816,7 @@ m_move_pkthdr(struct mbuf *to, struct mbuf *from) * "from" must have M_PKTHDR set, and "to" must be empty. * In particular, this does a deep copy of the packet tags. */ -#ifndef __APPLE__ -int +static int m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how) { to->m_flags = (from->m_flags & M_COPYFLAGS) | (to->m_flags & M_EXT); @@ -823,7 +826,6 @@ m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how) SLIST_INIT(&to->m_pkthdr.tags); return (m_tag_copy_chain(to, from, how)); } -#endif /* * return a list of mbuf hdrs that point to clusters... @@ -2146,17 +2148,8 @@ m_dup(struct mbuf *m, int how) { if ((n = m_gethdr(how, m->m_type)) == NULL) return(NULL); n->m_len = m->m_len; - n->m_flags |= (m->m_flags & M_COPYFLAGS); - n->m_pkthdr.len = m->m_pkthdr.len; - n->m_pkthdr.rcvif = m->m_pkthdr.rcvif; - n->m_pkthdr.header = NULL; - n->m_pkthdr.csum_flags = 0; - n->m_pkthdr.csum_data = 0; - n->m_pkthdr.aux = NULL; - n->m_pkthdr.vlan_tag = 0; - n->m_pkthdr.socket_id = 0; - SLIST_INIT(&n->m_pkthdr.tags); - bcopy(m->m_data, n->m_data, m->m_pkthdr.len); + m_dup_pkthdr(n, m, how); + bcopy(m->m_data, n->m_data, m->m_len); return(n); } } else if (m->m_len <= MLEN) @@ -2187,8 +2180,7 @@ m_dup(struct mbuf *m, int how) *np = n; if (copyhdr) { /* Don't use M_COPY_PKTHDR: preserve m_data */ - n->m_pkthdr = m->m_pkthdr; - n->m_flags |= (m->m_flags & M_COPYFLAGS); + m_dup_pkthdr(n, m, how); copyhdr = 0; if ((n->m_flags & M_EXT) == 0) n->m_data = n->m_pktdat;