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 129906 2004-05-31 21:46:06Z 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 if (flags & M_PKTHDR) {
202 m->m_data = m->m_pktdat;
203 m->m_flags = M_PKTHDR;
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 m->m_flags = 0;
218 }
219 mbstat.m_mbufs += 1; /* XXX */
220/* return 1;
221*/
222}
223
224/*
225 * The Mbuf master zone and Packet secondary zone destructor.
226 */
--- 101 unchanged lines hidden (view full) ---
328 m = (struct mbuf *)mem;
329 args = (struct mb_args *)arg;
330 flags = args->flags;
331 type = args->type;
332 how = args->how;
333
334 m->m_type = type;
335 m->m_next = NULL;
336 m->m_data = m->m_ext.ext_buf;
337 m->m_flags = flags|M_EXT;
338 m->m_ext.ext_free = NULL;
339 m->m_ext.ext_args = NULL;
340 m->m_ext.ext_size = MCLBYTES;
341 m->m_ext.ext_type = EXT_PACKET;
342 *(m->m_ext.ref_cnt) = 1;
343
344 if (flags & M_PKTHDR) {
345 m->m_nextpkt = NULL;
346 m->m_pkthdr.rcvif = NULL;
347 m->m_pkthdr.csum_flags = 0;
348 SLIST_INIT(&m->m_pkthdr.tags);
349#ifdef MAC
350 /* If the label init fails, fail the alloc */
351 if (mac_init_mbuf(m, how) != 0) {
352 m_free(m);
353/* XXX*/ panic("mb_ctor_pack(): can't deal with failure!");
--- 32 unchanged lines hidden ---
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 129906 2004-05-31 21:46:06Z 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 if (flags & M_PKTHDR) {
202 m->m_data = m->m_pktdat;
203 m->m_flags = M_PKTHDR;
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 m->m_flags = 0;
218 }
219 mbstat.m_mbufs += 1; /* XXX */
220/* return 1;
221*/
222}
223
224/*
225 * The Mbuf master zone and Packet secondary zone destructor.
226 */
--- 101 unchanged lines hidden (view full) ---
328 m = (struct mbuf *)mem;
329 args = (struct mb_args *)arg;
330 flags = args->flags;
331 type = args->type;
332 how = args->how;
333
334 m->m_type = type;
335 m->m_next = NULL;
336 m->m_data = m->m_ext.ext_buf;
337 m->m_flags = flags|M_EXT;
338 m->m_ext.ext_free = NULL;
339 m->m_ext.ext_args = NULL;
340 m->m_ext.ext_size = MCLBYTES;
341 m->m_ext.ext_type = EXT_PACKET;
342 *(m->m_ext.ref_cnt) = 1;
343
344 if (flags & M_PKTHDR) {
345 m->m_nextpkt = NULL;
346 m->m_pkthdr.rcvif = NULL;
347 m->m_pkthdr.csum_flags = 0;
348 SLIST_INIT(&m->m_pkthdr.tags);
349#ifdef MAC
350 /* If the label init fails, fail the alloc */
351 if (mac_init_mbuf(m, how) != 0) {
352 m_free(m);
353/* XXX*/ panic("mb_ctor_pack(): can't deal with failure!");
--- 32 unchanged lines hidden ---