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