bpf_buffer.c (0269ae4c19ad779b43b0d6e2416ac7386945d692) bpf_buffer.c (82334850ea451f7f6903be20e4836118e6a77460)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2007 Seccuris Inc.
5 * All rights reserved.
6 *
7 * This software was developed by Robert N. M. Watson under contract to
8 * Seccuris Inc.

--- 105 unchanged lines hidden (view full) ---

114 * Scatter-gather data copy from an mbuf chain to the current kernel buffer.
115 */
116void
117bpf_buffer_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset, void *src,
118 u_int len)
119{
120 const struct mbuf *m;
121 u_char *dst;
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2007 Seccuris Inc.
5 * All rights reserved.
6 *
7 * This software was developed by Robert N. M. Watson under contract to
8 * Seccuris Inc.

--- 105 unchanged lines hidden (view full) ---

114 * Scatter-gather data copy from an mbuf chain to the current kernel buffer.
115 */
116void
117bpf_buffer_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset, void *src,
118 u_int len)
119{
120 const struct mbuf *m;
121 u_char *dst;
122 u_int count;
123
124 m = (struct mbuf *)src;
125 dst = (u_char *)buf + offset;
122
123 m = (struct mbuf *)src;
124 dst = (u_char *)buf + offset;
126 while (len > 0) {
127 if (m == NULL)
128 panic("bpf_mcopy");
129 count = min(m->m_len, len);
130 bcopy(mtod(m, void *), dst, count);
131 m = m->m_next;
132 dst += count;
133 len -= count;
134 }
125 m_copydata(m, 0, len, dst);
135}
136
137/*
138 * Free BPF kernel buffers on device close.
139 */
140void
141bpf_buffer_free(struct bpf_d *d)
142{

--- 81 unchanged lines hidden ---
126}
127
128/*
129 * Free BPF kernel buffers on device close.
130 */
131void
132bpf_buffer_free(struct bpf_d *d)
133{

--- 81 unchanged lines hidden ---