caprights.h revision 255219
11553Srgrimes/*-
21553Srgrimes * Copyright (c) 2013 FreeBSD Foundation
31553Srgrimes * All rights reserved.
41553Srgrimes *
51553Srgrimes * This software was developed by Pawel Jakub Dawidek under sponsorship from
61553Srgrimes * the FreeBSD Foundation.
71553Srgrimes *
81553Srgrimes * Redistribution and use in source and binary forms, with or without
91553Srgrimes * modification, are permitted provided that the following conditions
101553Srgrimes * are met:
111553Srgrimes * 1. Redistributions of source code must retain the above copyright
121553Srgrimes *    notice, this list of conditions and the following disclaimer.
131553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141553Srgrimes *    notice, this list of conditions and the following disclaimer in the
151553Srgrimes *    documentation and/or other materials provided with the distribution.
161553Srgrimes *
171553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
181553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201553Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
211553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271553Srgrimes * SUCH DAMAGE.
281553Srgrimes *
291553Srgrimes * $FreeBSD: head/sys/sys/caprights.h 255219 2013-09-05 00:09:56Z pjd $
301553Srgrimes */
3130642Scharnier
321553Srgrimes#ifndef _SYS_CAPRIGHTS_H_
3330642Scharnier#define	_SYS_CAPRIGHTS_H_
3430642Scharnier
3550479Speter/*
361553Srgrimes * The top two bits in the first element of the cr_rights[] array contain
371553Srgrimes * total number of elements in the array - 2. This means if those two bits are
381553Srgrimes * equal to 0, we have 2 array elements.
391553Srgrimes * The top two bits in all remaining array elements should be 0.
401553Srgrimes * The next five bits contain array index. Only one bit is used and bit position
411553Srgrimes * in this five-bits range defines array index. This means there can be at most
421553Srgrimes * five array elements.
431553Srgrimes */
441553Srgrimes#define	CAP_RIGHTS_VERSION_00	0
451553Srgrimes/*
461553Srgrimes#define	CAP_RIGHTS_VERSION_01	1
47246209Scharnier#define	CAP_RIGHTS_VERSION_02	2
481553Srgrimes#define	CAP_RIGHTS_VERSION_03	3
491553Srgrimes*/
501553Srgrimes#define	CAP_RIGHTS_VERSION	CAP_RIGHTS_VERSION_00
511553Srgrimes
521553Srgrimesstruct cap_rights {
531553Srgrimes	uint64_t	cr_rights[CAP_RIGHTS_VERSION + 2];
541553Srgrimes};
551553Srgrimes
561553Srgrimes#ifndef	_CAP_RIGHTS_T_DECLARED
571553Srgrimes#define	_CAP_RIGHTS_T_DECLARED
581553Srgrimestypedef	struct cap_rights	cap_rights_t;
591553Srgrimes#endif
601553Srgrimes
611553Srgrimes#endif /* !_SYS_CAPRIGHTS_H_ */
621553Srgrimes