1/* 2 * Copyright (c) 1982, 1986, 1988, 1991, 1993 3 * The Regents of the University of California. 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 --- 33 unchanged lines hidden (view full) --- 42#include <sys/mbuf.h> 43#include <sys/kernel.h> 44#include <sys/syslog.h> 45#include <sys/domain.h> 46#include <sys/protosw.h> 47 48#include <vm/vm.h> 49 |
50void m_reclaim __P(()); 51 |
52extern vm_map_t mb_map; 53struct mbuf *mbutl; 54char *mclrefcnt; 55 |
56void |
57mbinit() 58{ 59 int s; 60 61#if CLBYTES < 4096 62#define NCL_INIT (4096/CLBYTES) 63#else 64#define NCL_INIT 1 --- 8 unchanged lines hidden (view full) --- 73} 74 75/* 76 * Allocate some number of mbuf clusters 77 * and place on cluster free list. 78 * Must be called at splimp. 79 */ 80/* ARGSUSED */ |
81int |
82m_clalloc(ncl, nowait) 83 register int ncl; 84 int nowait; 85{ 86 static int logged; 87 register caddr_t p; 88 register int i; 89 int npg; --- 46 unchanged lines hidden (view full) --- 136 137 m_reclaim(); 138#define m_retryhdr(i, t) (struct mbuf *)0 139 MGETHDR(m, i, t); 140#undef m_retryhdr 141 return (m); 142} 143 |
144void |
145m_reclaim() 146{ 147 register struct domain *dp; 148 register struct protosw *pr; 149 int s = splimp(); 150 151 for (dp = domains; dp; dp = dp->dom_next) 152 for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) --- 170 unchanged lines hidden (view full) --- 323 MCFail++; 324 return (0); 325} 326 327/* 328 * Copy data from an mbuf chain starting "off" bytes from the beginning, 329 * continuing for "len" bytes, into the indicated buffer. 330 */ |
331void |
332m_copydata(m, off, len, cp) 333 register struct mbuf *m; 334 register int off; 335 register int len; 336 caddr_t cp; 337{ 338 register unsigned count; 339 --- 19 unchanged lines hidden (view full) --- 359 } 360} 361 362/* 363 * Concatenate mbuf chain n to m. 364 * Both chains must be of the same type (e.g. MT_DATA). 365 * Any m_pkthdr is not updated. 366 */ |
367void |
368m_cat(m, n) 369 register struct mbuf *m, *n; 370{ 371 while (m->m_next) 372 m = m->m_next; 373 while (n) { 374 if (m->m_flags & M_EXT || 375 m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { --- 4 unchanged lines hidden (view full) --- 380 /* splat the data from one into the other */ 381 bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, 382 (u_int)n->m_len); 383 m->m_len += n->m_len; 384 n = m_free(n); 385 } 386} 387 |
388void |
389m_adj(mp, req_len) 390 struct mbuf *mp; 391 int req_len; 392{ 393 register int len = req_len; 394 register struct mbuf *m; 395 register count; 396 --- 267 unchanged lines hidden --- |