/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef _SMBSRV_MBUF_H
#define _SMBSRV_MBUF_H
/*
* This mbuf simulation should be replaced with (native) mblk_t support.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Mbufs are of a single size, MSIZE (machine/machparam.h), which
* includes overhead. An mbuf may add a single "mbuf cluster" of size
* MCLBYTES (also in machine/machparam.h), which has no additional overhead
* and is used instead of the internal data area; this is done when
* at least MINCLSIZE of data must be stored.
*/
/*
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
*/
/* header at beginning of each mbuf: */
struct m_hdr {
};
struct pkthdr {
};
/* description of external storage mapped into mbuf, valid if M_EXT set */
struct m_ext {
};
typedef struct mbuf {
union {
struct {
union {
} MH_dat;
} MH;
} M_dat;
} mbuf_t;
/* mbuf flags */
/* mbuf pkthdr flags, also in m_flags */
/* flags copied when copying m_pkthdr */
/* XXX probably only need MT_DATA */
/* mbuf types */
/*
* flags to malloc: PBSHORTCUT
*/
/*
* mbuf allocation/deallocation macros:
*
* MGET(struct mbuf *m, int how, int type)
* allocates an mbuf and initializes it to contain internal data.
*
* MGETHDR(struct mbuf *m, int how, int type)
* allocates an mbuf and initializes it to contain a packet header
* and internal data.
*/
m = smb_mbuf_alloc(); \
(m)->m_flags = 0; \
}
m = smb_mbuf_alloc(); \
}
{ \
}
/*
* MFREE(struct mbuf *m, struct mbuf *nn)
* Free a single mbuf and associated external storage.
* Place the successor, if any, in nn.
*/
{ \
} \
(m)->m_next = 0; \
smb_mbuf_free(m); \
}
/*
* or initialized by M_COPY_PKTHDR.
*/
typedef struct mbuf_chain {
} mbuf_chain_t;
mbuf_t *smb_mbuf_alloc(void);
void smb_mbuf_free(mbuf_t *);
void *smb_mbufcl_alloc(void);
void smb_mbufcl_free(void *);
int smb_mbufcl_ref(void *, uint_t, int);
void smb_mbc_init(void);
void smb_mbc_fini(void);
void smb_mbc_free(mbuf_chain_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_MBUF_H */