2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
28 * All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the University of
41 * California, Berkeley and its contributors.
216 (m)->m_flags = M_PKTHDR; \
217 }
218
219 #define MCLGET(m, how) \
220 { \
221 (m)->m_ext.ext_buf = smb_mbufcl_alloc(); \
222 (m)->m_data = (m)->m_ext.ext_buf; \
223 (m)->m_flags |= M_EXT; \
224 (m)->m_ext.ext_size = MCLBYTES; \
225 (m)->m_ext.ext_ref = smb_mbufcl_ref; \
226 }
227
228 /*
229 * MFREE(struct mbuf *m, struct mbuf *nn)
230 * Free a single mbuf and associated external storage.
231 * Place the successor, if any, in nn.
232 */
233 #define MFREE(m, nn) \
234 { \
235 if ((m)->m_flags & M_EXT) { \
236 (*((m)->m_ext.ext_ref))((m)->m_ext.ext_buf, \
237 (m)->m_ext.ext_size, -1); \
238 (m)->m_ext.ext_buf = 0; \
239 } \
240 (nn) = (m)->m_next; \
241 (m)->m_next = 0; \
242 smb_mbuf_free(m); \
243 }
244
245
246
247 /*
248 * As above, for mbufs allocated with m_gethdr/MGETHDR
249 * or initialized by M_COPY_PKTHDR.
250 */
251 #define MH_ALIGN(m, len) \
252 { (m)->m_data += (MHLEN - (len)) &~ (sizeof (int32_t) - 1); }
253
254 #define SMB_MBC_MAGIC 0x4D42435F
255 #define SMB_MBC_VALID(p) ASSERT((p)->mbc_magic == SMB_MBC_MAGIC)
256
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2019 Joyent, Inc.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27 /*
28 * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
29 * All rights reserved.
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
217 (m)->m_flags = M_PKTHDR; \
218 }
219
220 #define MCLGET(m, how) \
221 { \
222 (m)->m_ext.ext_buf = smb_mbufcl_alloc(); \
223 (m)->m_data = (m)->m_ext.ext_buf; \
224 (m)->m_flags |= M_EXT; \
225 (m)->m_ext.ext_size = MCLBYTES; \
226 (m)->m_ext.ext_ref = smb_mbufcl_ref; \
227 }
228
229 /*
230 * MFREE(struct mbuf *m, struct mbuf *nn)
231 * Free a single mbuf and associated external storage.
232 * Place the successor, if any, in nn.
233 */
234 #define MFREE(m, nn) \
235 { \
236 if ((m)->m_flags & M_EXT) { \
237 (void) (*((m)->m_ext.ext_ref)) \
238 ((m)->m_ext.ext_buf, \
239 (m)->m_ext.ext_size, -1); \
240 (m)->m_ext.ext_buf = 0; \
241 } \
242 (nn) = (m)->m_next; \
243 (m)->m_next = 0; \
244 smb_mbuf_free(m); \
245 }
246
247
248
249 /*
250 * As above, for mbufs allocated with m_gethdr/MGETHDR
251 * or initialized by M_COPY_PKTHDR.
252 */
253 #define MH_ALIGN(m, len) \
254 { (m)->m_data += (MHLEN - (len)) &~ (sizeof (int32_t) - 1); }
255
256 #define SMB_MBC_MAGIC 0x4D42435F
257 #define SMB_MBC_VALID(p) ASSERT((p)->mbc_magic == SMB_MBC_MAGIC)
258
|