uipc_mbuf.c (1542) | uipc_mbuf.c (1549) |
---|---|
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 | 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 |
|
50extern vm_map_t mb_map; 51struct mbuf *mbutl; 52char *mclrefcnt; 53 | 52extern vm_map_t mb_map; 53struct mbuf *mbutl; 54char *mclrefcnt; 55 |
56void |
|
54mbinit() 55{ 56 int s; 57 58#if CLBYTES < 4096 59#define NCL_INIT (4096/CLBYTES) 60#else 61#define NCL_INIT 1 --- 8 unchanged lines hidden (view full) --- 70} 71 72/* 73 * Allocate some number of mbuf clusters 74 * and place on cluster free list. 75 * Must be called at splimp. 76 */ 77/* ARGSUSED */ | 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 |
|
78m_clalloc(ncl, nowait) 79 register int ncl; 80 int nowait; 81{ 82 static int logged; 83 register caddr_t p; 84 register int i; 85 int npg; --- 46 unchanged lines hidden (view full) --- 132 133 m_reclaim(); 134#define m_retryhdr(i, t) (struct mbuf *)0 135 MGETHDR(m, i, t); 136#undef m_retryhdr 137 return (m); 138} 139 | 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 |
|
140m_reclaim() 141{ 142 register struct domain *dp; 143 register struct protosw *pr; 144 int s = splimp(); 145 146 for (dp = domains; dp; dp = dp->dom_next) 147 for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) --- 170 unchanged lines hidden (view full) --- 318 MCFail++; 319 return (0); 320} 321 322/* 323 * Copy data from an mbuf chain starting "off" bytes from the beginning, 324 * continuing for "len" bytes, into the indicated buffer. 325 */ | 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 |
|
326m_copydata(m, off, len, cp) 327 register struct mbuf *m; 328 register int off; 329 register int len; 330 caddr_t cp; 331{ 332 register unsigned count; 333 --- 19 unchanged lines hidden (view full) --- 353 } 354} 355 356/* 357 * Concatenate mbuf chain n to m. 358 * Both chains must be of the same type (e.g. MT_DATA). 359 * Any m_pkthdr is not updated. 360 */ | 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 |
|
361m_cat(m, n) 362 register struct mbuf *m, *n; 363{ 364 while (m->m_next) 365 m = m->m_next; 366 while (n) { 367 if (m->m_flags & M_EXT || 368 m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { --- 4 unchanged lines hidden (view full) --- 373 /* splat the data from one into the other */ 374 bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, 375 (u_int)n->m_len); 376 m->m_len += n->m_len; 377 n = m_free(n); 378 } 379} 380 | 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 |
|
381m_adj(mp, req_len) 382 struct mbuf *mp; 383 int req_len; 384{ 385 register int len = req_len; 386 register struct mbuf *m; 387 register count; 388 --- 267 unchanged lines hidden --- | 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 --- |