xref: /illumos-gate/usr/src/uts/common/sys/ctfs.h (revision 8b80e8cb6855118d46f605e91b5ed4ce83417395)
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 (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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_CTFS_H
27 #define	_SYS_CTFS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/contract.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Location of the contract filesystem.
39  */
40 #define	CTFS_ROOT	"/system/contract"
41 
42 /*
43  * CTFS ioctl constants
44  */
45 #define	CTFS_PREFIX	('c' << 24 | 't' << 16)
46 #define	CTFS_IOC(x, y)	(CTFS_PREFIX | (x) << 8 | (y))
47 
48 /*
49  * Control codes for messages written to template files.
50  */
51 #define	CTFS_TMPL(x)	CTFS_IOC('t', x)
52 #define	CT_TACTIVATE	CTFS_TMPL(0)	/* Activate template */
53 #define	CT_TCLEAR	CTFS_TMPL(1)	/* Clear active template */
54 #define	CT_TCREATE	CTFS_TMPL(2)	/* Create contract from template */
55 #define	CT_TSET		CTFS_TMPL(3)	/* Set parameter */
56 #define	CT_TGET		CTFS_TMPL(4)	/* Get parameter */
57 
58 /*
59  * Control codes for messages written to ctl files.
60  */
61 #define	CTFS_CTL(x)	CTFS_IOC('c', x)
62 #define	CT_CABANDON	CTFS_CTL(0)	/* Abandon contract */
63 #define	CT_CACK		CTFS_CTL(1)	/* Ack a message */
64 #define	CT_CQREQ	CTFS_CTL(2)	/* Request an additional quantum */
65 #define	CT_CADOPT	CTFS_CTL(3)	/* Adopt a contract */
66 #define	CT_CNEWCT	CTFS_CTL(4)	/* Define new contract */
67 #define	CT_CNACK	CTFS_CTL(5)	/* nack a negotiation */
68 
69 /*
70  * Control codes for messages written to status files.
71  */
72 #define	CTFS_STAT(x)	CTFS_IOC('s', x)
73 #define	CT_SSTATUS	CTFS_STAT(0)	/* Obtain contract status */
74 
75 /*
76  * Control codes for messages written to event endpoints.
77  */
78 #define	CTFS_EVT(x)	CTFS_IOC('e', x)
79 #define	CT_ERESET	CTFS_EVT(0)	/* Reset event queue pointer */
80 #define	CT_ERECV	CTFS_EVT(1)	/* Read next event */
81 #define	CT_ECRECV	CTFS_EVT(2)	/* Read next critical event */
82 #define	CT_ENEXT	CTFS_EVT(3)	/* Skip current event */
83 #define	CT_ERELIABLE	CTFS_EVT(4)	/* Request reliable event receipt */
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif	/* _SYS_CTFS_H */
90