xref: /illumos-gate/usr/src/uts/common/sys/ctfs.h (revision 2d6eb4a5)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*25e8c5aaSvikram  * Common Development and Distribution License (the "License").
6*25e8c5aaSvikram  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*25e8c5aaSvikram  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_CTFS_H
277c478bd9Sstevel@tonic-gate #define	_SYS_CTFS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/contract.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Location of the contract filesystem.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #define	CTFS_ROOT	"/system/contract"
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * CTFS ioctl constants
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate #define	CTFS_PREFIX	('c' << 24 | 't' << 16)
447c478bd9Sstevel@tonic-gate #define	CTFS_IOC(x, y)	(CTFS_PREFIX | (x) << 8 | (y))
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * Control codes for messages written to template files.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate #define	CTFS_TMPL(x)	CTFS_IOC('t', x)
507c478bd9Sstevel@tonic-gate #define	CT_TACTIVATE	CTFS_TMPL(0)	/* Activate template */
517c478bd9Sstevel@tonic-gate #define	CT_TCLEAR	CTFS_TMPL(1)	/* Clear active template */
527c478bd9Sstevel@tonic-gate #define	CT_TCREATE	CTFS_TMPL(2)	/* Create contract from template */
537c478bd9Sstevel@tonic-gate #define	CT_TSET		CTFS_TMPL(3)	/* Set parameter */
547c478bd9Sstevel@tonic-gate #define	CT_TGET		CTFS_TMPL(4)	/* Get parameter */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * Control codes for messages written to ctl files.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #define	CTFS_CTL(x)	CTFS_IOC('c', x)
607c478bd9Sstevel@tonic-gate #define	CT_CABANDON	CTFS_CTL(0)	/* Abandon contract */
617c478bd9Sstevel@tonic-gate #define	CT_CACK		CTFS_CTL(1)	/* Ack a message */
627c478bd9Sstevel@tonic-gate #define	CT_CQREQ	CTFS_CTL(2)	/* Request an additional quantum */
637c478bd9Sstevel@tonic-gate #define	CT_CADOPT	CTFS_CTL(3)	/* Adopt a contract */
647c478bd9Sstevel@tonic-gate #define	CT_CNEWCT	CTFS_CTL(4)	/* Define new contract */
65*25e8c5aaSvikram #define	CT_CNACK	CTFS_CTL(5)	/* nack a negotiation */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * Control codes for messages written to status files.
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate #define	CTFS_STAT(x)	CTFS_IOC('s', x)
717c478bd9Sstevel@tonic-gate #define	CT_SSTATUS	CTFS_STAT(0)	/* Obtain contract status */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * Control codes for messages written to event endpoints.
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #define	CTFS_EVT(x)	CTFS_IOC('e', x)
777c478bd9Sstevel@tonic-gate #define	CT_ERESET	CTFS_EVT(0)	/* Reset event queue pointer */
787c478bd9Sstevel@tonic-gate #define	CT_ERECV	CTFS_EVT(1)	/* Read next event */
797c478bd9Sstevel@tonic-gate #define	CT_ECRECV	CTFS_EVT(2)	/* Read next critical event */
807c478bd9Sstevel@tonic-gate #define	CT_ENEXT	CTFS_EVT(3)	/* Skip current event */
817c478bd9Sstevel@tonic-gate #define	CT_ERELIABLE	CTFS_EVT(4)	/* Request reliable event receipt */
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate #endif
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate #endif	/* _SYS_CTFS_H */
88