xref: /onnv-gate/usr/src/uts/common/sys/strsun.h (revision 6990:d24af98bb8ea)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51676Sjpk  * Common Development and Distribution License (the "License").
61676Sjpk  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6990Sgd78059  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_STRSUN_H
270Sstevel@tonic-gate #define	_SYS_STRSUN_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/stream.h>
320Sstevel@tonic-gate #include <sys/types.h>
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifdef	__cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * Solaris DDI STREAMS utility routines.
400Sstevel@tonic-gate  *
410Sstevel@tonic-gate  * See the appropriate section 9F manpage for documentation.
420Sstevel@tonic-gate  */
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #define	DB_BASE(mp)	((mp)->b_datap->db_base)
450Sstevel@tonic-gate #define	DB_LIM(mp)	((mp)->b_datap->db_lim)
460Sstevel@tonic-gate #define	DB_REF(mp)	((mp)->b_datap->db_ref)
470Sstevel@tonic-gate #define	DB_TYPE(mp)	((mp)->b_datap->db_type)
48898Skais #define	DB_FLAGS(mp)	((mp)->b_datap->db_flags)
490Sstevel@tonic-gate 
50*6990Sgd78059 #define	_PTRDIFF(p1, p2)	((intptr_t)((uintptr_t)(p1) - (uintptr_t)(p2)))
51*6990Sgd78059 #define	MBLKL(mp)		_PTRDIFF((mp)->b_wptr, (mp)->b_rptr)
52*6990Sgd78059 #define	MBLKSIZE(mp)		_PTRDIFF(DB_LIM(mp), DB_BASE(mp))
53*6990Sgd78059 #define	MBLKHEAD(mp)		_PTRDIFF((mp)->b_rptr, DB_BASE(mp))
54*6990Sgd78059 #define	MBLKTAIL(mp)		_PTRDIFF(DB_LIM(mp), (mp)->b_wptr)
550Sstevel@tonic-gate #define	MBLKIN(mp, off, len) (((off) <= MBLKL(mp)) && \
56*6990Sgd78059 	(((mp)->b_rptr + (off) + (len)) <= (mp)->b_wptr))
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #ifdef	_KERNEL
590Sstevel@tonic-gate extern void	mcopyin(mblk_t *, void *, size_t, void *);
600Sstevel@tonic-gate extern void	mcopyout(mblk_t *, void *, size_t, void *, mblk_t *);
610Sstevel@tonic-gate extern void	merror(queue_t *, mblk_t *, int);
620Sstevel@tonic-gate extern void	mioc2ack(mblk_t *, mblk_t *, size_t, int);
630Sstevel@tonic-gate extern void	miocack(queue_t *, mblk_t *, int, int);
640Sstevel@tonic-gate extern void	miocnak(queue_t *, mblk_t *, int, int);
650Sstevel@tonic-gate extern int	miocpullup(mblk_t *, size_t);
660Sstevel@tonic-gate extern mblk_t	*mexchange(queue_t *, mblk_t *, size_t, uchar_t, int32_t);
670Sstevel@tonic-gate extern size_t	msgsize(mblk_t *);
680Sstevel@tonic-gate extern void	mcopymsg(mblk_t *, void *);
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #endif	/* _KERNEL */
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #ifdef	__cplusplus
730Sstevel@tonic-gate }
740Sstevel@tonic-gate #endif
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #endif	/* _SYS_STRSUN_H */
77