xref: /titanic_41/usr/src/uts/common/sys/suntpi.h (revision 6185db853e024a486ff8837e6784dd290d866112)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1990-1998 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SUNTPI_H
28 #define	_SYS_SUNTPI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/ksynch.h>
34 #include <sys/stream.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #ifdef	_KERNEL
41 
42 /*
43  * Persistent information about the capabilities of transport providers.
44  * This structure is for the internal use of sockfs and timod.  Because
45  * bitfield operations are not atomic, the lock must be used to avoid
46  * inconsistencies.
47  */
48 typedef struct tpi_provinfo {
49 	struct tpi_provinfo	*tpi_next;
50 	void			*tpi_key;
51 	size_t			tpi_keylen;
52 	kmutex_t		tpi_lock;
53 	uint32_t		tpi_capability : 2,
54 				tpi_myname : 2,
55 				tpi_peername : 2,
56 				_tpi_unused : 26;
57 } tpi_provinfo_t;
58 
59 /*
60  * Possible values for the above 2-bitfields.  A capability is either
61  * supported, unsupported or unknown.
62  */
63 #define	PI_DONTKNOW	0
64 #define	PI_NO		1
65 #define	PI_YES		2
66 
67 extern void		tpi_init(void);
68 extern tpi_provinfo_t	*tpi_findprov(queue_t *);
69 
70 #define	PI_PROVLOCK(tp)		mutex_enter(&(tp)->tpi_lock)
71 #define	PI_PROVUNLOCK(tp)	mutex_exit(&(tp)->tpi_lock)
72 
73 extern mblk_t	*tpi_ack_alloc(mblk_t *, size_t, uchar_t, t_scalar_t);
74 
75 #endif	/* _KERNEL */
76 
77 #ifdef	__cplusplus
78 }
79 #endif
80 
81 #endif	/* _SYS_SUNTPI_H */
82