1/*- 2 * Copyright (c) 2004 3 * Bosko Milekic <bmilekic@FreeBSD.org>. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 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 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 129947 2004-06-01 16:17:10Z bmilekic $"); |
34 35#include "opt_mac.h" 36#include "opt_param.h" 37 38#include <sys/param.h> 39#include <sys/mac.h> 40#include <sys/malloc.h> 41#include <sys/systm.h> --- 151 unchanged lines hidden (view full) --- 193 args = (struct mb_args *)arg; 194 flags = args->flags; 195 how = args->how; 196 type = args->type; 197 198 m->m_type = type; 199 m->m_next = NULL; 200 m->m_nextpkt = NULL; |
201 m->m_flags = flags; |
202 if (flags & M_PKTHDR) { 203 m->m_data = m->m_pktdat; |
204 m->m_pkthdr.rcvif = NULL; 205 m->m_pkthdr.csum_flags = 0; 206 SLIST_INIT(&m->m_pkthdr.tags); 207#ifdef MAC 208 /* If the label init fails, fail the alloc */ 209 if (mac_init_mbuf(m, how) != 0) { 210 m_free(m); 211/* XXX*/ panic("mb_ctor_mbuf(): can't deal with failure!"); 212/* return 0; */ 213 } 214#endif |
215 } else |
216 m->m_data = m->m_dat; |
217 mbstat.m_mbufs += 1; /* XXX */ 218/* return 1; 219*/ 220} 221 222/* 223 * The Mbuf master zone and Packet secondary zone destructor. 224 */ --- 101 unchanged lines hidden (view full) --- 326 m = (struct mbuf *)mem; 327 args = (struct mb_args *)arg; 328 flags = args->flags; 329 type = args->type; 330 how = args->how; 331 332 m->m_type = type; 333 m->m_next = NULL; |
334 m->m_nextpkt = NULL; |
335 m->m_data = m->m_ext.ext_buf; 336 m->m_flags = flags|M_EXT; 337 m->m_ext.ext_free = NULL; 338 m->m_ext.ext_args = NULL; 339 m->m_ext.ext_size = MCLBYTES; 340 m->m_ext.ext_type = EXT_PACKET; 341 *(m->m_ext.ref_cnt) = 1; 342 343 if (flags & M_PKTHDR) { |
344 m->m_pkthdr.rcvif = NULL; 345 m->m_pkthdr.csum_flags = 0; 346 SLIST_INIT(&m->m_pkthdr.tags); 347#ifdef MAC 348 /* If the label init fails, fail the alloc */ 349 if (mac_init_mbuf(m, how) != 0) { 350 m_free(m); 351/* XXX*/ panic("mb_ctor_pack(): can't deal with failure!"); --- 32 unchanged lines hidden --- |