mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
Initial Linux ZFS GIT Repo
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
subdir-m += amd64 i386 ia32 rpc sparc64 sys tsol
|
||||
DISTFILES = assert.h atomic.h devid.h dirent.h libc.h libdevinfo.h libgen.h
|
||||
DISTFILES += mtlib.h priv.h stdarg.h stdio_ext.h strings.h ucred.h zone.h
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
subdir-m += sys
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTFILES = asm_linkage.h
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#ifndef __amd64
|
||||
#define __amd64
|
||||
#endif
|
||||
|
||||
#include <ia32/sys/asm_linkage.h>
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_ASSERT_H
|
||||
#define _SOL_ASSERT_H
|
||||
|
||||
#include_next <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __assert_c99
|
||||
static inline void __assert_c99(const char *expr, const char *file, int line, const char *func)
|
||||
{
|
||||
fprintf(stderr, "%s:%i: %s: Assertion `%s` failed.\n", file, line, func, expr);
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ATOMIC_H
|
||||
#define _SYS_ATOMIC_H
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/inttypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) && defined(__GNUC__) && defined(_ASM_INLINES) && \
|
||||
(defined(__i386) || defined(__amd64))
|
||||
#include <asm/atomic.h>
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) || defined(__STDC__)
|
||||
/*
|
||||
* Increment target.
|
||||
*/
|
||||
extern void atomic_inc_8(volatile uint8_t *);
|
||||
extern void atomic_inc_uchar(volatile uchar_t *);
|
||||
extern void atomic_inc_16(volatile uint16_t *);
|
||||
extern void atomic_inc_ushort(volatile ushort_t *);
|
||||
extern void atomic_inc_32(volatile uint32_t *);
|
||||
extern void atomic_inc_uint(volatile uint_t *);
|
||||
extern void atomic_inc_ulong(volatile ulong_t *);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern void atomic_inc_64(volatile uint64_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decrement target
|
||||
*/
|
||||
extern void atomic_dec_8(volatile uint8_t *);
|
||||
extern void atomic_dec_uchar(volatile uchar_t *);
|
||||
extern void atomic_dec_16(volatile uint16_t *);
|
||||
extern void atomic_dec_ushort(volatile ushort_t *);
|
||||
extern void atomic_dec_32(volatile uint32_t *);
|
||||
extern void atomic_dec_uint(volatile uint_t *);
|
||||
extern void atomic_dec_ulong(volatile ulong_t *);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern void atomic_dec_64(volatile uint64_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add delta to target
|
||||
*/
|
||||
extern void atomic_add_8(volatile uint8_t *, int8_t);
|
||||
extern void atomic_add_char(volatile uchar_t *, signed char);
|
||||
extern void atomic_add_16(volatile uint16_t *, int16_t);
|
||||
extern void atomic_add_short(volatile ushort_t *, short);
|
||||
extern void atomic_add_32(volatile uint32_t *, int32_t);
|
||||
extern void atomic_add_int(volatile uint_t *, int);
|
||||
extern void atomic_add_ptr(volatile void *, ssize_t);
|
||||
extern void atomic_add_long(volatile ulong_t *, long);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern void atomic_add_64(volatile uint64_t *, int64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* logical OR bits with target
|
||||
*/
|
||||
extern void atomic_or_8(volatile uint8_t *, uint8_t);
|
||||
extern void atomic_or_uchar(volatile uchar_t *, uchar_t);
|
||||
extern void atomic_or_16(volatile uint16_t *, uint16_t);
|
||||
extern void atomic_or_ushort(volatile ushort_t *, ushort_t);
|
||||
extern void atomic_or_32(volatile uint32_t *, uint32_t);
|
||||
extern void atomic_or_uint(volatile uint_t *, uint_t);
|
||||
extern void atomic_or_ulong(volatile ulong_t *, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern void atomic_or_64(volatile uint64_t *, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* logical AND bits with target
|
||||
*/
|
||||
extern void atomic_and_8(volatile uint8_t *, uint8_t);
|
||||
extern void atomic_and_uchar(volatile uchar_t *, uchar_t);
|
||||
extern void atomic_and_16(volatile uint16_t *, uint16_t);
|
||||
extern void atomic_and_ushort(volatile ushort_t *, ushort_t);
|
||||
extern void atomic_and_32(volatile uint32_t *, uint32_t);
|
||||
extern void atomic_and_uint(volatile uint_t *, uint_t);
|
||||
extern void atomic_and_ulong(volatile ulong_t *, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern void atomic_and_64(volatile uint64_t *, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* As above, but return the new value. Note that these _nv() variants are
|
||||
* substantially more expensive on some platforms than the no-return-value
|
||||
* versions above, so don't use them unless you really need to know the
|
||||
* new value *atomically* (e.g. when decrementing a reference count and
|
||||
* checking whether it went to zero).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Increment target and return new value.
|
||||
*/
|
||||
extern uint8_t atomic_inc_8_nv(volatile uint8_t *);
|
||||
extern uchar_t atomic_inc_uchar_nv(volatile uchar_t *);
|
||||
extern uint16_t atomic_inc_16_nv(volatile uint16_t *);
|
||||
extern ushort_t atomic_inc_ushort_nv(volatile ushort_t *);
|
||||
extern uint32_t atomic_inc_32_nv(volatile uint32_t *);
|
||||
extern uint_t atomic_inc_uint_nv(volatile uint_t *);
|
||||
extern ulong_t atomic_inc_ulong_nv(volatile ulong_t *);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_inc_64_nv(volatile uint64_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decrement target and return new value.
|
||||
*/
|
||||
extern uint8_t atomic_dec_8_nv(volatile uint8_t *);
|
||||
extern uchar_t atomic_dec_uchar_nv(volatile uchar_t *);
|
||||
extern uint16_t atomic_dec_16_nv(volatile uint16_t *);
|
||||
extern ushort_t atomic_dec_ushort_nv(volatile ushort_t *);
|
||||
extern uint32_t atomic_dec_32_nv(volatile uint32_t *);
|
||||
extern uint_t atomic_dec_uint_nv(volatile uint_t *);
|
||||
extern ulong_t atomic_dec_ulong_nv(volatile ulong_t *);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_dec_64_nv(volatile uint64_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add delta to target
|
||||
*/
|
||||
extern uint8_t atomic_add_8_nv(volatile uint8_t *, int8_t);
|
||||
extern uchar_t atomic_add_char_nv(volatile uchar_t *, signed char);
|
||||
extern uint16_t atomic_add_16_nv(volatile uint16_t *, int16_t);
|
||||
extern ushort_t atomic_add_short_nv(volatile ushort_t *, short);
|
||||
extern uint32_t atomic_add_32_nv(volatile uint32_t *, int32_t);
|
||||
extern uint_t atomic_add_int_nv(volatile uint_t *, int);
|
||||
extern void *atomic_add_ptr_nv(volatile void *, ssize_t);
|
||||
extern ulong_t atomic_add_long_nv(volatile ulong_t *, long);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_add_64_nv(volatile uint64_t *, int64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* logical OR bits with target and return new value.
|
||||
*/
|
||||
extern uint8_t atomic_or_8_nv(volatile uint8_t *, uint8_t);
|
||||
extern uchar_t atomic_or_uchar_nv(volatile uchar_t *, uchar_t);
|
||||
extern uint16_t atomic_or_16_nv(volatile uint16_t *, uint16_t);
|
||||
extern ushort_t atomic_or_ushort_nv(volatile ushort_t *, ushort_t);
|
||||
extern uint32_t atomic_or_32_nv(volatile uint32_t *, uint32_t);
|
||||
extern uint_t atomic_or_uint_nv(volatile uint_t *, uint_t);
|
||||
extern ulong_t atomic_or_ulong_nv(volatile ulong_t *, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_or_64_nv(volatile uint64_t *, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* logical AND bits with target and return new value.
|
||||
*/
|
||||
extern uint8_t atomic_and_8_nv(volatile uint8_t *, uint8_t);
|
||||
extern uchar_t atomic_and_uchar_nv(volatile uchar_t *, uchar_t);
|
||||
extern uint16_t atomic_and_16_nv(volatile uint16_t *, uint16_t);
|
||||
extern ushort_t atomic_and_ushort_nv(volatile ushort_t *, ushort_t);
|
||||
extern uint32_t atomic_and_32_nv(volatile uint32_t *, uint32_t);
|
||||
extern uint_t atomic_and_uint_nv(volatile uint_t *, uint_t);
|
||||
extern ulong_t atomic_and_ulong_nv(volatile ulong_t *, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_and_64_nv(volatile uint64_t *, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If *arg1 == arg2, set *arg1 = arg3; return old value
|
||||
*/
|
||||
extern uint8_t atomic_cas_8(volatile uint8_t *, uint8_t, uint8_t);
|
||||
extern uchar_t atomic_cas_uchar(volatile uchar_t *, uchar_t, uchar_t);
|
||||
extern uint16_t atomic_cas_16(volatile uint16_t *, uint16_t, uint16_t);
|
||||
extern ushort_t atomic_cas_ushort(volatile ushort_t *, ushort_t, ushort_t);
|
||||
extern uint32_t atomic_cas_32(volatile uint32_t *, uint32_t, uint32_t);
|
||||
extern uint_t atomic_cas_uint(volatile uint_t *, uint_t, uint_t);
|
||||
extern void *atomic_cas_ptr(volatile void *, void *, void *);
|
||||
extern ulong_t atomic_cas_ulong(volatile ulong_t *, ulong_t, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Swap target and return old value
|
||||
*/
|
||||
extern uint8_t atomic_swap_8(volatile uint8_t *, uint8_t);
|
||||
extern uchar_t atomic_swap_uchar(volatile uchar_t *, uchar_t);
|
||||
extern uint16_t atomic_swap_16(volatile uint16_t *, uint16_t);
|
||||
extern ushort_t atomic_swap_ushort(volatile ushort_t *, ushort_t);
|
||||
extern uint32_t atomic_swap_32(volatile uint32_t *, uint32_t);
|
||||
extern uint_t atomic_swap_uint(volatile uint_t *, uint_t);
|
||||
extern void *atomic_swap_ptr(volatile void *, void *);
|
||||
extern ulong_t atomic_swap_ulong(volatile ulong_t *, ulong_t);
|
||||
#if defined(_KERNEL) || defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform an exclusive atomic bit set/clear on a target.
|
||||
* Returns 0 if bit was sucessfully set/cleared, or -1
|
||||
* if the bit was already set/cleared.
|
||||
*/
|
||||
extern int atomic_set_long_excl(volatile ulong_t *, uint_t);
|
||||
extern int atomic_clear_long_excl(volatile ulong_t *, uint_t);
|
||||
|
||||
/*
|
||||
* Generic memory barrier used during lock entry, placed after the
|
||||
* memory operation that acquires the lock to guarantee that the lock
|
||||
* protects its data. No stores from after the memory barrier will
|
||||
* reach visibility, and no loads from after the barrier will be
|
||||
* resolved, before the lock acquisition reaches global visibility.
|
||||
*/
|
||||
extern void membar_enter(void);
|
||||
|
||||
/*
|
||||
* Generic memory barrier used during lock exit, placed before the
|
||||
* memory operation that releases the lock to guarantee that the lock
|
||||
* protects its data. All loads and stores issued before the barrier
|
||||
* will be resolved before the subsequent lock update reaches visibility.
|
||||
*/
|
||||
extern void membar_exit(void);
|
||||
|
||||
/*
|
||||
* Arrange that all stores issued before this point in the code reach
|
||||
* global visibility before any stores that follow; useful in producer
|
||||
* modules that update a data item, then set a flag that it is available.
|
||||
* The memory barrier guarantees that the available flag is not visible
|
||||
* earlier than the updated data, i.e. it imposes store ordering.
|
||||
*/
|
||||
extern void membar_producer(void);
|
||||
|
||||
/*
|
||||
* Arrange that all loads issued before this point in the code are
|
||||
* completed before any subsequent loads; useful in consumer modules
|
||||
* that check to see if data is available and read the data.
|
||||
* The memory barrier guarantees that the data is not sampled until
|
||||
* after the available flag has been seen, i.e. it imposes load ordering.
|
||||
*/
|
||||
extern void membar_consumer(void);
|
||||
#endif
|
||||
|
||||
#if !defined(_KERNEL) && !defined(__STDC__)
|
||||
extern void atomic_inc_8();
|
||||
extern void atomic_inc_uchar();
|
||||
extern void atomic_inc_16();
|
||||
extern void atomic_inc_ushort();
|
||||
extern void atomic_inc_32();
|
||||
extern void atomic_inc_uint();
|
||||
extern void atomic_inc_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern void atomic_inc_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern void atomic_dec_8();
|
||||
extern void atomic_dec_uchar();
|
||||
extern void atomic_dec_16();
|
||||
extern void atomic_dec_ushort();
|
||||
extern void atomic_dec_32();
|
||||
extern void atomic_dec_uint();
|
||||
extern void atomic_dec_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern void atomic_dec_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern void atomic_add_8();
|
||||
extern void atomic_add_char();
|
||||
extern void atomic_add_16();
|
||||
extern void atomic_add_short();
|
||||
extern void atomic_add_32();
|
||||
extern void atomic_add_int();
|
||||
extern void atomic_add_ptr();
|
||||
extern void atomic_add_long();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern void atomic_add_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern void atomic_or_8();
|
||||
extern void atomic_or_uchar();
|
||||
extern void atomic_or_16();
|
||||
extern void atomic_or_ushort();
|
||||
extern void atomic_or_32();
|
||||
extern void atomic_or_uint();
|
||||
extern void atomic_or_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern void atomic_or_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern void atomic_and_8();
|
||||
extern void atomic_and_uchar();
|
||||
extern void atomic_and_16();
|
||||
extern void atomic_and_ushort();
|
||||
extern void atomic_and_32();
|
||||
extern void atomic_and_uint();
|
||||
extern void atomic_and_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern void atomic_and_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_inc_8_nv();
|
||||
extern uchar_t atomic_inc_uchar_nv();
|
||||
extern uint16_t atomic_inc_16_nv();
|
||||
extern ushort_t atomic_inc_ushort_nv();
|
||||
extern uint32_t atomic_inc_32_nv();
|
||||
extern uint_t atomic_inc_uint_nv();
|
||||
extern ulong_t atomic_inc_ulong_nv();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_inc_64_nv();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_dec_8_nv();
|
||||
extern uchar_t atomic_dec_uchar_nv();
|
||||
extern uint16_t atomic_dec_16_nv();
|
||||
extern ushort_t atomic_dec_ushort_nv();
|
||||
extern uint32_t atomic_dec_32_nv();
|
||||
extern uint_t atomic_dec_uint_nv();
|
||||
extern ulong_t atomic_dec_ulong_nv();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_dec_64_nv();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_add_8_nv();
|
||||
extern uchar_t atomic_add_char_nv();
|
||||
extern uint16_t atomic_add_16_nv();
|
||||
extern ushort_t atomic_add_short_nv();
|
||||
extern uint32_t atomic_add_32_nv();
|
||||
extern uint_t atomic_add_int_nv();
|
||||
extern void *atomic_add_ptr_nv();
|
||||
extern ulong_t atomic_add_long_nv();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_add_64_nv();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_or_8_nv();
|
||||
extern uchar_t atomic_or_uchar_nv();
|
||||
extern uint16_t atomic_or_16_nv();
|
||||
extern ushort_t atomic_or_ushort_nv();
|
||||
extern uint32_t atomic_or_32_nv();
|
||||
extern uint_t atomic_or_uint_nv();
|
||||
extern ulong_t atomic_or_ulong_nv();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_or_64_nv();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_and_8_nv();
|
||||
extern uchar_t atomic_and_uchar_nv();
|
||||
extern uint16_t atomic_and_16_nv();
|
||||
extern ushort_t atomic_and_ushort_nv();
|
||||
extern uint32_t atomic_and_32_nv();
|
||||
extern uint_t atomic_and_uint_nv();
|
||||
extern ulong_t atomic_and_ulong_nv();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_and_64_nv();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_cas_8();
|
||||
extern uchar_t atomic_cas_uchar();
|
||||
extern uint16_t atomic_cas_16();
|
||||
extern ushort_t atomic_cas_ushort();
|
||||
extern uint32_t atomic_cas_32();
|
||||
extern uint_t atomic_cas_uint();
|
||||
extern void *atomic_cas_ptr();
|
||||
extern ulong_t atomic_cas_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_cas_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
extern uint8_t atomic_swap_8();
|
||||
extern uchar_t atomic_swap_uchar();
|
||||
extern uint16_t atomic_swap_16();
|
||||
extern ushort_t atomic_swap_ushort();
|
||||
extern uint32_t atomic_swap_32();
|
||||
extern uint_t atomic_swap_uint();
|
||||
extern void *atomic_swap_ptr();
|
||||
extern ulong_t atomic_swap_ulong();
|
||||
#if defined(_INT64_TYPE)
|
||||
extern uint64_t atomic_swap_64();
|
||||
#endif /* defined(_INT64_TYPE) */
|
||||
|
||||
|
||||
extern int atomic_set_long_excl();
|
||||
extern int atomic_clear_long_excl();
|
||||
|
||||
extern void membar_enter();
|
||||
extern void membar_exit();
|
||||
extern void membar_producer();
|
||||
extern void membar_consumer();
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
#if defined(_LP64) || defined(_ILP32)
|
||||
#define atomic_add_ip atomic_add_long
|
||||
#define atomic_add_ip_nv atomic_add_long_nv
|
||||
#define casip atomic_cas_ulong
|
||||
#endif
|
||||
|
||||
#if defined(__sparc)
|
||||
extern uint8_t ldstub(uint8_t *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Legacy kernel interfaces; they will go away (eventually).
|
||||
*/
|
||||
extern uint8_t cas8(uint8_t *, uint8_t, uint8_t);
|
||||
extern uint32_t cas32(uint32_t *, uint32_t, uint32_t);
|
||||
extern uint64_t cas64(uint64_t *, uint64_t, uint64_t);
|
||||
extern ulong_t caslong(ulong_t *, ulong_t, ulong_t);
|
||||
extern void *casptr(void *, void *, void *);
|
||||
extern void atomic_and_long(ulong_t *, ulong_t);
|
||||
extern void atomic_or_long(ulong_t *, ulong_t);
|
||||
#if defined(__sparc)
|
||||
extern uint32_t swapl(uint32_t *, uint32_t);
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ATOMIC_H */
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _DEVID_H
|
||||
#define _DEVID_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef int ddi_devid_t;
|
||||
|
||||
typedef struct devid_nmlist {
|
||||
char *devname;
|
||||
dev_t dev;
|
||||
} devid_nmlist_t;
|
||||
|
||||
static inline int devid_str_decode(char *devidstr, ddi_devid_t *retdevid, char **retminor_name) { abort(); }
|
||||
static inline int devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid, char *minor_name, devid_nmlist_t **retlist) { abort(); }
|
||||
static inline void devid_str_free(char *str) { abort(); }
|
||||
static inline void devid_free(ddi_devid_t devid) { abort(); }
|
||||
static inline void devid_free_nmlist(devid_nmlist_t *list) { abort(); }
|
||||
static inline int devid_get(int fd, ddi_devid_t *retdevid) { return -1; }
|
||||
static inline int devid_get_minor_name(int fd, char **retminor_name) { abort(); }
|
||||
static inline char *devid_str_encode(ddi_devid_t devid, char *minor_name) { abort(); }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_DIRENT_H
|
||||
#define _SOL_DIRENT_H
|
||||
|
||||
#include_next <dirent.h>
|
||||
|
||||
#ifdef IFTODT
|
||||
#undef IFTODT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
subdir-m += sys
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTFILES = asm_linkage.h
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#ifndef __i386
|
||||
#define __i386
|
||||
#endif
|
||||
|
||||
#include <ia32/sys/asm_linkage.h>
|
||||
@@ -0,0 +1 @@
|
||||
subdir-m += sys
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTFILES = asm_linkage.h
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _IA32_SYS_ASM_LINKAGE_H
|
||||
#define _IA32_SYS_ASM_LINKAGE_H
|
||||
|
||||
|
||||
|
||||
#include <sys/stack.h>
|
||||
#include <sys/trap.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _ASM /* The remainder of this file is only for assembly files */
|
||||
|
||||
/*
|
||||
* make annoying differences in assembler syntax go away
|
||||
*/
|
||||
|
||||
/*
|
||||
* D16 and A16 are used to insert instructions prefixes; the
|
||||
* macros help the assembler code be slightly more portable.
|
||||
*/
|
||||
#if !defined(__GNUC_AS__)
|
||||
/*
|
||||
* /usr/ccs/bin/as prefixes are parsed as separate instructions
|
||||
*/
|
||||
#define D16 data16;
|
||||
#define A16 addr16;
|
||||
|
||||
/*
|
||||
* (There are some weird constructs in constant expressions)
|
||||
*/
|
||||
#define _CONST(const) [const]
|
||||
#define _BITNOT(const) -1!_CONST(const)
|
||||
#define _MUL(a, b) _CONST(a \* b)
|
||||
|
||||
#else
|
||||
/*
|
||||
* Why not use the 'data16' and 'addr16' prefixes .. well, the
|
||||
* assembler doesn't quite believe in real mode, and thus argues with
|
||||
* us about what we're trying to do.
|
||||
*/
|
||||
#define D16 .byte 0x66;
|
||||
#define A16 .byte 0x67;
|
||||
|
||||
#define _CONST(const) (const)
|
||||
#define _BITNOT(const) ~_CONST(const)
|
||||
#define _MUL(a, b) _CONST(a * b)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* C pointers are different sizes between i386 and amd64.
|
||||
* These constants can be used to compute offsets into pointer arrays.
|
||||
*/
|
||||
#if defined(__amd64)
|
||||
#define CLONGSHIFT 3
|
||||
#define CLONGSIZE 8
|
||||
#define CLONGMASK 7
|
||||
#elif defined(__i386)
|
||||
#define CLONGSHIFT 2
|
||||
#define CLONGSIZE 4
|
||||
#define CLONGMASK 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Since we know we're either ILP32 or LP64 ..
|
||||
*/
|
||||
#define CPTRSHIFT CLONGSHIFT
|
||||
#define CPTRSIZE CLONGSIZE
|
||||
#define CPTRMASK CLONGMASK
|
||||
|
||||
#if CPTRSIZE != (1 << CPTRSHIFT) || CLONGSIZE != (1 << CLONGSHIFT)
|
||||
#error "inconsistent shift constants"
|
||||
#endif
|
||||
|
||||
#if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1)
|
||||
#error "inconsistent mask constants"
|
||||
#endif
|
||||
|
||||
#define ASM_ENTRY_ALIGN 16
|
||||
|
||||
/*
|
||||
* SSE register alignment and save areas
|
||||
*/
|
||||
|
||||
#define XMM_SIZE 16
|
||||
#define XMM_ALIGN 16
|
||||
|
||||
#if defined(__amd64)
|
||||
|
||||
#define SAVE_XMM_PROLOG(sreg, nreg) \
|
||||
subq $_CONST(_MUL(XMM_SIZE, nreg)), %rsp; \
|
||||
movq %rsp, sreg
|
||||
|
||||
#define RSTOR_XMM_EPILOG(sreg, nreg) \
|
||||
addq $_CONST(_MUL(XMM_SIZE, nreg)), %rsp
|
||||
|
||||
#elif defined(__i386)
|
||||
|
||||
#define SAVE_XMM_PROLOG(sreg, nreg) \
|
||||
subl $_CONST(_MUL(XMM_SIZE, nreg) + XMM_ALIGN), %esp; \
|
||||
movl %esp, sreg; \
|
||||
addl $XMM_ALIGN, sreg; \
|
||||
andl $_BITNOT(XMM_ALIGN-1), sreg
|
||||
|
||||
#define RSTOR_XMM_EPILOG(sreg, nreg) \
|
||||
addl $_CONST(_MUL(XMM_SIZE, nreg) + XMM_ALIGN), %esp;
|
||||
|
||||
#endif /* __i386 */
|
||||
|
||||
/*
|
||||
* profiling causes definitions of the MCOUNT and RTMCOUNT
|
||||
* particular to the type
|
||||
*/
|
||||
#ifdef GPROF
|
||||
|
||||
#define MCOUNT(x) \
|
||||
pushl %ebp; \
|
||||
movl %esp, %ebp; \
|
||||
call _mcount; \
|
||||
popl %ebp
|
||||
|
||||
#endif /* GPROF */
|
||||
|
||||
#ifdef PROF
|
||||
|
||||
#define MCOUNT(x) \
|
||||
/* CSTYLED */ \
|
||||
.lcomm .L_/**/x/**/1, 4, 4; \
|
||||
pushl %ebp; \
|
||||
movl %esp, %ebp; \
|
||||
/* CSTYLED */ \
|
||||
movl $.L_/**/x/**/1, %edx; \
|
||||
call _mcount; \
|
||||
popl %ebp
|
||||
|
||||
#endif /* PROF */
|
||||
|
||||
/*
|
||||
* if we are not profiling, MCOUNT should be defined to nothing
|
||||
*/
|
||||
#if !defined(PROF) && !defined(GPROF)
|
||||
#define MCOUNT(x)
|
||||
#endif /* !defined(PROF) && !defined(GPROF) */
|
||||
|
||||
#define RTMCOUNT(x) MCOUNT(x)
|
||||
|
||||
/*
|
||||
* Macro to define weak symbol aliases. These are similar to the ANSI-C
|
||||
* #pragma weak name = _name
|
||||
* except a compiler can determine type. The assembler must be told. Hence,
|
||||
* the second parameter must be the type of the symbol (i.e.: function,...)
|
||||
*/
|
||||
#define ANSI_PRAGMA_WEAK(sym, stype) \
|
||||
.weak sym; \
|
||||
.type sym, @stype; \
|
||||
/* CSTYLED */ \
|
||||
sym = _/**/sym
|
||||
|
||||
/*
|
||||
* Like ANSI_PRAGMA_WEAK(), but for unrelated names, as in:
|
||||
* #pragma weak sym1 = sym2
|
||||
*/
|
||||
#define ANSI_PRAGMA_WEAK2(sym1, sym2, stype) \
|
||||
.weak sym1; \
|
||||
.type sym1, @stype; \
|
||||
sym1 = sym2
|
||||
|
||||
/*
|
||||
* ENTRY provides the standard procedure entry code and an easy way to
|
||||
* insert the calls to mcount for profiling. ENTRY_NP is identical, but
|
||||
* never calls mcount.
|
||||
*/
|
||||
#define ENTRY(x) \
|
||||
.text; \
|
||||
.align ASM_ENTRY_ALIGN; \
|
||||
.globl x; \
|
||||
.type x, @function; \
|
||||
x: MCOUNT(x)
|
||||
|
||||
#define ENTRY_NP(x) \
|
||||
.text; \
|
||||
.align ASM_ENTRY_ALIGN; \
|
||||
.globl x; \
|
||||
.type x, @function; \
|
||||
x:
|
||||
|
||||
#define RTENTRY(x) \
|
||||
.text; \
|
||||
.align ASM_ENTRY_ALIGN; \
|
||||
.globl x; \
|
||||
.type x, @function; \
|
||||
x: RTMCOUNT(x)
|
||||
|
||||
/*
|
||||
* ENTRY2 is identical to ENTRY but provides two labels for the entry point.
|
||||
*/
|
||||
#define ENTRY2(x, y) \
|
||||
.text; \
|
||||
.align ASM_ENTRY_ALIGN; \
|
||||
.globl x, y; \
|
||||
.type x, @function; \
|
||||
.type y, @function; \
|
||||
/* CSTYLED */ \
|
||||
x: ; \
|
||||
y: MCOUNT(x)
|
||||
|
||||
#define ENTRY_NP2(x, y) \
|
||||
.text; \
|
||||
.align ASM_ENTRY_ALIGN; \
|
||||
.globl x, y; \
|
||||
.type x, @function; \
|
||||
.type y, @function; \
|
||||
/* CSTYLED */ \
|
||||
x: ; \
|
||||
y:
|
||||
|
||||
|
||||
/*
|
||||
* ALTENTRY provides for additional entry points.
|
||||
*/
|
||||
#define ALTENTRY(x) \
|
||||
.globl x; \
|
||||
.type x, @function; \
|
||||
x:
|
||||
|
||||
/*
|
||||
* DGDEF and DGDEF2 provide global data declarations.
|
||||
*
|
||||
* DGDEF provides a word aligned word of storage.
|
||||
*
|
||||
* DGDEF2 allocates "sz" bytes of storage with **NO** alignment. This
|
||||
* implies this macro is best used for byte arrays.
|
||||
*
|
||||
* DGDEF3 allocates "sz" bytes of storage with "algn" alignment.
|
||||
*/
|
||||
#define DGDEF2(name, sz) \
|
||||
.data; \
|
||||
.globl name; \
|
||||
.type name, @object; \
|
||||
.size name, sz; \
|
||||
name:
|
||||
|
||||
#define DGDEF3(name, sz, algn) \
|
||||
.data; \
|
||||
.align algn; \
|
||||
.globl name; \
|
||||
.type name, @object; \
|
||||
.size name, sz; \
|
||||
name:
|
||||
|
||||
#define DGDEF(name) DGDEF3(name, 4, 4)
|
||||
|
||||
/*
|
||||
* SET_SIZE trails a function and set the size for the ELF symbol table.
|
||||
*/
|
||||
#define SET_SIZE(x) \
|
||||
.size x, [.-x]
|
||||
|
||||
/*
|
||||
* NWORD provides native word value.
|
||||
*/
|
||||
#if defined(__amd64)
|
||||
|
||||
/*CSTYLED*/
|
||||
#define NWORD quad
|
||||
|
||||
#elif defined(__i386)
|
||||
|
||||
#define NWORD long
|
||||
|
||||
#endif /* __i386 */
|
||||
|
||||
#endif /* _ASM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IA32_SYS_ASM_LINKAGE_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_LIBGEN_H
|
||||
#define _SOL_LIBGEN_H
|
||||
|
||||
#include_next <libgen.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern int mkdirp(const char *path, mode_t mode);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _PRIV_H
|
||||
#define _PRIV_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Couldn't find this definition in OpenGrok */
|
||||
#define PRIV_SYS_CONFIG "sys_config"
|
||||
|
||||
static inline boolean_t priv_ineffect(const char *priv) { return B_TRUE; }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTFILES = xdr.h
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/*
|
||||
* Portions of this source code were derived from Berkeley 4.3 BSD
|
||||
* under license from the Regents of the University of California.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_RPC_XDR_H_
|
||||
#define _SOL_RPC_XDR_H_
|
||||
|
||||
#include_next <rpc/xdr.h>
|
||||
|
||||
/*
|
||||
* Strangely, my glibc version (2.3.6) doesn't have xdr_control(), so
|
||||
* we have to hack it in here (source taken from OpenSolaris).
|
||||
* By the way, it is assumed the xdrmem implementation is used.
|
||||
*/
|
||||
|
||||
#define xdr_control(a,b,c) xdrmem_control(a,b,c)
|
||||
|
||||
/*
|
||||
* These are XDR control operators
|
||||
*/
|
||||
|
||||
#define XDR_GET_BYTES_AVAIL 1
|
||||
|
||||
struct xdr_bytesrec {
|
||||
bool_t xc_is_last_record;
|
||||
size_t xc_num_avail;
|
||||
};
|
||||
|
||||
typedef struct xdr_bytesrec xdr_bytesrec;
|
||||
|
||||
/*
|
||||
* These are the request arguments to XDR_CONTROL.
|
||||
*
|
||||
* XDR_PEEK - returns the contents of the next XDR unit on the XDR stream.
|
||||
* XDR_SKIPBYTES - skips the next N bytes in the XDR stream.
|
||||
* XDR_RDMAGET - for xdr implementation over RDMA, gets private flags from
|
||||
* the XDR stream being moved over RDMA
|
||||
* XDR_RDMANOCHUNK - for xdr implementaion over RDMA, sets private flags in
|
||||
* the XDR stream moving over RDMA.
|
||||
*/
|
||||
#define XDR_PEEK 2
|
||||
#define XDR_SKIPBYTES 3
|
||||
#define XDR_RDMAGET 4
|
||||
#define XDR_RDMASET 5
|
||||
|
||||
/* FIXME: probably doesn't work */
|
||||
static bool_t
|
||||
xdrmem_control(XDR *xdrs, int request, void *info)
|
||||
{
|
||||
xdr_bytesrec *xptr;
|
||||
int32_t *int32p;
|
||||
int len;
|
||||
|
||||
switch (request) {
|
||||
|
||||
case XDR_GET_BYTES_AVAIL:
|
||||
xptr = (xdr_bytesrec *)info;
|
||||
xptr->xc_is_last_record = TRUE;
|
||||
xptr->xc_num_avail = xdrs->x_handy;
|
||||
return (TRUE);
|
||||
|
||||
case XDR_PEEK:
|
||||
/*
|
||||
* Return the next 4 byte unit in the XDR stream.
|
||||
*/
|
||||
if (xdrs->x_handy < sizeof (int32_t))
|
||||
return (FALSE);
|
||||
int32p = (int32_t *)info;
|
||||
*int32p = (int32_t)ntohl((uint32_t)
|
||||
(*((int32_t *)(xdrs->x_private))));
|
||||
return (TRUE);
|
||||
|
||||
case XDR_SKIPBYTES:
|
||||
/*
|
||||
* Skip the next N bytes in the XDR stream.
|
||||
*/
|
||||
int32p = (int32_t *)info;
|
||||
len = RNDUP((int)(*int32p));
|
||||
if ((xdrs->x_handy -= len) < 0)
|
||||
return (FALSE);
|
||||
xdrs->x_private += len;
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
subdir-m += sys
|
||||
@@ -0,0 +1,2 @@
|
||||
DISTFILES = asm_linkage.h
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ASM_LINKAGE_H
|
||||
#define _SYS_ASM_LINKAGE_H
|
||||
|
||||
|
||||
|
||||
#include <sys/stack.h>
|
||||
#include <sys/trap.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _ASM /* The remainder of this file is only for assembly files */
|
||||
|
||||
/*
|
||||
* C pointers are different sizes between V8 and V9.
|
||||
* These constants can be used to compute offsets into pointer arrays.
|
||||
*/
|
||||
#ifdef __sparcv9
|
||||
#define CPTRSHIFT 3
|
||||
#define CLONGSHIFT 3
|
||||
#else
|
||||
#define CPTRSHIFT 2
|
||||
#define CLONGSHIFT 2
|
||||
#endif
|
||||
#define CPTRSIZE (1<<CPTRSHIFT)
|
||||
#define CLONGSIZE (1<<CLONGSHIFT)
|
||||
#define CPTRMASK (CPTRSIZE - 1)
|
||||
#define CLONGMASK (CLONGSIZE - 1)
|
||||
|
||||
/*
|
||||
* Symbolic section definitions.
|
||||
*/
|
||||
#define RODATA ".rodata"
|
||||
|
||||
/*
|
||||
* profiling causes defintions of the MCOUNT and RTMCOUNT
|
||||
* particular to the type
|
||||
*/
|
||||
#ifdef GPROF
|
||||
|
||||
#define MCOUNT_SIZE (4*4) /* 4 instructions */
|
||||
#define MCOUNT(x) \
|
||||
save %sp, -SA(MINFRAME), %sp; \
|
||||
call _mcount; \
|
||||
nop; \
|
||||
restore;
|
||||
|
||||
#endif /* GPROF */
|
||||
|
||||
#ifdef PROF
|
||||
|
||||
#if defined(__sparcv9)
|
||||
|
||||
#define MCOUNT_SIZE (9*4) /* 9 instructions */
|
||||
#define MCOUNT(x) \
|
||||
save %sp, -SA(MINFRAME), %sp; \
|
||||
/* CSTYLED */ \
|
||||
sethi %hh(.L_/**/x/**/1), %o0; \
|
||||
/* CSTYLED */ \
|
||||
sethi %lm(.L_/**/x/**/1), %o1; \
|
||||
/* CSTYLED */ \
|
||||
or %o0, %hm(.L_/**/x/**/1), %o0; \
|
||||
/* CSTYLED */ \
|
||||
or %o1, %lo(.L_/**/x/**/1), %o1; \
|
||||
sllx %o0, 32, %o0; \
|
||||
call _mcount; \
|
||||
or %o0, %o1, %o0; \
|
||||
restore; \
|
||||
/* CSTYLED */ \
|
||||
.common .L_/**/x/**/1, 8, 8
|
||||
|
||||
#else /* __sparcv9 */
|
||||
|
||||
#define MCOUNT_SIZE (5*4) /* 5 instructions */
|
||||
#define MCOUNT(x) \
|
||||
save %sp, -SA(MINFRAME), %sp; \
|
||||
/* CSTYLED */ \
|
||||
sethi %hi(.L_/**/x/**/1), %o0; \
|
||||
call _mcount; \
|
||||
/* CSTYLED */ \
|
||||
or %o0, %lo(.L_/**/x/**/1), %o0; \
|
||||
restore; \
|
||||
/* CSTYLED */ \
|
||||
.common .L_/**/x/**/1, 4, 4
|
||||
|
||||
#endif /* __sparcv9 */
|
||||
|
||||
#endif /* PROF */
|
||||
|
||||
/*
|
||||
* if we are not profiling, MCOUNT should be defined to nothing
|
||||
*/
|
||||
#if !defined(PROF) && !defined(GPROF)
|
||||
#define MCOUNT_SIZE 0 /* no instructions inserted */
|
||||
#define MCOUNT(x)
|
||||
#endif /* !defined(PROF) && !defined(GPROF) */
|
||||
|
||||
#define RTMCOUNT(x) MCOUNT(x)
|
||||
|
||||
/*
|
||||
* Macro to define weak symbol aliases. These are similar to the ANSI-C
|
||||
* #pragma weak name = _name
|
||||
* except a compiler can determine type. The assembler must be told. Hence,
|
||||
* the second parameter must be the type of the symbol (i.e.: function,...)
|
||||
*/
|
||||
#define ANSI_PRAGMA_WEAK(sym, stype) \
|
||||
.weak sym; \
|
||||
.type sym, #stype; \
|
||||
/* CSTYLED */ \
|
||||
sym = _/**/sym
|
||||
|
||||
/*
|
||||
* Like ANSI_PRAGMA_WEAK(), but for unrelated names, as in:
|
||||
* #pragma weak sym1 = sym2
|
||||
*/
|
||||
#define ANSI_PRAGMA_WEAK2(sym1, sym2, stype) \
|
||||
.weak sym1; \
|
||||
.type sym1, #stype; \
|
||||
sym1 = sym2
|
||||
|
||||
/*
|
||||
* ENTRY provides the standard procedure entry code and an easy way to
|
||||
* insert the calls to mcount for profiling. ENTRY_NP is identical, but
|
||||
* never calls mcount.
|
||||
*/
|
||||
#define ENTRY(x) \
|
||||
.section ".text"; \
|
||||
.align 4; \
|
||||
.global x; \
|
||||
.type x, #function; \
|
||||
x: MCOUNT(x)
|
||||
|
||||
#define ENTRY_SIZE MCOUNT_SIZE
|
||||
|
||||
#define ENTRY_NP(x) \
|
||||
.section ".text"; \
|
||||
.align 4; \
|
||||
.global x; \
|
||||
.type x, #function; \
|
||||
x:
|
||||
|
||||
#define RTENTRY(x) \
|
||||
.section ".text"; \
|
||||
.align 4; \
|
||||
.global x; \
|
||||
.type x, #function; \
|
||||
x: RTMCOUNT(x)
|
||||
|
||||
/*
|
||||
* ENTRY2 is identical to ENTRY but provides two labels for the entry point.
|
||||
*/
|
||||
#define ENTRY2(x, y) \
|
||||
.section ".text"; \
|
||||
.align 4; \
|
||||
.global x, y; \
|
||||
.type x, #function; \
|
||||
.type y, #function; \
|
||||
/* CSTYLED */ \
|
||||
x: ; \
|
||||
y: MCOUNT(x)
|
||||
|
||||
#define ENTRY_NP2(x, y) \
|
||||
.section ".text"; \
|
||||
.align 4; \
|
||||
.global x, y; \
|
||||
.type x, #function; \
|
||||
.type y, #function; \
|
||||
/* CSTYLED */ \
|
||||
x: ; \
|
||||
y:
|
||||
|
||||
|
||||
/*
|
||||
* ALTENTRY provides for additional entry points.
|
||||
*/
|
||||
#define ALTENTRY(x) \
|
||||
.global x; \
|
||||
.type x, #function; \
|
||||
x:
|
||||
|
||||
/*
|
||||
* DGDEF and DGDEF2 provide global data declarations.
|
||||
*
|
||||
* DGDEF provides a word aligned word of storage.
|
||||
*
|
||||
* DGDEF2 allocates "sz" bytes of storage with **NO** alignment. This
|
||||
* implies this macro is best used for byte arrays.
|
||||
*
|
||||
* DGDEF3 allocates "sz" bytes of storage with "algn" alignment.
|
||||
*/
|
||||
#define DGDEF2(name, sz) \
|
||||
.section ".data"; \
|
||||
.global name; \
|
||||
.type name, #object; \
|
||||
.size name, sz; \
|
||||
name:
|
||||
|
||||
#define DGDEF3(name, sz, algn) \
|
||||
.section ".data"; \
|
||||
.align algn; \
|
||||
.global name; \
|
||||
.type name, #object; \
|
||||
.size name, sz; \
|
||||
name:
|
||||
|
||||
#define DGDEF(name) DGDEF3(name, 4, 4)
|
||||
|
||||
/*
|
||||
* SET_SIZE trails a function and set the size for the ELF symbol table.
|
||||
*/
|
||||
#define SET_SIZE(x) \
|
||||
.size x, (.-x)
|
||||
|
||||
#endif /* _ASM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ASM_LINKAGE_H */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
//#define __need___va_list
|
||||
#include_next <stdarg.h>
|
||||
|
||||
#ifndef _SOL_STDARG_H
|
||||
#define _SOL_STDARG_H
|
||||
|
||||
#ifndef __va_list
|
||||
typedef __gnuc_va_list __va_list;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _STDIO_EXT_H
|
||||
#define _STDIO_EXT_H
|
||||
|
||||
#define enable_extended_FILE_stdio(x,y) (0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_STRINGS_H
|
||||
#define _SOL_STRINGS_H
|
||||
|
||||
#include <string.h>
|
||||
#include_next <strings.h>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
subdir-m += fm sysevent
|
||||
DISTFILES = acl.h acl_impl.h bitmap.h byteorder.h callb.h cmn_err.h cred.h
|
||||
DISTFILES += dkio.h dklabel.h feature_tests.h file.h idmap.h int_limits.h
|
||||
DISTFILES += int_types.h inttypes.h isa_defs.h kmem.h kstat.h mkdev.h mntent.h
|
||||
DISTFILES += mntio.h mnttab.h modctl.h mount.h note.h param.h priv.h
|
||||
DISTFILES += processor.h rctl.h sdt.h stack.h stat.h sunddi.h sysevent.h
|
||||
DISTFILES += sysmacros.h time.h trap.h types.h types32.h uio.h utsname.h
|
||||
DISTFILES += uuid.h va_list.h varargs.h vmem.h vtoc.h zone.h
|
||||
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ACL_H
|
||||
#define _SYS_ACL_H
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/acl_impl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_ACL_ENTRIES (1024) /* max entries of each type */
|
||||
typedef struct acl {
|
||||
int a_type; /* the type of ACL entry */
|
||||
uid_t a_id; /* the entry in -uid or gid */
|
||||
o_mode_t a_perm; /* the permission field */
|
||||
} aclent_t;
|
||||
|
||||
typedef struct ace {
|
||||
uid_t a_who; /* uid or gid */
|
||||
uint32_t a_access_mask; /* read,write,... */
|
||||
uint16_t a_flags; /* see below */
|
||||
uint16_t a_type; /* allow or deny */
|
||||
} ace_t;
|
||||
|
||||
typedef struct acl_info acl_t;
|
||||
|
||||
/*
|
||||
* The following are Defined types for an aclent_t.
|
||||
*/
|
||||
#define USER_OBJ (0x01) /* object owner */
|
||||
#define USER (0x02) /* additional users */
|
||||
#define GROUP_OBJ (0x04) /* owning group of the object */
|
||||
#define GROUP (0x08) /* additional groups */
|
||||
#define CLASS_OBJ (0x10) /* file group class and mask entry */
|
||||
#define OTHER_OBJ (0x20) /* other entry for the object */
|
||||
#define ACL_DEFAULT (0x1000) /* default flag */
|
||||
/* default object owner */
|
||||
#define DEF_USER_OBJ (ACL_DEFAULT | USER_OBJ)
|
||||
/* default additional users */
|
||||
#define DEF_USER (ACL_DEFAULT | USER)
|
||||
/* default owning group */
|
||||
#define DEF_GROUP_OBJ (ACL_DEFAULT | GROUP_OBJ)
|
||||
/* default additional groups */
|
||||
#define DEF_GROUP (ACL_DEFAULT | GROUP)
|
||||
/* default mask entry */
|
||||
#define DEF_CLASS_OBJ (ACL_DEFAULT | CLASS_OBJ)
|
||||
/* default other entry */
|
||||
#define DEF_OTHER_OBJ (ACL_DEFAULT | OTHER_OBJ)
|
||||
|
||||
/*
|
||||
* The following are defined for ace_t.
|
||||
*/
|
||||
#define ACE_READ_DATA 0x00000001
|
||||
#define ACE_LIST_DIRECTORY 0x00000001
|
||||
#define ACE_WRITE_DATA 0x00000002
|
||||
#define ACE_ADD_FILE 0x00000002
|
||||
#define ACE_APPEND_DATA 0x00000004
|
||||
#define ACE_ADD_SUBDIRECTORY 0x00000004
|
||||
#define ACE_READ_NAMED_ATTRS 0x00000008
|
||||
#define ACE_WRITE_NAMED_ATTRS 0x00000010
|
||||
#define ACE_EXECUTE 0x00000020
|
||||
#define ACE_DELETE_CHILD 0x00000040
|
||||
#define ACE_READ_ATTRIBUTES 0x00000080
|
||||
#define ACE_WRITE_ATTRIBUTES 0x00000100
|
||||
#define ACE_DELETE 0x00010000
|
||||
#define ACE_READ_ACL 0x00020000
|
||||
#define ACE_WRITE_ACL 0x00040000
|
||||
#define ACE_WRITE_OWNER 0x00080000
|
||||
#define ACE_SYNCHRONIZE 0x00100000
|
||||
|
||||
#define ACE_FILE_INHERIT_ACE 0x0001
|
||||
#define ACE_DIRECTORY_INHERIT_ACE 0x0002
|
||||
#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
|
||||
#define ACE_INHERIT_ONLY_ACE 0x0008
|
||||
#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
|
||||
#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
|
||||
#define ACE_IDENTIFIER_GROUP 0x0040
|
||||
#define ACE_INHERITED_ACE 0x0080
|
||||
#define ACE_OWNER 0x1000
|
||||
#define ACE_GROUP 0x2000
|
||||
#define ACE_EVERYONE 0x4000
|
||||
|
||||
#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000
|
||||
#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001
|
||||
#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002
|
||||
#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003
|
||||
|
||||
#define ACL_AUTO_INHERIT 0x0001
|
||||
#define ACL_PROTECTED 0x0002
|
||||
#define ACL_DEFAULTED 0x0004
|
||||
#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED| \
|
||||
ACL_DEFAULTED)
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
/*
|
||||
* These are only applicable in a CIFS context.
|
||||
*/
|
||||
#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
|
||||
#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
|
||||
#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
|
||||
#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
|
||||
#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
|
||||
#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
|
||||
#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
|
||||
#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
|
||||
#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
|
||||
#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
|
||||
#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
|
||||
#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
|
||||
#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
|
||||
|
||||
#define ACE_ALL_TYPES 0x001F
|
||||
|
||||
typedef struct ace_object {
|
||||
uid_t a_who; /* uid or gid */
|
||||
uint32_t a_access_mask; /* read,write,... */
|
||||
uint16_t a_flags; /* see below */
|
||||
uint16_t a_type; /* allow or deny */
|
||||
uint8_t a_obj_type[16]; /* obj type */
|
||||
uint8_t a_inherit_obj_type[16]; /* inherit obj */
|
||||
} ace_object_t;
|
||||
|
||||
#endif
|
||||
|
||||
#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \
|
||||
ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS| \
|
||||
ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES| \
|
||||
ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \
|
||||
ACE_WRITE_OWNER|ACE_SYNCHRONIZE)
|
||||
|
||||
/*
|
||||
* The following flags are supported by both NFSv4 ACLs and ace_t.
|
||||
*/
|
||||
#define ACE_NFSV4_SUP_FLAGS (ACE_FILE_INHERIT_ACE | \
|
||||
ACE_DIRECTORY_INHERIT_ACE | \
|
||||
ACE_NO_PROPAGATE_INHERIT_ACE | \
|
||||
ACE_INHERIT_ONLY_ACE | \
|
||||
ACE_IDENTIFIER_GROUP)
|
||||
|
||||
#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE| \
|
||||
ACE_IDENTIFIER_GROUP)
|
||||
#define ACE_INHERIT_FLAGS (ACE_FILE_INHERIT_ACE| \
|
||||
ACE_DIRECTORY_INHERIT_ACE|ACE_NO_PROPAGATE_INHERIT_ACE|ACE_INHERIT_ONLY_ACE)
|
||||
|
||||
/* cmd args to acl(2) for aclent_t */
|
||||
#define GETACL 1
|
||||
#define SETACL 2
|
||||
#define GETACLCNT 3
|
||||
|
||||
/* cmd's to manipulate ace acls. */
|
||||
#define ACE_GETACL 4
|
||||
#define ACE_SETACL 5
|
||||
#define ACE_GETACLCNT 6
|
||||
|
||||
/* minimal acl entries from GETACLCNT */
|
||||
#define MIN_ACL_ENTRIES 4
|
||||
|
||||
#if !defined(_KERNEL)
|
||||
|
||||
/* acl check errors */
|
||||
#define GRP_ERROR 1
|
||||
#define USER_ERROR 2
|
||||
#define OTHER_ERROR 3
|
||||
#define CLASS_ERROR 4
|
||||
#define DUPLICATE_ERROR 5
|
||||
#define MISS_ERROR 6
|
||||
#define MEM_ERROR 7
|
||||
#define ENTRY_ERROR 8
|
||||
|
||||
|
||||
/*
|
||||
* similar to ufs_acl.h: changed to char type for user commands (tar, cpio)
|
||||
* Attribute types
|
||||
*/
|
||||
#define UFSD_FREE ('0') /* Free entry */
|
||||
#define UFSD_ACL ('1') /* Access Control Lists */
|
||||
#define UFSD_DFACL ('2') /* reserved for future use */
|
||||
#define ACE_ACL ('3') /* ace_t style acls */
|
||||
|
||||
/*
|
||||
* flag to [f]acl_get()
|
||||
* controls whether a trivial acl should be returned.
|
||||
*/
|
||||
#define ACL_NO_TRIVIAL 0x2
|
||||
|
||||
|
||||
/*
|
||||
* Flags to control acl_totext()
|
||||
*/
|
||||
|
||||
#define ACL_APPEND_ID 0x1 /* append uid/gid to user/group entries */
|
||||
#define ACL_COMPACT_FMT 0x2 /* build ACL in ls -V format */
|
||||
#define ACL_NORESOLVE 0x4 /* don't do name service lookups */
|
||||
|
||||
/*
|
||||
* Legacy aclcheck errors for aclent_t ACLs
|
||||
*/
|
||||
#define EACL_GRP_ERROR GRP_ERROR
|
||||
#define EACL_USER_ERROR USER_ERROR
|
||||
#define EACL_OTHER_ERROR OTHER_ERROR
|
||||
#define EACL_CLASS_ERROR CLASS_ERROR
|
||||
#define EACL_DUPLICATE_ERROR DUPLICATE_ERROR
|
||||
#define EACL_MISS_ERROR MISS_ERROR
|
||||
#define EACL_MEM_ERROR MEM_ERROR
|
||||
#define EACL_ENTRY_ERROR ENTRY_ERROR
|
||||
|
||||
#define EACL_INHERIT_ERROR 9 /* invalid inherit flags */
|
||||
#define EACL_FLAGS_ERROR 10 /* unknown flag value */
|
||||
#define EACL_PERM_MASK_ERROR 11 /* unknown permission */
|
||||
#define EACL_COUNT_ERROR 12 /* invalid acl count */
|
||||
|
||||
#define EACL_INVALID_SLOT 13 /* invalid acl slot */
|
||||
#define EACL_NO_ACL_ENTRY 14 /* Entry doesn't exist */
|
||||
#define EACL_DIFF_TYPE 15 /* acls aren't same type */
|
||||
|
||||
#define EACL_INVALID_USER_GROUP 16 /* need user/group name */
|
||||
#define EACL_INVALID_STR 17 /* invalid acl string */
|
||||
#define EACL_FIELD_NOT_BLANK 18 /* can't have blank field */
|
||||
#define EACL_INVALID_ACCESS_TYPE 19 /* invalid access type */
|
||||
#define EACL_UNKNOWN_DATA 20 /* Unrecognized data in ACL */
|
||||
#define EACL_MISSING_FIELDS 21 /* missing fields in acl */
|
||||
|
||||
#define EACL_INHERIT_NOTDIR 22 /* Need dir for inheritance */
|
||||
|
||||
extern int aclcheck(aclent_t *, int, int *);
|
||||
extern int acltomode(aclent_t *, int, mode_t *);
|
||||
extern int aclfrommode(aclent_t *, int, mode_t *);
|
||||
extern int aclsort(int, int, aclent_t *);
|
||||
extern char *acltotext(aclent_t *, int);
|
||||
extern aclent_t *aclfromtext(char *, int *);
|
||||
extern void acl_free(acl_t *);
|
||||
extern int acl_get(const char *, int, acl_t **);
|
||||
extern int facl_get(int, int, acl_t **);
|
||||
extern int acl_set(const char *, acl_t *acl);
|
||||
extern int facl_set(int, acl_t *acl);
|
||||
extern int acl_strip(const char *, uid_t, gid_t, mode_t);
|
||||
extern int acl_trivial(const char *);
|
||||
extern char *acl_totext(acl_t *, int);
|
||||
extern int acl_fromtext(const char *, acl_t **);
|
||||
extern int acl_check(acl_t *, int);
|
||||
|
||||
#else /* !defined(_KERNEL) */
|
||||
|
||||
extern void ksort(caddr_t, int, int, int (*)(void *, void *));
|
||||
extern int cmp2acls(void *, void *);
|
||||
|
||||
#endif /* !defined(_KERNEL) */
|
||||
|
||||
#if defined(__STDC__)
|
||||
extern int acl(const char *path, int cmd, int cnt, void *buf);
|
||||
extern int facl(int fd, int cmd, int cnt, void *buf);
|
||||
#else /* !__STDC__ */
|
||||
extern int acl();
|
||||
extern int facl();
|
||||
#endif /* defined(__STDC__) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ACL_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ACL_IMPL_H
|
||||
#define _SYS_ACL_IMPL_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* acl flags
|
||||
*
|
||||
* ACL_AUTO_INHERIT, ACL_PROTECTED and ACL_DEFAULTED
|
||||
* flags can also be stored in this field.
|
||||
*/
|
||||
#define ACL_IS_TRIVIAL 0x10000
|
||||
#define ACL_IS_DIR 0x20000
|
||||
|
||||
typedef enum acl_type {
|
||||
ACLENT_T = 0,
|
||||
ACE_T = 1
|
||||
} acl_type_t;
|
||||
|
||||
struct acl_info {
|
||||
acl_type_t acl_type; /* style of acl */
|
||||
int acl_cnt; /* number of acl entries */
|
||||
int acl_entry_size; /* sizeof acl entry */
|
||||
int acl_flags; /* special flags about acl */
|
||||
void *acl_aclp; /* the acl */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ACL_IMPL_H */
|
||||
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/*
|
||||
* University Copyright- Copyright (c) 1982, 1986, 1988
|
||||
* The Regents of the University of California
|
||||
* All Rights Reserved
|
||||
*
|
||||
* University Acknowledgment- Portions of this document are derived from
|
||||
* software developed by the University of California, Berkeley, and its
|
||||
* contributors.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_BYTEORDER_H
|
||||
#define _SYS_BYTEORDER_H
|
||||
|
||||
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/int_types.h>
|
||||
|
||||
#if defined(__GNUC__) && defined(_ASM_INLINES) && \
|
||||
(defined(__i386) || defined(__amd64))
|
||||
#include <asm/byteorder.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* macros for conversion between host and (internet) network byte order
|
||||
*/
|
||||
|
||||
#if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
|
||||
/* big-endian */
|
||||
#define ntohl(x) (x)
|
||||
#define ntohs(x) (x)
|
||||
#define htonl(x) (x)
|
||||
#define htons(x) (x)
|
||||
|
||||
#elif !defined(ntohl) /* little-endian */
|
||||
|
||||
#ifndef _IN_PORT_T
|
||||
#define _IN_PORT_T
|
||||
typedef uint16_t in_port_t;
|
||||
#endif
|
||||
|
||||
#ifndef _IN_ADDR_T
|
||||
#define _IN_ADDR_T
|
||||
typedef uint32_t in_addr_t;
|
||||
#endif
|
||||
|
||||
#if !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5)
|
||||
extern uint32_t htonl(uint32_t);
|
||||
extern uint16_t htons(uint16_t);
|
||||
extern uint32_t ntohl(uint32_t);
|
||||
extern uint16_t ntohs(uint16_t);
|
||||
#else
|
||||
extern in_addr_t htonl(in_addr_t);
|
||||
extern in_port_t htons(in_port_t);
|
||||
extern in_addr_t ntohl(in_addr_t);
|
||||
extern in_port_t ntohs(in_port_t);
|
||||
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5) */
|
||||
#endif
|
||||
|
||||
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
|
||||
|
||||
/*
|
||||
* Macros to reverse byte order
|
||||
*/
|
||||
#define BSWAP_8(x) ((x) & 0xff)
|
||||
#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
|
||||
#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
|
||||
#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
|
||||
|
||||
#define BMASK_8(x) ((x) & 0xff)
|
||||
#define BMASK_16(x) ((x) & 0xffff)
|
||||
#define BMASK_32(x) ((x) & 0xffffffff)
|
||||
#define BMASK_64(x) (x)
|
||||
|
||||
/*
|
||||
* Macros to convert from a specific byte order to/from native byte order
|
||||
*/
|
||||
#ifdef _BIG_ENDIAN
|
||||
#define BE_8(x) BMASK_8(x)
|
||||
#define BE_16(x) BMASK_16(x)
|
||||
#define BE_32(x) BMASK_32(x)
|
||||
#define BE_64(x) BMASK_64(x)
|
||||
#define LE_8(x) BSWAP_8(x)
|
||||
#define LE_16(x) BSWAP_16(x)
|
||||
#define LE_32(x) BSWAP_32(x)
|
||||
#define LE_64(x) BSWAP_64(x)
|
||||
#else
|
||||
#define LE_8(x) BMASK_8(x)
|
||||
#define LE_16(x) BMASK_16(x)
|
||||
#define LE_32(x) BMASK_32(x)
|
||||
#define LE_64(x) BMASK_64(x)
|
||||
#define BE_8(x) BSWAP_8(x)
|
||||
#define BE_16(x) BSWAP_16(x)
|
||||
#define BE_32(x) BSWAP_32(x)
|
||||
#define BE_64(x) BSWAP_64(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros to read unaligned values from a specific byte order to
|
||||
* native byte order
|
||||
*/
|
||||
|
||||
#define BE_IN8(xa) \
|
||||
*((uint8_t *)(xa))
|
||||
|
||||
#define BE_IN16(xa) \
|
||||
(((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1))
|
||||
|
||||
#define BE_IN32(xa) \
|
||||
(((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2))
|
||||
|
||||
#define BE_IN64(xa) \
|
||||
(((uint64_t)BE_IN32(xa) << 32) | BE_IN32((uint8_t *)(xa)+4))
|
||||
|
||||
#define LE_IN8(xa) \
|
||||
*((uint8_t *)(xa))
|
||||
|
||||
#define LE_IN16(xa) \
|
||||
(((uint16_t)LE_IN8((uint8_t *)(xa) + 1) << 8) | LE_IN8(xa))
|
||||
|
||||
#define LE_IN32(xa) \
|
||||
(((uint32_t)LE_IN16((uint8_t *)(xa) + 2) << 16) | LE_IN16(xa))
|
||||
|
||||
#define LE_IN64(xa) \
|
||||
(((uint64_t)LE_IN32((uint8_t *)(xa) + 4) << 32) | LE_IN32(xa))
|
||||
|
||||
/*
|
||||
* Macros to write unaligned values from native byte order to a specific byte
|
||||
* order.
|
||||
*/
|
||||
|
||||
#define BE_OUT8(xa, yv) *((uint8_t *)(xa)) = (uint8_t)(yv);
|
||||
|
||||
#define BE_OUT16(xa, yv) \
|
||||
BE_OUT8((uint8_t *)(xa) + 1, yv); \
|
||||
BE_OUT8((uint8_t *)(xa), (yv) >> 8);
|
||||
|
||||
#define BE_OUT32(xa, yv) \
|
||||
BE_OUT16((uint8_t *)(xa) + 2, yv); \
|
||||
BE_OUT16((uint8_t *)(xa), (yv) >> 16);
|
||||
|
||||
#define BE_OUT64(xa, yv) \
|
||||
BE_OUT32((uint8_t *)(xa) + 4, yv); \
|
||||
BE_OUT32((uint8_t *)(xa), (yv) >> 32);
|
||||
|
||||
#define LE_OUT8(xa, yv) *((uint8_t *)(xa)) = (uint8_t)(yv);
|
||||
|
||||
#define LE_OUT16(xa, yv) \
|
||||
LE_OUT8((uint8_t *)(xa), yv); \
|
||||
LE_OUT8((uint8_t *)(xa) + 1, (yv) >> 8);
|
||||
|
||||
#define LE_OUT32(xa, yv) \
|
||||
LE_OUT16((uint8_t *)(xa), yv); \
|
||||
LE_OUT16((uint8_t *)(xa) + 2, (yv) >> 16);
|
||||
|
||||
#define LE_OUT64(xa, yv) \
|
||||
LE_OUT32((uint8_t *)(xa), yv); \
|
||||
LE_OUT32((uint8_t *)(xa) + 4, (yv) >> 32);
|
||||
|
||||
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_BYTEORDER_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_CRED_H
|
||||
#define _SOL_SYS_CRED_H
|
||||
|
||||
typedef struct cred cred_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DKIO_H
|
||||
#define _SYS_DKIO_H
|
||||
|
||||
|
||||
|
||||
#include <sys/dklabel.h> /* Needed for NDKMAP define */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structures and definitions for disk io control commands
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structures used as data by ioctl calls.
|
||||
*/
|
||||
|
||||
#define DK_DEVLEN 16 /* device name max length, including */
|
||||
/* unit # & NULL (ie - "xyc1") */
|
||||
|
||||
/*
|
||||
* Used for controller info
|
||||
*/
|
||||
struct dk_cinfo {
|
||||
char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */
|
||||
ushort_t dki_ctype; /* controller type */
|
||||
ushort_t dki_flags; /* flags */
|
||||
ushort_t dki_cnum; /* controller number */
|
||||
uint_t dki_addr; /* controller address */
|
||||
uint_t dki_space; /* controller bus type */
|
||||
uint_t dki_prio; /* interrupt priority */
|
||||
uint_t dki_vec; /* interrupt vector */
|
||||
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
||||
uint_t dki_unit; /* unit number */
|
||||
uint_t dki_slave; /* slave number */
|
||||
ushort_t dki_partition; /* partition number */
|
||||
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
||||
};
|
||||
|
||||
/*
|
||||
* Controller types
|
||||
*/
|
||||
#define DKC_UNKNOWN 0
|
||||
#define DKC_CDROM 1 /* CD-ROM, SCSI or otherwise */
|
||||
#define DKC_WDC2880 2
|
||||
#define DKC_XXX_0 3 /* unassigned */
|
||||
#define DKC_XXX_1 4 /* unassigned */
|
||||
#define DKC_DSD5215 5
|
||||
#define DKC_ACB4000 7
|
||||
#define DKC_MD21 8
|
||||
#define DKC_XXX_2 9 /* unassigned */
|
||||
#define DKC_NCRFLOPPY 10
|
||||
#define DKC_SMSFLOPPY 12
|
||||
#define DKC_SCSI_CCS 13 /* SCSI CCS compatible */
|
||||
#define DKC_INTEL82072 14 /* native floppy chip */
|
||||
#define DKC_MD 16 /* meta-disk (virtual-disk) driver */
|
||||
#define DKC_INTEL82077 19 /* 82077 floppy disk controller */
|
||||
#define DKC_DIRECT 20 /* Intel direct attached device i.e. IDE */
|
||||
#define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type */
|
||||
#define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */
|
||||
#define DKC_VBD 23 /* virtual block device */
|
||||
|
||||
/*
|
||||
* Sun reserves up through 1023
|
||||
*/
|
||||
|
||||
#define DKC_CUSTOMER_BASE 1024
|
||||
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
#define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */
|
||||
#define DKI_MAPTRK 0x02 /* controller does track mapping */
|
||||
#define DKI_FMTTRK 0x04 /* formats only full track at a time */
|
||||
#define DKI_FMTVOL 0x08 /* formats only full volume at a time */
|
||||
#define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */
|
||||
#define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */
|
||||
#define DKI_PCMCIA_PFD 0x40 /* PCMCIA pseudo-floppy memory card */
|
||||
|
||||
/*
|
||||
* Used for all partitions
|
||||
*/
|
||||
struct dk_allmap {
|
||||
struct dk_map dka_map[NDKMAP];
|
||||
};
|
||||
|
||||
#if defined(_SYSCALL32)
|
||||
struct dk_allmap32 {
|
||||
struct dk_map32 dka_map[NDKMAP];
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* Definition of a disk's geometry
|
||||
*/
|
||||
struct dk_geom {
|
||||
unsigned short dkg_ncyl; /* # of data cylinders */
|
||||
unsigned short dkg_acyl; /* # of alternate cylinders */
|
||||
unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */
|
||||
unsigned short dkg_nhead; /* # of heads */
|
||||
unsigned short dkg_obs1; /* obsolete */
|
||||
unsigned short dkg_nsect; /* # of data sectors per track */
|
||||
unsigned short dkg_intrlv; /* interleave factor */
|
||||
unsigned short dkg_obs2; /* obsolete */
|
||||
unsigned short dkg_obs3; /* obsolete */
|
||||
unsigned short dkg_apc; /* alternates per cyl (SCSI only) */
|
||||
unsigned short dkg_rpm; /* revolutions per minute */
|
||||
unsigned short dkg_pcyl; /* # of physical cylinders */
|
||||
unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */
|
||||
unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */
|
||||
unsigned short dkg_extra[7]; /* for compatible expansion */
|
||||
};
|
||||
|
||||
/*
|
||||
* These defines are for historic compatibility with old drivers.
|
||||
*/
|
||||
#define dkg_bhead dkg_obs1 /* used to be head offset */
|
||||
#define dkg_gap1 dkg_obs2 /* used to be gap1 */
|
||||
#define dkg_gap2 dkg_obs3 /* used to be gap2 */
|
||||
|
||||
/*
|
||||
* Disk io control commands
|
||||
* Warning: some other ioctls with the DIOC prefix exist elsewhere.
|
||||
* The Generic DKIOC numbers are from 0 - 50.
|
||||
* The Floppy Driver uses 51 - 100.
|
||||
* The Hard Disk (except SCSI) 101 - 106. (these are obsolete)
|
||||
* The CDROM Driver 151 - 200.
|
||||
* The USCSI ioctl 201 - 250.
|
||||
*/
|
||||
#define DKIOC (0x04 << 8)
|
||||
|
||||
/*
|
||||
* The following ioctls are generic in nature and need to be
|
||||
* suported as appropriate by all disk drivers
|
||||
*/
|
||||
#define DKIOCGGEOM (DKIOC|1) /* Get geometry */
|
||||
#define DKIOCINFO (DKIOC|3) /* Get info */
|
||||
#define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */
|
||||
#define DKIOCGVTOC (DKIOC|11) /* Get VTOC */
|
||||
#define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */
|
||||
|
||||
/*
|
||||
* Disk Cache Controls. These ioctls should be supported by
|
||||
* all disk drivers.
|
||||
*
|
||||
* DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl
|
||||
* argument, but it should be passed as NULL to allow for future
|
||||
* reinterpretation. From user-mode, this ioctl request is synchronous.
|
||||
*
|
||||
* When invoked from within the kernel, the arg can be NULL to indicate
|
||||
* a synchronous request or can be the address of a struct dk_callback
|
||||
* to request an asynchronous callback when the flush request is complete.
|
||||
* In this case, the flag to the ioctl must include FKIOCTL and the
|
||||
* dkc_callback field of the pointed to struct must be non-null or the
|
||||
* request is made synchronously.
|
||||
*
|
||||
* In the callback case: if the ioctl returns 0, a callback WILL be performed.
|
||||
* If the ioctl returns non-zero, a callback will NOT be performed.
|
||||
* NOTE: In some cases, the callback may be done BEFORE the ioctl call
|
||||
* returns. The caller's locking strategy should be prepared for this case.
|
||||
*/
|
||||
#define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */
|
||||
|
||||
struct dk_callback {
|
||||
void (*dkc_callback)(void *dkc_cookie, int error);
|
||||
void *dkc_cookie;
|
||||
int dkc_flag;
|
||||
};
|
||||
|
||||
/* bit flag definitions for dkc_flag */
|
||||
#define FLUSH_VOLATILE 0x1 /* Bit 0: if set, only flush */
|
||||
/* volatile cache; otherwise, flush */
|
||||
/* volatile and non-volatile cache */
|
||||
|
||||
#define DKIOCGETWCE (DKIOC|36) /* Get current write cache */
|
||||
/* enablement status */
|
||||
#define DKIOCSETWCE (DKIOC|37) /* Enable/Disable write cache */
|
||||
|
||||
/*
|
||||
* The following ioctls are used by Sun drivers to communicate
|
||||
* with their associated format routines. Support of these ioctls
|
||||
* is not required of foreign drivers
|
||||
*/
|
||||
#define DKIOCSGEOM (DKIOC|2) /* Set geometry */
|
||||
#define DKIOCSAPART (DKIOC|4) /* Set all partitions */
|
||||
#define DKIOCGAPART (DKIOC|5) /* Get all partitions */
|
||||
#define DKIOCG_PHYGEOM (DKIOC|32) /* get physical geometry */
|
||||
#define DKIOCG_VIRTGEOM (DKIOC|33) /* get virtual geometry */
|
||||
|
||||
/*
|
||||
* The following ioctl's are removable media support
|
||||
*/
|
||||
#define DKIOCLOCK (DKIOC|7) /* Generic 'lock' */
|
||||
#define DKIOCUNLOCK (DKIOC|8) /* Generic 'unlock' */
|
||||
#define DKIOCSTATE (DKIOC|13) /* Inquire insert/eject state */
|
||||
#define DKIOCREMOVABLE (DKIOC|16) /* is media removable */
|
||||
|
||||
|
||||
/*
|
||||
* ioctl for hotpluggable devices
|
||||
*/
|
||||
#define DKIOCHOTPLUGGABLE (DKIOC|35) /* is hotpluggable */
|
||||
|
||||
/*
|
||||
* Ioctl to force driver to re-read the alternate partition and rebuild
|
||||
* the internal defect map.
|
||||
*/
|
||||
#define DKIOCADDBAD (DKIOC|20) /* Re-read the alternate map (IDE) */
|
||||
#define DKIOCGETDEF (DKIOC|21) /* read defect list (IDE) */
|
||||
|
||||
/*
|
||||
* Used by applications to get disk defect information from IDE
|
||||
* drives.
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct defect_header32 {
|
||||
int head;
|
||||
caddr32_t buffer;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct defect_header {
|
||||
int head;
|
||||
caddr_t buffer;
|
||||
};
|
||||
|
||||
#define DKIOCPARTINFO (DKIOC|22) /* Get partition or slice parameters */
|
||||
|
||||
/*
|
||||
* Used by applications to get partition or slice information
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct part_info32 {
|
||||
daddr32_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct part_info {
|
||||
daddr_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
|
||||
/* The following ioctls are for Optical Memory Device */
|
||||
#define DKIOC_EBP_ENABLE (DKIOC|40) /* enable by pass erase on write */
|
||||
#define DKIOC_EBP_DISABLE (DKIOC|41) /* disable by pass erase on write */
|
||||
|
||||
/*
|
||||
* This state enum is the argument passed to the DKIOCSTATE ioctl.
|
||||
*/
|
||||
enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE };
|
||||
|
||||
#define DKIOCGMEDIAINFO (DKIOC|42) /* get information about the media */
|
||||
|
||||
/*
|
||||
* ioctls to read/write mboot info.
|
||||
*/
|
||||
#define DKIOCGMBOOT (DKIOC|43) /* get mboot info */
|
||||
#define DKIOCSMBOOT (DKIOC|44) /* set mboot info */
|
||||
|
||||
/*
|
||||
* ioctl to get the device temperature.
|
||||
*/
|
||||
#define DKIOCGTEMPERATURE (DKIOC|45) /* get temperature */
|
||||
|
||||
/*
|
||||
* Used for providing the temperature.
|
||||
*/
|
||||
|
||||
struct dk_temperature {
|
||||
uint_t dkt_flags; /* Flags */
|
||||
short dkt_cur_temp; /* Current disk temperature */
|
||||
short dkt_ref_temp; /* reference disk temperature */
|
||||
};
|
||||
|
||||
#define DKT_BYPASS_PM 0x1
|
||||
#define DKT_INVALID_TEMP 0xFFFF
|
||||
|
||||
|
||||
/*
|
||||
* Used for Media info or the current profile info
|
||||
*/
|
||||
struct dk_minfo {
|
||||
uint_t dki_media_type; /* Media type or profile info */
|
||||
uint_t dki_lbsize; /* Logical blocksize of media */
|
||||
diskaddr_t dki_capacity; /* Capacity as # of dki_lbsize blks */
|
||||
};
|
||||
|
||||
/*
|
||||
* Media types or profiles known
|
||||
*/
|
||||
#define DK_UNKNOWN 0x00 /* Media inserted - type unknown */
|
||||
|
||||
|
||||
/*
|
||||
* SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
|
||||
* maintain compatibility with SFF8090. The following define the
|
||||
* optical media type.
|
||||
*/
|
||||
#define DK_REMOVABLE_DISK 0x02 /* Removable Disk */
|
||||
#define DK_MO_ERASABLE 0x03 /* MO Erasable */
|
||||
#define DK_MO_WRITEONCE 0x04 /* MO Write once */
|
||||
#define DK_AS_MO 0x05 /* AS MO */
|
||||
#define DK_CDROM 0x08 /* CDROM */
|
||||
#define DK_CDR 0x09 /* CD-R */
|
||||
#define DK_CDRW 0x0A /* CD-RW */
|
||||
#define DK_DVDROM 0x10 /* DVD-ROM */
|
||||
#define DK_DVDR 0x11 /* DVD-R */
|
||||
#define DK_DVDRAM 0x12 /* DVD_RAM or DVD-RW */
|
||||
|
||||
/*
|
||||
* Media types for other rewritable magnetic media
|
||||
*/
|
||||
#define DK_FIXED_DISK 0x10001 /* Fixed disk SCSI or otherwise */
|
||||
#define DK_FLOPPY 0x10002 /* Floppy media */
|
||||
#define DK_ZIP 0x10003 /* IOMEGA ZIP media */
|
||||
#define DK_JAZ 0x10004 /* IOMEGA JAZ media */
|
||||
|
||||
#define DKIOCSETEFI (DKIOC|17) /* Set EFI info */
|
||||
#define DKIOCGETEFI (DKIOC|18) /* Get EFI info */
|
||||
|
||||
#define DKIOCPARTITION (DKIOC|9) /* Get partition info */
|
||||
|
||||
/*
|
||||
* Ioctls to get/set volume capabilities related to Logical Volume Managers.
|
||||
* They include the ability to get/set capabilities and to issue a read to a
|
||||
* specific underlying device of a replicated device.
|
||||
*/
|
||||
|
||||
#define DKIOCGETVOLCAP (DKIOC | 25) /* Get volume capabilities */
|
||||
#define DKIOCSETVOLCAP (DKIOC | 26) /* Set volume capabilities */
|
||||
#define DKIOCDMR (DKIOC | 27) /* Issue a directed read */
|
||||
|
||||
typedef uint_t volcapinfo_t;
|
||||
|
||||
typedef uint_t volcapset_t;
|
||||
|
||||
#define DKV_ABR_CAP 0x00000001 /* Support Appl.Based Recovery */
|
||||
#define DKV_DMR_CAP 0x00000002 /* Support Directed Mirror Read */
|
||||
|
||||
typedef struct volcap {
|
||||
volcapinfo_t vc_info; /* Capabilities available */
|
||||
volcapset_t vc_set; /* Capabilities set */
|
||||
} volcap_t;
|
||||
|
||||
#define VOL_SIDENAME 256
|
||||
|
||||
typedef struct vol_directed_rd {
|
||||
int vdr_flags;
|
||||
offset_t vdr_offset;
|
||||
size_t vdr_nbytes;
|
||||
size_t vdr_bytesread;
|
||||
void *vdr_data;
|
||||
int vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd_t;
|
||||
|
||||
#define DKV_SIDE_INIT (-1)
|
||||
#define DKV_DMR_NEXT_SIDE 0x00000001
|
||||
#define DKV_DMR_DONE 0x00000002
|
||||
#define DKV_DMR_ERROR 0x00000004
|
||||
#define DKV_DMR_SUCCESS 0x00000008
|
||||
#define DKV_DMR_SHORT 0x00000010
|
||||
|
||||
#ifdef _MULTI_DATAMODEL
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
typedef struct vol_directed_rd32 {
|
||||
int32_t vdr_flags;
|
||||
offset_t vdr_offset; /* 64-bit element on 32-bit alignment */
|
||||
size32_t vdr_nbytes;
|
||||
size32_t vdr_bytesread;
|
||||
caddr32_t vdr_data;
|
||||
int32_t vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd32_t;
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack()
|
||||
#endif
|
||||
#endif /* _MULTI_DATAMODEL */
|
||||
|
||||
/*
|
||||
* The ioctl is used to fetch disk's device type, vendor ID,
|
||||
* model number/product ID, firmware revision and serial number together.
|
||||
*
|
||||
* Currently there are two device types - DKD_ATA_TYPE which means the
|
||||
* disk is driven by cmdk/ata or dad/uata driver, and DKD_SCSI_TYPE
|
||||
* which means the disk is driven by sd/scsi hba driver.
|
||||
*/
|
||||
#define DKIOC_GETDISKID (DKIOC|46)
|
||||
|
||||
/* These two labels are for dkd_dtype of dk_disk_id_t */
|
||||
#define DKD_ATA_TYPE 0x01 /* ATA disk or legacy mode SATA disk */
|
||||
#define DKD_SCSI_TYPE 0x02 /* SCSI disk or native mode SATA disk */
|
||||
|
||||
#define DKD_ATA_MODEL 40 /* model number length */
|
||||
#define DKD_ATA_FWVER 8 /* firmware revision length */
|
||||
#define DKD_ATA_SERIAL 20 /* serial number length */
|
||||
|
||||
#define DKD_SCSI_VENDOR 8 /* vendor ID length */
|
||||
#define DKD_SCSI_PRODUCT 16 /* product ID length */
|
||||
#define DKD_SCSI_REVLEVEL 4 /* revision level length */
|
||||
#define DKD_SCSI_SERIAL 12 /* serial number length */
|
||||
|
||||
/*
|
||||
* The argument type for DKIOC_GETDISKID ioctl.
|
||||
*/
|
||||
typedef struct dk_disk_id {
|
||||
uint_t dkd_dtype;
|
||||
union {
|
||||
struct {
|
||||
char dkd_amodel[DKD_ATA_MODEL]; /* 40 bytes */
|
||||
char dkd_afwver[DKD_ATA_FWVER]; /* 8 bytes */
|
||||
char dkd_aserial[DKD_ATA_SERIAL]; /* 20 bytes */
|
||||
} ata_disk_id;
|
||||
struct {
|
||||
char dkd_svendor[DKD_SCSI_VENDOR]; /* 8 bytes */
|
||||
char dkd_sproduct[DKD_SCSI_PRODUCT]; /* 16 bytes */
|
||||
char dkd_sfwver[DKD_SCSI_REVLEVEL]; /* 4 bytes */
|
||||
char dkd_sserial[DKD_SCSI_SERIAL]; /* 12 bytes */
|
||||
} scsi_disk_id;
|
||||
} disk_id;
|
||||
} dk_disk_id_t;
|
||||
|
||||
/*
|
||||
* The ioctl is used to update the firmware of device.
|
||||
*/
|
||||
#define DKIOC_UPDATEFW (DKIOC|47)
|
||||
|
||||
/* The argument type for DKIOC_UPDATEFW ioctl */
|
||||
typedef struct dk_updatefw {
|
||||
caddr_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_t;
|
||||
|
||||
#ifdef _SYSCALL32
|
||||
typedef struct dk_updatefw_32 {
|
||||
caddr32_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_32_t;
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* firmware update type - temporary or permanent use
|
||||
*/
|
||||
#define FW_TYPE_TEMP 0x0 /* temporary use */
|
||||
#define FW_TYPE_PERM 0x1 /* permanent use */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DKIO_H */
|
||||
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 1990-2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DKLABEL_H
|
||||
#define _SYS_DKLABEL_H
|
||||
|
||||
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/types32.h>
|
||||
#include <sys/isa_defs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous defines
|
||||
*/
|
||||
#define DKL_MAGIC 0xDABE /* magic number */
|
||||
#define FKL_MAGIC 0xff /* magic number for DOS floppies */
|
||||
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define NDKMAP 16 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 1 /* location of disk label */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
#define NDKMAP 8 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 0 /* location of disk label */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
#define LEN_DKL_ASCII 128 /* length of dkl_asciilabel */
|
||||
#define LEN_DKL_VVOL 8 /* length of v_volume */
|
||||
#define DK_LABEL_SIZE 512 /* size of disk label */
|
||||
#define DK_MAX_BLOCKS 0x7fffffff /* max # of blocks handled */
|
||||
|
||||
/*
|
||||
* Reserve two cylinders on SCSI disks.
|
||||
* One is for the backup disk label and the other is for the deviceid.
|
||||
*
|
||||
* IPI disks only reserve one cylinder, but they will go away soon.
|
||||
* CDROMs do not reserve any cylinders.
|
||||
*/
|
||||
#define DK_ACYL 2
|
||||
|
||||
/*
|
||||
* Format of a Sun disk label.
|
||||
* Resides in cylinder 0, head 0, sector 0.
|
||||
*
|
||||
* sizeof (struct dk_label) should be 512 (the current sector size),
|
||||
* but should the sector size increase, this structure should remain
|
||||
* at the beginning of the sector.
|
||||
*/
|
||||
|
||||
/*
|
||||
* partition headers: section 1
|
||||
* Returned in struct dk_allmap by ioctl DKIOC[SG]APART (dkio(7I))
|
||||
*/
|
||||
struct dk_map {
|
||||
daddr_t dkl_cylno; /* starting cylinder */
|
||||
daddr_t dkl_nblk; /* number of blocks; if == 0, */
|
||||
/* partition is undefined */
|
||||
};
|
||||
|
||||
/*
|
||||
* partition headers: section 1
|
||||
* Fixed size for on-disk dk_label
|
||||
*/
|
||||
struct dk_map32 {
|
||||
daddr32_t dkl_cylno; /* starting cylinder */
|
||||
daddr32_t dkl_nblk; /* number of blocks; if == 0, */
|
||||
/* partition is undefined */
|
||||
};
|
||||
|
||||
/*
|
||||
* partition headers: section 2,
|
||||
* brought over from AT&T SVr4 vtoc structure.
|
||||
*/
|
||||
struct dk_map2 {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permission flag */
|
||||
};
|
||||
|
||||
struct dkl_partition {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permision flags */
|
||||
daddr32_t p_start; /* start sector no of partition */
|
||||
int32_t p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* VTOC inclusions from AT&T SVr4
|
||||
* Fixed sized types for on-disk VTOC
|
||||
*/
|
||||
|
||||
struct dk_vtoc {
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
uint32_t v_bootinfo[3]; /* info for mboot (unsupported) */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_sectorsz; /* sector size in bytes */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
struct dkl_partition v_part[NDKMAP]; /* partition headers */
|
||||
time32_t timestamp[NDKMAP]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
struct dk_map2 v_part[NDKMAP]; /* partition hdrs, sec 2 */
|
||||
uint32_t v_bootinfo[3]; /* info needed by mboot */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
time32_t v_timestamp[NDKMAP]; /* partition timestamp */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* define the amount of disk label padding needed to make
|
||||
* the entire structure occupy 512 bytes.
|
||||
*/
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define LEN_DKL_PAD (DK_LABEL_SIZE - \
|
||||
((sizeof (struct dk_vtoc) + \
|
||||
(4 * sizeof (uint32_t)) + \
|
||||
(12 * sizeof (uint16_t)) + \
|
||||
(2 * (sizeof (uint16_t))))))
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
#define LEN_DKL_PAD (DK_LABEL_SIZE \
|
||||
- ((LEN_DKL_ASCII) + \
|
||||
(sizeof (struct dk_vtoc)) + \
|
||||
(sizeof (struct dk_map32) * NDKMAP) + \
|
||||
(14 * (sizeof (uint16_t))) + \
|
||||
(2 * (sizeof (uint16_t)))))
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
|
||||
struct dk_label {
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
struct dk_vtoc dkl_vtoc; /* vtoc inclusions from AT&T SVr4 */
|
||||
uint32_t dkl_pcyl; /* # of physical cylinders */
|
||||
uint32_t dkl_ncyl; /* # of data cylinders */
|
||||
uint16_t dkl_acyl; /* # of alternate cylinders */
|
||||
uint16_t dkl_bcyl; /* cyl offset (for fixed head area) */
|
||||
uint32_t dkl_nhead; /* # of heads */
|
||||
uint32_t dkl_nsect; /* # of data sectors per track */
|
||||
uint16_t dkl_intrlv; /* interleave factor */
|
||||
uint16_t dkl_skew; /* skew factor */
|
||||
uint16_t dkl_apc; /* alternates per cyl (SCSI only) */
|
||||
uint16_t dkl_rpm; /* revolutions per minute */
|
||||
uint16_t dkl_write_reinstruct; /* # sectors to skip, writes */
|
||||
uint16_t dkl_read_reinstruct; /* # sectors to skip, reads */
|
||||
uint16_t dkl_extra[4]; /* for compatible expansion */
|
||||
char dkl_pad[LEN_DKL_PAD]; /* unused part of 512 bytes */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
char dkl_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
struct dk_vtoc dkl_vtoc; /* vtoc inclusions from AT&T SVr4 */
|
||||
uint16_t dkl_write_reinstruct; /* # sectors to skip, writes */
|
||||
uint16_t dkl_read_reinstruct; /* # sectors to skip, reads */
|
||||
char dkl_pad[LEN_DKL_PAD]; /* unused part of 512 bytes */
|
||||
uint16_t dkl_rpm; /* rotations per minute */
|
||||
uint16_t dkl_pcyl; /* # physical cylinders */
|
||||
uint16_t dkl_apc; /* alternates per cylinder */
|
||||
uint16_t dkl_obs1; /* obsolete */
|
||||
uint16_t dkl_obs2; /* obsolete */
|
||||
uint16_t dkl_intrlv; /* interleave factor */
|
||||
uint16_t dkl_ncyl; /* # of data cylinders */
|
||||
uint16_t dkl_acyl; /* # of alternate cylinders */
|
||||
uint16_t dkl_nhead; /* # of heads in this partition */
|
||||
uint16_t dkl_nsect; /* # of 512 byte sectors per track */
|
||||
uint16_t dkl_obs3; /* obsolete */
|
||||
uint16_t dkl_obs4; /* obsolete */
|
||||
struct dk_map32 dkl_map[NDKMAP]; /* logical partition headers */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
uint16_t dkl_magic; /* identifies this label format */
|
||||
uint16_t dkl_cksum; /* xor checksum of sector */
|
||||
};
|
||||
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define dkl_asciilabel dkl_vtoc.v_asciilabel
|
||||
#define v_timestamp timestamp
|
||||
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
|
||||
/*
|
||||
* These defines are for historic compatibility with old drivers.
|
||||
*/
|
||||
#define dkl_gap1 dkl_obs1 /* used to be gap1 */
|
||||
#define dkl_gap2 dkl_obs2 /* used to be gap2 */
|
||||
#define dkl_bhead dkl_obs3 /* used to be label head offset */
|
||||
#define dkl_ppart dkl_obs4 /* used to by physical partition */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
struct fk_label { /* DOS floppy label */
|
||||
uchar_t fkl_type;
|
||||
uchar_t fkl_magich;
|
||||
uchar_t fkl_magicl;
|
||||
uchar_t filler;
|
||||
};
|
||||
|
||||
/*
|
||||
* Layout of stored fabricated device id (on-disk)
|
||||
*/
|
||||
#define DK_DEVID_BLKSIZE (512)
|
||||
#define DK_DEVID_SIZE (DK_DEVID_BLKSIZE - ((sizeof (uchar_t) * 7)))
|
||||
#define DK_DEVID_REV_MSB (0)
|
||||
#define DK_DEVID_REV_LSB (1)
|
||||
|
||||
struct dk_devid {
|
||||
uchar_t dkd_rev_hi; /* revision (MSB) */
|
||||
uchar_t dkd_rev_lo; /* revision (LSB) */
|
||||
uchar_t dkd_flags; /* flags (not used yet) */
|
||||
uchar_t dkd_devid[DK_DEVID_SIZE]; /* devid stored here */
|
||||
uchar_t dkd_checksum3; /* checksum (MSB) */
|
||||
uchar_t dkd_checksum2;
|
||||
uchar_t dkd_checksum1;
|
||||
uchar_t dkd_checksum0; /* checksum (LSB) */
|
||||
};
|
||||
|
||||
#define DKD_GETCHKSUM(dkd) ((dkd)->dkd_checksum3 << 24) + \
|
||||
((dkd)->dkd_checksum2 << 16) + \
|
||||
((dkd)->dkd_checksum1 << 8) + \
|
||||
((dkd)->dkd_checksum0)
|
||||
|
||||
#define DKD_FORMCHKSUM(c, dkd) (dkd)->dkd_checksum3 = hibyte(hiword((c))); \
|
||||
(dkd)->dkd_checksum2 = lobyte(hiword((c))); \
|
||||
(dkd)->dkd_checksum1 = hibyte(loword((c))); \
|
||||
(dkd)->dkd_checksum0 = lobyte(loword((c)));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DKLABEL_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FEATURE_TESTS_H
|
||||
#define _SYS_FEATURE_TESTS_H
|
||||
|
||||
#define __NORETURN __attribute__((__noreturn__))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_FILE_H
|
||||
#define _SOL_SYS_FILE_H
|
||||
|
||||
#include_next <sys/file.h>
|
||||
|
||||
#include <sys/user.h>
|
||||
|
||||
#define FREAD 1
|
||||
#define FWRITE 2
|
||||
//#define FAPPEND 8
|
||||
|
||||
#define FCREAT O_CREAT
|
||||
#define FTRUNC O_TRUNC
|
||||
#define FOFFMAX O_LARGEFILE
|
||||
#define FSYNC O_SYNC
|
||||
#define FDSYNC O_DSYNC
|
||||
#define FRSYNC O_RSYNC
|
||||
#define FEXCL O_EXCL
|
||||
|
||||
#define FNODSYNC 0x10000 /* fsync pseudo flag */
|
||||
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
|
||||
#define FIGNORECASE 0x80000 /* request case-insensitive lookups */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
DISTFILES = protocol.h util.h
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_IDMAP_H
|
||||
#define _SYS_IDMAP_H
|
||||
|
||||
|
||||
|
||||
/* Idmap status codes */
|
||||
#define IDMAP_SUCCESS 0
|
||||
#define IDMAP_NEXT 1
|
||||
#define IDMAP_ERR_OTHER -10000
|
||||
#define IDMAP_ERR_INTERNAL -9999
|
||||
#define IDMAP_ERR_MEMORY -9998
|
||||
#define IDMAP_ERR_NORESULT -9997
|
||||
#define IDMAP_ERR_NOTUSER -9996
|
||||
#define IDMAP_ERR_NOTGROUP -9995
|
||||
#define IDMAP_ERR_NOTSUPPORTED -9994
|
||||
#define IDMAP_ERR_W2U_NAMERULE -9993
|
||||
#define IDMAP_ERR_U2W_NAMERULE -9992
|
||||
#define IDMAP_ERR_CACHE -9991
|
||||
#define IDMAP_ERR_DB -9990
|
||||
#define IDMAP_ERR_ARG -9989
|
||||
#define IDMAP_ERR_SID -9988
|
||||
#define IDMAP_ERR_IDTYPE -9987
|
||||
#define IDMAP_ERR_RPC_HANDLE -9986
|
||||
#define IDMAP_ERR_RPC -9985
|
||||
#define IDMAP_ERR_CLIENT_HANDLE -9984
|
||||
#define IDMAP_ERR_BUSY -9983
|
||||
#define IDMAP_ERR_PERMISSION_DENIED -9982
|
||||
#define IDMAP_ERR_NOMAPPING -9981
|
||||
#define IDMAP_ERR_NEW_ID_ALLOC_REQD -9980
|
||||
#define IDMAP_ERR_DOMAIN -9979
|
||||
#define IDMAP_ERR_SECURITY -9978
|
||||
#define IDMAP_ERR_NOTFOUND -9977
|
||||
#define IDMAP_ERR_DOMAIN_NOTFOUND -9976
|
||||
#define IDMAP_ERR_UPDATE_NOTALLOWED -9975
|
||||
#define IDMAP_ERR_CFG -9974
|
||||
#define IDMAP_ERR_CFG_CHANGE -9973
|
||||
#define IDMAP_ERR_NOTMAPPED_WELLKNOWN -9972
|
||||
#define IDMAP_ERR_RETRIABLE_NET_ERR -9971
|
||||
#define IDMAP_ERR_W2U_NAMERULE_CONFLICT -9970
|
||||
#define IDMAP_ERR_U2W_NAMERULE_CONFLICT -9969
|
||||
#define IDMAP_ERR_BAD_UTF8 -9968
|
||||
|
||||
/* Reserved GIDs for some well-known SIDs */
|
||||
#define IDMAP_WK_LOCAL_SYSTEM_GID 2147483648U
|
||||
#define IDMAP_WK_CREATOR_GROUP_GID 2147483649U
|
||||
#define IDMAP_WK__MAX_GID 2147483649U
|
||||
|
||||
/* Reserved UIDs for some well-known SIDs */
|
||||
#define IDMAP_WK_CREATOR_OWNER_UID 2147483648U
|
||||
#define IDMAP_WK__MAX_UID 2147483648U
|
||||
|
||||
/* Reserved SIDs */
|
||||
#define IDMAP_WK_CREATOR_SID_AUTHORITY "S-1-3"
|
||||
|
||||
/*
|
||||
* Max door RPC size for ID mapping (can't be too large relative to the
|
||||
* default user-land thread stack size, since clnt_door_call()
|
||||
* alloca()s). See libidmap:idmap_init().
|
||||
*/
|
||||
#define IDMAP_MAX_DOOR_RPC (256 * 1024)
|
||||
|
||||
#endif /* _SYS_IDMAP_H */
|
||||
@@ -0,0 +1 @@
|
||||
#include <inttypes.h>
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_INTTYPES_H
|
||||
#define _SOL_SYS_INTTYPES_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define _INT64_TYPE
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,482 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ISA_DEFS_H
|
||||
#define _SYS_ISA_DEFS_H
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This header file serves to group a set of well known defines and to
|
||||
* set these for each instruction set architecture. These defines may
|
||||
* be divided into two groups; characteristics of the processor and
|
||||
* implementation choices for Solaris on a processor.
|
||||
*
|
||||
* Processor Characteristics:
|
||||
*
|
||||
* _LITTLE_ENDIAN / _BIG_ENDIAN:
|
||||
* The natural byte order of the processor. A pointer to an int points
|
||||
* to the least/most significant byte of that int.
|
||||
*
|
||||
* _STACK_GROWS_UPWARD / _STACK_GROWS_DOWNWARD:
|
||||
* The processor specific direction of stack growth. A push onto the
|
||||
* stack increases/decreases the stack pointer, so it stores data at
|
||||
* successively higher/lower addresses. (Stackless machines ignored
|
||||
* without regrets).
|
||||
*
|
||||
* _LONG_LONG_HTOL / _LONG_LONG_LTOH:
|
||||
* A pointer to a long long points to the most/least significant long
|
||||
* within that long long.
|
||||
*
|
||||
* _BIT_FIELDS_HTOL / _BIT_FIELDS_LTOH:
|
||||
* The C compiler assigns bit fields from the high/low to the low/high end
|
||||
* of an int (most to least significant vs. least to most significant).
|
||||
*
|
||||
* _IEEE_754:
|
||||
* The processor (or supported implementations of the processor)
|
||||
* supports the ieee-754 floating point standard. No other floating
|
||||
* point standards are supported (or significant). Any other supported
|
||||
* floating point formats are expected to be cased on the ISA processor
|
||||
* symbol.
|
||||
*
|
||||
* _CHAR_IS_UNSIGNED / _CHAR_IS_SIGNED:
|
||||
* The C Compiler implements objects of type `char' as `unsigned' or
|
||||
* `signed' respectively. This is really an implementation choice of
|
||||
* the compiler writer, but it is specified in the ABI and tends to
|
||||
* be uniform across compilers for an instruction set architecture.
|
||||
* Hence, it has the properties of a processor characteristic.
|
||||
*
|
||||
* _CHAR_ALIGNMENT / _SHORT_ALIGNMENT / _INT_ALIGNMENT / _LONG_ALIGNMENT /
|
||||
* _LONG_LONG_ALIGNMENT / _DOUBLE_ALIGNMENT / _LONG_DOUBLE_ALIGNMENT /
|
||||
* _POINTER_ALIGNMENT / _FLOAT_ALIGNMENT:
|
||||
* The ABI defines alignment requirements of each of the primitive
|
||||
* object types. Some, if not all, may be hardware requirements as
|
||||
* well. The values are expressed in "byte-alignment" units.
|
||||
*
|
||||
* _MAX_ALIGNMENT:
|
||||
* The most stringent alignment requirement as specified by the ABI.
|
||||
* Equal to the maximum of all the above _XXX_ALIGNMENT values.
|
||||
*
|
||||
* _ALIGNMENT_REQUIRED:
|
||||
* True or false (1 or 0) whether or not the hardware requires the ABI
|
||||
* alignment.
|
||||
*
|
||||
* _LONG_LONG_ALIGNMENT_32
|
||||
* The 32-bit ABI supported by a 64-bit kernel may have different
|
||||
* alignment requirements for primitive object types. The value of this
|
||||
* identifier is expressed in "byte-alignment" units.
|
||||
*
|
||||
* _HAVE_CPUID_INSN
|
||||
* This indicates that the architecture supports the 'cpuid'
|
||||
* instruction as defined by Intel. (Intel allows other vendors
|
||||
* to extend the instruction for their own purposes.)
|
||||
*
|
||||
*
|
||||
* Implementation Choices:
|
||||
*
|
||||
* _ILP32 / _LP64:
|
||||
* This specifies the compiler data type implementation as specified in
|
||||
* the relevant ABI. The choice between these is strongly influenced
|
||||
* by the underlying hardware, but is not absolutely tied to it.
|
||||
* Currently only two data type models are supported:
|
||||
*
|
||||
* _ILP32:
|
||||
* Int/Long/Pointer are 32 bits. This is the historical UNIX
|
||||
* and Solaris implementation. Due to its historical standing,
|
||||
* this is the default case.
|
||||
*
|
||||
* _LP64:
|
||||
* Long/Pointer are 64 bits, Int is 32 bits. This is the chosen
|
||||
* implementation for 64-bit ABIs such as SPARC V9.
|
||||
*
|
||||
* _I32LPx:
|
||||
* A compilation environment where 'int' is 32-bit, and
|
||||
* longs and pointers are simply the same size.
|
||||
*
|
||||
* In all cases, Char is 8 bits and Short is 16 bits.
|
||||
*
|
||||
* _SUNOS_VTOC_8 / _SUNOS_VTOC_16 / _SVR4_VTOC_16:
|
||||
* This specifies the form of the disk VTOC (or label):
|
||||
*
|
||||
* _SUNOS_VTOC_8:
|
||||
* This is a VTOC form which is upwardly compatible with the
|
||||
* SunOS 4.x disk label and allows 8 partitions per disk.
|
||||
*
|
||||
* _SUNOS_VTOC_16:
|
||||
* In this format the incore vtoc image matches the ondisk
|
||||
* version. It allows 16 slices per disk, and is not
|
||||
* compatible with the SunOS 4.x disk label.
|
||||
*
|
||||
* Note that these are not the only two VTOC forms possible and
|
||||
* additional forms may be added. One possible form would be the
|
||||
* SVr4 VTOC form. The symbol for that is reserved now, although
|
||||
* it is not implemented.
|
||||
*
|
||||
* _SVR4_VTOC_16:
|
||||
* This VTOC form is compatible with the System V Release 4
|
||||
* VTOC (as implemented on the SVr4 Intel and 3b ports) with
|
||||
* 16 partitions per disk.
|
||||
*
|
||||
*
|
||||
* _DMA_USES_PHYSADDR / _DMA_USES_VIRTADDR
|
||||
* This describes the type of addresses used by system DMA:
|
||||
*
|
||||
* _DMA_USES_PHYSADDR:
|
||||
* This type of DMA, used in the x86 implementation,
|
||||
* requires physical addresses for DMA buffers. The 24-bit
|
||||
* addresses used by some legacy boards is the source of the
|
||||
* "low-memory" (<16MB) requirement for some devices using DMA.
|
||||
*
|
||||
* _DMA_USES_VIRTADDR:
|
||||
* This method of DMA allows the use of virtual addresses for
|
||||
* DMA transfers.
|
||||
*
|
||||
* _FIRMWARE_NEEDS_FDISK / _NO_FDISK_PRESENT
|
||||
* This indicates the presence/absence of an fdisk table.
|
||||
*
|
||||
* _FIRMWARE_NEEDS_FDISK
|
||||
* The fdisk table is required by system firmware. If present,
|
||||
* it allows a disk to be subdivided into multiple fdisk
|
||||
* partitions, each of which is equivalent to a separate,
|
||||
* virtual disk. This enables the co-existence of multiple
|
||||
* operating systems on a shared hard disk.
|
||||
*
|
||||
* _NO_FDISK_PRESENT
|
||||
* If the fdisk table is absent, it is assumed that the entire
|
||||
* media is allocated for a single operating system.
|
||||
*
|
||||
* _HAVE_TEM_FIRMWARE
|
||||
* Defined if this architecture has the (fallback) option of
|
||||
* using prom_* calls for doing I/O if a suitable kernel driver
|
||||
* is not available to do it.
|
||||
*
|
||||
* _DONT_USE_1275_GENERIC_NAMES
|
||||
* Controls whether or not device tree node names should
|
||||
* comply with the IEEE 1275 "Generic Names" Recommended
|
||||
* Practice. With _DONT_USE_GENERIC_NAMES, device-specific
|
||||
* names identifying the particular device will be used.
|
||||
*
|
||||
* __i386_COMPAT
|
||||
* This indicates whether the i386 ABI is supported as a *non-native*
|
||||
* mode for the platform. When this symbol is defined:
|
||||
* - 32-bit xstat-style system calls are enabled
|
||||
* - 32-bit xmknod-style system calls are enabled
|
||||
* - 32-bit system calls use i386 sizes -and- alignments
|
||||
*
|
||||
* Note that this is NOT defined for the i386 native environment!
|
||||
*
|
||||
* __x86
|
||||
* This is ONLY a synonym for defined(__i386) || defined(__amd64)
|
||||
* which is useful only insofar as these two architectures share
|
||||
* common attributes. Analogous to __sparc.
|
||||
*
|
||||
* _PSM_MODULES
|
||||
* This indicates whether or not the implementation uses PSM
|
||||
* modules for processor support, reading /etc/mach from inside
|
||||
* the kernel to extract a list.
|
||||
*
|
||||
* _RTC_CONFIG
|
||||
* This indicates whether or not the implementation uses /etc/rtc_config
|
||||
* to configure the real-time clock in the kernel.
|
||||
*
|
||||
* _UNIX_KRTLD
|
||||
* This indicates that the implementation uses a dynamically
|
||||
* linked unix + krtld to form the core kernel image at boot
|
||||
* time, or (in the absence of this symbol) a prelinked kernel image.
|
||||
*
|
||||
* _OBP
|
||||
* This indicates the firmware interface is OBP.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize Solaris on AMD's
|
||||
* 64-bit systems.
|
||||
*/
|
||||
#if defined(__x86_64) || defined(__amd64)
|
||||
|
||||
#if !defined(__amd64)
|
||||
#define __amd64 /* preferred guard */
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_LTOH
|
||||
#define _BIT_FIELDS_LTOH
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_ALIGNMENT 8
|
||||
#define _LONG_LONG_ALIGNMENT 8
|
||||
#define _DOUBLE_ALIGNMENT 8
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_ALIGNMENT 16
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
|
||||
#define _POINTER_ALIGNMENT 8
|
||||
#define _MAX_ALIGNMENT 16
|
||||
#define _ALIGNMENT_REQUIRED 1
|
||||
|
||||
/*
|
||||
* Different alignment constraints for the i386 ABI in compatibility mode
|
||||
*/
|
||||
#define _LONG_LONG_ALIGNMENT_32 4
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices".
|
||||
*/
|
||||
#if !defined(_LP64)
|
||||
#define _LP64
|
||||
#endif
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _MULTI_DATAMODEL
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _DMA_USES_PHYSADDR
|
||||
#define _FIRMWARE_NEEDS_FDISK
|
||||
#define __i386_COMPAT
|
||||
#define _PSM_MODULES
|
||||
#define _RTC_CONFIG
|
||||
#define _DONT_USE_1275_GENERIC_NAMES
|
||||
#define _HAVE_CPUID_INSN
|
||||
|
||||
/*
|
||||
* The feature test macro __i386 is generic for all processors implementing
|
||||
* the Intel 386 instruction set or a superset of it. Specifically, this
|
||||
* includes all members of the 386, 486, and Pentium family of processors.
|
||||
*/
|
||||
#elif defined(__i386) || defined(__i386__)
|
||||
|
||||
#if !defined(__i386)
|
||||
#define __i386
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_LTOH
|
||||
#define _BIT_FIELDS_LTOH
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_ALIGNMENT 4
|
||||
#define _LONG_LONG_ALIGNMENT 4
|
||||
#define _DOUBLE_ALIGNMENT 4
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 4
|
||||
#define _POINTER_ALIGNMENT 4
|
||||
#define _MAX_ALIGNMENT 4
|
||||
#define _ALIGNMENT_REQUIRED 0
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices".
|
||||
*/
|
||||
#define _ILP32
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _DMA_USES_PHYSADDR
|
||||
#define _FIRMWARE_NEEDS_FDISK
|
||||
#define _PSM_MODULES
|
||||
#define _RTC_CONFIG
|
||||
#define _DONT_USE_1275_GENERIC_NAMES
|
||||
#define _HAVE_CPUID_INSN
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the Solaris on SPARC systems.
|
||||
*
|
||||
* The symbol __sparc indicates any of the SPARC family of processor
|
||||
* architectures. This includes SPARC V7, SPARC V8 and SPARC V9.
|
||||
*
|
||||
* The symbol __sparcv8 indicates the 32-bit SPARC V8 architecture as defined
|
||||
* by Version 8 of the SPARC Architecture Manual. (SPARC V7 is close enough
|
||||
* to SPARC V8 for the former to be subsumed into the latter definition.)
|
||||
*
|
||||
* The symbol __sparcv9 indicates the 64-bit SPARC V9 architecture as defined
|
||||
* by Version 9 of the SPARC Architecture Manual.
|
||||
*
|
||||
* The symbols __sparcv8 and __sparcv9 are mutually exclusive, and are only
|
||||
* relevant when the symbol __sparc is defined.
|
||||
*/
|
||||
/*
|
||||
* XXX Due to the existence of 5110166, "defined(__sparcv9)" needs to be added
|
||||
* to support backwards builds. This workaround should be removed in s10_71.
|
||||
*/
|
||||
#elif defined(__sparc) || defined(__sparcv9) || defined(__sparc__)
|
||||
#if !defined(__sparc)
|
||||
#define __sparc
|
||||
#endif
|
||||
|
||||
/*
|
||||
* You can be 32-bit or 64-bit, but not both at the same time.
|
||||
*/
|
||||
#if defined(__sparcv8) && defined(__sparcv9)
|
||||
#error "SPARC Versions 8 and 9 are mutually exclusive choices"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Existing compilers do not set __sparcv8. Years will transpire before
|
||||
* the compilers can be depended on to set the feature test macro. In
|
||||
* the interim, we'll set it here on the basis of historical behaviour;
|
||||
* if you haven't asked for SPARC V9, then you must've meant SPARC V8.
|
||||
*/
|
||||
#if !defined(__sparcv9) && !defined(__sparcv8)
|
||||
#define __sparcv8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics" shared between
|
||||
* all Solaris on SPARC systems.
|
||||
*/
|
||||
#define _BIG_ENDIAN
|
||||
#define _STACK_GROWS_DOWNWARD
|
||||
#define _LONG_LONG_HTOL
|
||||
#define _BIT_FIELDS_HTOL
|
||||
#define _IEEE_754
|
||||
#define _CHAR_IS_SIGNED
|
||||
#define _BOOL_ALIGNMENT 1
|
||||
#define _CHAR_ALIGNMENT 1
|
||||
#define _SHORT_ALIGNMENT 2
|
||||
#define _INT_ALIGNMENT 4
|
||||
#define _FLOAT_ALIGNMENT 4
|
||||
#define _FLOAT_COMPLEX_ALIGNMENT 4
|
||||
#define _LONG_LONG_ALIGNMENT 8
|
||||
#define _DOUBLE_ALIGNMENT 8
|
||||
#define _DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _ALIGNMENT_REQUIRED 1
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices" shared between versions.
|
||||
*/
|
||||
#define _SUNOS_VTOC_8
|
||||
#define _DMA_USES_VIRTADDR
|
||||
#define _NO_FDISK_PRESENT
|
||||
#define _HAVE_TEM_FIRMWARE
|
||||
#define _OBP
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the implementation of
|
||||
* 32-bit Solaris on SPARC V8 systems.
|
||||
*/
|
||||
#if defined(__sparcv8)
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LONG_ALIGNMENT 4
|
||||
#define _LONG_DOUBLE_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 8
|
||||
#define _POINTER_ALIGNMENT 4
|
||||
#define _MAX_ALIGNMENT 8
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices"
|
||||
*/
|
||||
#define _ILP32
|
||||
#if !defined(_I32LPx) && defined(_KERNEL)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following set of definitions characterize the implementation of
|
||||
* 64-bit Solaris on SPARC V9 systems.
|
||||
*/
|
||||
#elif defined(__sparcv9)
|
||||
|
||||
/*
|
||||
* Define the appropriate "processor characteristics"
|
||||
*/
|
||||
#define _LONG_ALIGNMENT 8
|
||||
#define _LONG_DOUBLE_ALIGNMENT 16
|
||||
#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
|
||||
#define _POINTER_ALIGNMENT 8
|
||||
#define _MAX_ALIGNMENT 16
|
||||
|
||||
#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGMENT
|
||||
|
||||
/*
|
||||
* Define the appropriate "implementation choices"
|
||||
*/
|
||||
#if !defined(_LP64)
|
||||
#define _LP64
|
||||
#endif
|
||||
#if !defined(_I32LPx)
|
||||
#define _I32LPx
|
||||
#endif
|
||||
#define _MULTI_DATAMODEL
|
||||
|
||||
#else
|
||||
#error "unknown SPARC version"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* #error is strictly ansi-C, but works as well as anything for K&R systems.
|
||||
*/
|
||||
#else
|
||||
#error "ISA not supported"
|
||||
#endif
|
||||
|
||||
#if defined(_ILP32) && defined(_LP64)
|
||||
#error "Both _ILP32 and _LP64 are defined"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ISA_DEFS_H */
|
||||
@@ -0,0 +1,820 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_KSTAT_H
|
||||
#define _SYS_KSTAT_H
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definition of general kernel statistics structures and /dev/kstat ioctls
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int kid_t; /* unique kstat id */
|
||||
|
||||
/*
|
||||
* Kernel statistics driver (/dev/kstat) ioctls
|
||||
*/
|
||||
|
||||
#define KSTAT_IOC_BASE ('K' << 8)
|
||||
|
||||
#define KSTAT_IOC_CHAIN_ID KSTAT_IOC_BASE | 0x01
|
||||
#define KSTAT_IOC_READ KSTAT_IOC_BASE | 0x02
|
||||
#define KSTAT_IOC_WRITE KSTAT_IOC_BASE | 0x03
|
||||
|
||||
/*
|
||||
* /dev/kstat ioctl usage (kd denotes /dev/kstat descriptor):
|
||||
*
|
||||
* kcid = ioctl(kd, KSTAT_IOC_CHAIN_ID, NULL);
|
||||
* kcid = ioctl(kd, KSTAT_IOC_READ, kstat_t *);
|
||||
* kcid = ioctl(kd, KSTAT_IOC_WRITE, kstat_t *);
|
||||
*/
|
||||
|
||||
#define KSTAT_STRLEN 31 /* 30 chars + NULL; must be 16 * n - 1 */
|
||||
|
||||
/*
|
||||
* The generic kstat header
|
||||
*/
|
||||
|
||||
typedef struct kstat {
|
||||
/*
|
||||
* Fields relevant to both kernel and user
|
||||
*/
|
||||
hrtime_t ks_crtime; /* creation time (from gethrtime()) */
|
||||
struct kstat *ks_next; /* kstat chain linkage */
|
||||
kid_t ks_kid; /* unique kstat ID */
|
||||
char ks_module[KSTAT_STRLEN]; /* provider module name */
|
||||
uchar_t ks_resv; /* reserved, currently just padding */
|
||||
int ks_instance; /* provider module's instance */
|
||||
char ks_name[KSTAT_STRLEN]; /* kstat name */
|
||||
uchar_t ks_type; /* kstat data type */
|
||||
char ks_class[KSTAT_STRLEN]; /* kstat class */
|
||||
uchar_t ks_flags; /* kstat flags */
|
||||
void *ks_data; /* kstat type-specific data */
|
||||
uint_t ks_ndata; /* # of type-specific data records */
|
||||
size_t ks_data_size; /* total size of kstat data section */
|
||||
hrtime_t ks_snaptime; /* time of last data shapshot */
|
||||
/*
|
||||
* Fields relevant to kernel only
|
||||
*/
|
||||
int (*ks_update)(struct kstat *, int); /* dynamic update */
|
||||
void *ks_private; /* arbitrary provider-private data */
|
||||
int (*ks_snapshot)(struct kstat *, void *, int);
|
||||
void *ks_lock; /* protects this kstat's data */
|
||||
} kstat_t;
|
||||
|
||||
#ifdef _SYSCALL32
|
||||
|
||||
typedef int32_t kid32_t;
|
||||
|
||||
typedef struct kstat32 {
|
||||
/*
|
||||
* Fields relevant to both kernel and user
|
||||
*/
|
||||
hrtime_t ks_crtime;
|
||||
caddr32_t ks_next; /* struct kstat pointer */
|
||||
kid32_t ks_kid;
|
||||
char ks_module[KSTAT_STRLEN];
|
||||
uint8_t ks_resv;
|
||||
int32_t ks_instance;
|
||||
char ks_name[KSTAT_STRLEN];
|
||||
uint8_t ks_type;
|
||||
char ks_class[KSTAT_STRLEN];
|
||||
uint8_t ks_flags;
|
||||
caddr32_t ks_data; /* type-specific data */
|
||||
uint32_t ks_ndata;
|
||||
size32_t ks_data_size;
|
||||
hrtime_t ks_snaptime;
|
||||
/*
|
||||
* Fields relevant to kernel only (only needed here for padding)
|
||||
*/
|
||||
int32_t _ks_update;
|
||||
caddr32_t _ks_private;
|
||||
int32_t _ks_snapshot;
|
||||
caddr32_t _ks_lock;
|
||||
} kstat32_t;
|
||||
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* kstat structure and locking strategy
|
||||
*
|
||||
* Each kstat consists of a header section (a kstat_t) and a data section.
|
||||
* The system maintains a set of kstats, protected by kstat_chain_lock.
|
||||
* kstat_chain_lock protects all additions to/deletions from this set,
|
||||
* as well as all changes to kstat headers. kstat data sections are
|
||||
* *optionally* protected by the per-kstat ks_lock. If ks_lock is non-NULL,
|
||||
* kstat clients (e.g. /dev/kstat) will acquire this lock for all of their
|
||||
* operations on that kstat. It is up to the kstat provider to decide whether
|
||||
* guaranteeing consistent data to kstat clients is sufficiently important
|
||||
* to justify the locking cost. Note, however, that most statistic updates
|
||||
* already occur under one of the provider's mutexes, so if the provider sets
|
||||
* ks_lock to point to that mutex, then kstat data locking is free.
|
||||
*
|
||||
* NOTE: variable-size kstats MUST employ kstat data locking, to prevent
|
||||
* data-size races with kstat clients.
|
||||
*
|
||||
* NOTE: ks_lock is really of type (kmutex_t *); it is declared as (void *)
|
||||
* in the kstat header so that users don't have to be exposed to all of the
|
||||
* kernel's lock-related data structures.
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
#define KSTAT_ENTER(k) \
|
||||
{ kmutex_t *lp = (k)->ks_lock; if (lp) mutex_enter(lp); }
|
||||
|
||||
#define KSTAT_EXIT(k) \
|
||||
{ kmutex_t *lp = (k)->ks_lock; if (lp) mutex_exit(lp); }
|
||||
|
||||
#define KSTAT_UPDATE(k, rw) (*(k)->ks_update)((k), (rw))
|
||||
|
||||
#define KSTAT_SNAPSHOT(k, buf, rw) (*(k)->ks_snapshot)((k), (buf), (rw))
|
||||
|
||||
#endif /* defined(_KERNEL) */
|
||||
|
||||
/*
|
||||
* kstat time
|
||||
*
|
||||
* All times associated with kstats (e.g. creation time, snapshot time,
|
||||
* kstat_timer_t and kstat_io_t timestamps, etc.) are 64-bit nanosecond values,
|
||||
* as returned by gethrtime(). The accuracy of these timestamps is machine
|
||||
* dependent, but the precision (units) is the same across all platforms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kstat identity (KID)
|
||||
*
|
||||
* Each kstat is assigned a unique KID (kstat ID) when it is added to the
|
||||
* global kstat chain. The KID is used as a cookie by /dev/kstat to
|
||||
* request information about the corresponding kstat. There is also
|
||||
* an identity associated with the entire kstat chain, kstat_chain_id,
|
||||
* which is bumped each time a kstat is added or deleted. /dev/kstat uses
|
||||
* the chain ID to detect changes in the kstat chain (e.g., a new disk
|
||||
* coming online) between ioctl()s.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kstat module, kstat instance
|
||||
*
|
||||
* ks_module and ks_instance contain the name and instance of the module
|
||||
* that created the kstat. In cases where there can only be one instance,
|
||||
* ks_instance is 0. The kernel proper (/kernel/unix) uses "unix" as its
|
||||
* module name.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kstat name
|
||||
*
|
||||
* ks_name gives a meaningful name to a kstat. The full kstat namespace
|
||||
* is module.instance.name, so the name only need be unique within a
|
||||
* module. kstat_create() will fail if you try to create a kstat with
|
||||
* an already-used (ks_module, ks_instance, ks_name) triplet. Spaces are
|
||||
* allowed in kstat names, but strongly discouraged, since they hinder
|
||||
* awk-style processing at user level.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kstat type
|
||||
*
|
||||
* The kstat mechanism provides several flavors of kstat data, defined
|
||||
* below. The "raw" kstat type is just treated as an array of bytes; you
|
||||
* can use this to export any kind of data you want.
|
||||
*
|
||||
* Some kstat types allow multiple data structures per kstat, e.g.
|
||||
* KSTAT_TYPE_NAMED; others do not. This is part of the spec for each
|
||||
* kstat data type.
|
||||
*
|
||||
* User-level tools should *not* rely on the #define KSTAT_NUM_TYPES. To
|
||||
* get this information, read out the standard system kstat "kstat_types".
|
||||
*/
|
||||
|
||||
#define KSTAT_TYPE_RAW 0 /* can be anything */
|
||||
/* ks_ndata >= 1 */
|
||||
#define KSTAT_TYPE_NAMED 1 /* name/value pair */
|
||||
/* ks_ndata >= 1 */
|
||||
#define KSTAT_TYPE_INTR 2 /* interrupt statistics */
|
||||
/* ks_ndata == 1 */
|
||||
#define KSTAT_TYPE_IO 3 /* I/O statistics */
|
||||
/* ks_ndata == 1 */
|
||||
#define KSTAT_TYPE_TIMER 4 /* event timer */
|
||||
/* ks_ndata >= 1 */
|
||||
|
||||
#define KSTAT_NUM_TYPES 5
|
||||
|
||||
/*
|
||||
* kstat class
|
||||
*
|
||||
* Each kstat can be characterized as belonging to some broad class
|
||||
* of statistics, e.g. disk, tape, net, vm, streams, etc. This field
|
||||
* can be used as a filter to extract related kstats. The following
|
||||
* values are currently in use: disk, tape, net, controller, vm, kvm,
|
||||
* hat, streams, kstat, and misc. (The kstat class encompasses things
|
||||
* like kstat_types.)
|
||||
*/
|
||||
|
||||
/*
|
||||
* kstat flags
|
||||
*
|
||||
* Any of the following flags may be passed to kstat_create(). They are
|
||||
* all zero by default.
|
||||
*
|
||||
* KSTAT_FLAG_VIRTUAL:
|
||||
*
|
||||
* Tells kstat_create() not to allocate memory for the
|
||||
* kstat data section; instead, you will set the ks_data
|
||||
* field to point to the data you wish to export. This
|
||||
* provides a convenient way to export existing data
|
||||
* structures.
|
||||
*
|
||||
* KSTAT_FLAG_VAR_SIZE:
|
||||
*
|
||||
* The size of the kstat you are creating will vary over time.
|
||||
* For example, you may want to use the kstat mechanism to
|
||||
* export a linked list. NOTE: The kstat framework does not
|
||||
* manage the data section, so all variable-size kstats must be
|
||||
* virtual kstats. Moreover, variable-size kstats MUST employ
|
||||
* kstat data locking to prevent data-size races with kstat
|
||||
* clients. See the section on "kstat snapshot" for details.
|
||||
*
|
||||
* KSTAT_FLAG_WRITABLE:
|
||||
*
|
||||
* Makes the kstat's data section writable by root.
|
||||
* The ks_snapshot routine (see below) does not need to check for
|
||||
* this; permission checking is handled in the kstat driver.
|
||||
*
|
||||
* KSTAT_FLAG_PERSISTENT:
|
||||
*
|
||||
* Indicates that this kstat is to be persistent over time.
|
||||
* For persistent kstats, kstat_delete() simply marks the
|
||||
* kstat as dormant; a subsequent kstat_create() reactivates
|
||||
* the kstat. This feature is provided so that statistics
|
||||
* are not lost across driver close/open (e.g., raw disk I/O
|
||||
* on a disk with no mounted partitions.)
|
||||
* NOTE: Persistent kstats cannot be virtual, since ks_data
|
||||
* points to garbage as soon as the driver goes away.
|
||||
*
|
||||
* The following flags are maintained by the kstat framework:
|
||||
*
|
||||
* KSTAT_FLAG_DORMANT:
|
||||
*
|
||||
* For persistent kstats, indicates that the kstat is in the
|
||||
* dormant state (e.g., the corresponding device is closed).
|
||||
*
|
||||
* KSTAT_FLAG_INVALID:
|
||||
*
|
||||
* This flag is set when a kstat is in a transitional state,
|
||||
* e.g. between kstat_create() and kstat_install().
|
||||
* kstat clients must not attempt to access the kstat's data
|
||||
* if this flag is set.
|
||||
*/
|
||||
|
||||
#define KSTAT_FLAG_VIRTUAL 0x01
|
||||
#define KSTAT_FLAG_VAR_SIZE 0x02
|
||||
#define KSTAT_FLAG_WRITABLE 0x04
|
||||
#define KSTAT_FLAG_PERSISTENT 0x08
|
||||
#define KSTAT_FLAG_DORMANT 0x10
|
||||
#define KSTAT_FLAG_INVALID 0x20
|
||||
|
||||
/*
|
||||
* Dynamic update support
|
||||
*
|
||||
* The kstat mechanism allows for an optional ks_update function to update
|
||||
* kstat data. This is useful for drivers where the underlying device
|
||||
* keeps cheap hardware stats, but extraction is expensive. Instead of
|
||||
* constantly keeping the kstat data section up to date, you can supply a
|
||||
* ks_update function which updates the kstat's data section on demand.
|
||||
* To take advantage of this feature, simply set the ks_update field before
|
||||
* calling kstat_install().
|
||||
*
|
||||
* The ks_update function, if supplied, must have the following structure:
|
||||
*
|
||||
* int
|
||||
* foo_kstat_update(kstat_t *ksp, int rw)
|
||||
* {
|
||||
* if (rw == KSTAT_WRITE) {
|
||||
* ... update the native stats from ksp->ks_data;
|
||||
* return EACCES if you don't support this
|
||||
* } else {
|
||||
* ... update ksp->ks_data from the native stats
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* The ks_update return codes are: 0 for success, EACCES if you don't allow
|
||||
* KSTAT_WRITE, and EIO for any other type of error.
|
||||
*
|
||||
* In general, the ks_update function may need to refer to provider-private
|
||||
* data; for example, it may need a pointer to the provider's raw statistics.
|
||||
* The ks_private field is available for this purpose. Its use is entirely
|
||||
* at the provider's discretion.
|
||||
*
|
||||
* All variable-size kstats MUST supply a ks_update routine, which computes
|
||||
* and sets ks_data_size (and ks_ndata if that is meaningful), since these
|
||||
* are needed to perform kstat snapshots (see below).
|
||||
*
|
||||
* No kstat locking should be done inside the ks_update routine. The caller
|
||||
* will already be holding the kstat's ks_lock (to ensure consistent data).
|
||||
*/
|
||||
|
||||
#define KSTAT_READ 0
|
||||
#define KSTAT_WRITE 1
|
||||
|
||||
/*
|
||||
* Kstat snapshot
|
||||
*
|
||||
* In order to get a consistent view of a kstat's data, clients must obey
|
||||
* the kstat's locking strategy. However, these clients may need to perform
|
||||
* operations on the data which could cause a fault (e.g. copyout()), or
|
||||
* operations which are simply expensive. Doing so could cause deadlock
|
||||
* (e.g. if you're holding a disk's kstat lock which is ultimately required
|
||||
* to resolve a copyout() fault), performance degradation (since the providers'
|
||||
* activity is serialized at the kstat lock), device timing problems, etc.
|
||||
*
|
||||
* To avoid these problems, kstat data is provided via snapshots. Taking
|
||||
* a snapshot is a simple process: allocate a wired-down kernel buffer,
|
||||
* acquire the kstat's data lock, copy the data into the buffer ("take the
|
||||
* snapshot"), and release the lock. This ensures that the kstat's data lock
|
||||
* will be held as briefly as possible, and that no faults will occur while
|
||||
* the lock is held.
|
||||
*
|
||||
* Normally, the snapshot is taken by default_kstat_snapshot(), which
|
||||
* timestamps the data (sets ks_snaptime), copies it, and does a little
|
||||
* massaging to deal with incomplete transactions on i/o kstats. However,
|
||||
* this routine only works for kstats with contiguous data (the typical case).
|
||||
* If you create a kstat whose data is, say, a linked list, you must provide
|
||||
* your own ks_snapshot routine. The routine you supply must have the
|
||||
* following prototype (replace "foo" with something appropriate):
|
||||
*
|
||||
* int foo_kstat_snapshot(kstat_t *ksp, void *buf, int rw);
|
||||
*
|
||||
* The minimal snapshot routine -- one which copies contiguous data that
|
||||
* doesn't need any massaging -- would be this:
|
||||
*
|
||||
* ksp->ks_snaptime = gethrtime();
|
||||
* if (rw == KSTAT_WRITE)
|
||||
* bcopy(buf, ksp->ks_data, ksp->ks_data_size);
|
||||
* else
|
||||
* bcopy(ksp->ks_data, buf, ksp->ks_data_size);
|
||||
* return (0);
|
||||
*
|
||||
* A more illuminating example is taking a snapshot of a linked list:
|
||||
*
|
||||
* ksp->ks_snaptime = gethrtime();
|
||||
* if (rw == KSTAT_WRITE)
|
||||
* return (EACCES); ... See below ...
|
||||
* for (foo = first_foo; foo; foo = foo->next) {
|
||||
* bcopy((char *) foo, (char *) buf, sizeof (struct foo));
|
||||
* buf = ((struct foo *) buf) + 1;
|
||||
* }
|
||||
* return (0);
|
||||
*
|
||||
* In the example above, we have decided that we don't want to allow
|
||||
* KSTAT_WRITE access, so we return EACCES if this is attempted.
|
||||
*
|
||||
* The key points are:
|
||||
*
|
||||
* (1) ks_snaptime must be set (via gethrtime()) to timestamp the data.
|
||||
* (2) Data gets copied from the kstat to the buffer on KSTAT_READ,
|
||||
* and from the buffer to the kstat on KSTAT_WRITE.
|
||||
* (3) ks_snapshot return values are: 0 for success, EACCES if you
|
||||
* don't allow KSTAT_WRITE, and EIO for any other type of error.
|
||||
*
|
||||
* Named kstats (see section on "Named statistics" below) containing long
|
||||
* strings (KSTAT_DATA_STRING) need special handling. The kstat driver
|
||||
* assumes that all strings are copied into the buffer after the array of
|
||||
* named kstats, and the pointers (KSTAT_NAMED_STR_PTR()) are updated to point
|
||||
* into the copy within the buffer. The default snapshot routine does this,
|
||||
* but overriding routines should contain at least the following:
|
||||
*
|
||||
* if (rw == KSTAT_READ) {
|
||||
* kstat_named_t *knp = buf;
|
||||
* char *end = knp + ksp->ks_ndata;
|
||||
* uint_t i;
|
||||
*
|
||||
* ... Do the regular copy ...
|
||||
* bcopy(ksp->ks_data, buf, sizeof (kstat_named_t) * ksp->ks_ndata);
|
||||
*
|
||||
* for (i = 0; i < ksp->ks_ndata; i++, knp++) {
|
||||
* if (knp[i].data_type == KSTAT_DATA_STRING &&
|
||||
* KSTAT_NAMED_STR_PTR(knp) != NULL) {
|
||||
* bcopy(KSTAT_NAMED_STR_PTR(knp), end,
|
||||
* KSTAT_NAMED_STR_BUFLEN(knp));
|
||||
* KSTAT_NAMED_STR_PTR(knp) = end;
|
||||
* end += KSTAT_NAMED_STR_BUFLEN(knp);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
/*
|
||||
* Named statistics.
|
||||
*
|
||||
* List of arbitrary name=value statistics.
|
||||
*/
|
||||
|
||||
typedef struct kstat_named {
|
||||
char name[KSTAT_STRLEN]; /* name of counter */
|
||||
uchar_t data_type; /* data type */
|
||||
union {
|
||||
char c[16]; /* enough for 128-bit ints */
|
||||
int32_t i32;
|
||||
uint32_t ui32;
|
||||
struct {
|
||||
union {
|
||||
char *ptr; /* NULL-term string */
|
||||
#if defined(_KERNEL) && defined(_MULTI_DATAMODEL)
|
||||
caddr32_t ptr32;
|
||||
#endif
|
||||
char __pad[8]; /* 64-bit padding */
|
||||
} addr;
|
||||
uint32_t len; /* # bytes for strlen + '\0' */
|
||||
} str;
|
||||
/*
|
||||
* The int64_t and uint64_t types are not valid for a maximally conformant
|
||||
* 32-bit compilation environment (cc -Xc) using compilers prior to the
|
||||
* introduction of C99 conforming compiler (reference ISO/IEC 9899:1990).
|
||||
* In these cases, the visibility of i64 and ui64 is only permitted for
|
||||
* 64-bit compilation environments or 32-bit non-maximally conformant
|
||||
* C89 or C90 ANSI C compilation environments (cc -Xt and cc -Xa). In the
|
||||
* C99 ANSI C compilation environment, the long long type is supported.
|
||||
* The _INT64_TYPE is defined by the implementation (see sys/int_types.h).
|
||||
*/
|
||||
#if defined(_INT64_TYPE)
|
||||
int64_t i64;
|
||||
uint64_t ui64;
|
||||
#endif
|
||||
long l;
|
||||
ulong_t ul;
|
||||
|
||||
/* These structure members are obsolete */
|
||||
|
||||
longlong_t ll;
|
||||
u_longlong_t ull;
|
||||
float f;
|
||||
double d;
|
||||
} value; /* value of counter */
|
||||
} kstat_named_t;
|
||||
|
||||
#define KSTAT_DATA_CHAR 0
|
||||
#define KSTAT_DATA_INT32 1
|
||||
#define KSTAT_DATA_UINT32 2
|
||||
#define KSTAT_DATA_INT64 3
|
||||
#define KSTAT_DATA_UINT64 4
|
||||
|
||||
#if !defined(_LP64)
|
||||
#define KSTAT_DATA_LONG KSTAT_DATA_INT32
|
||||
#define KSTAT_DATA_ULONG KSTAT_DATA_UINT32
|
||||
#else
|
||||
#if !defined(_KERNEL)
|
||||
#define KSTAT_DATA_LONG KSTAT_DATA_INT64
|
||||
#define KSTAT_DATA_ULONG KSTAT_DATA_UINT64
|
||||
#else
|
||||
#define KSTAT_DATA_LONG 7 /* only visible to the kernel */
|
||||
#define KSTAT_DATA_ULONG 8 /* only visible to the kernel */
|
||||
#endif /* !_KERNEL */
|
||||
#endif /* !_LP64 */
|
||||
|
||||
/*
|
||||
* Statistics exporting named kstats with long strings (KSTAT_DATA_STRING)
|
||||
* may not make the assumption that ks_data_size is equal to (ks_ndata * sizeof
|
||||
* (kstat_named_t)). ks_data_size in these cases is equal to the sum of the
|
||||
* amount of space required to store the strings (ie, the sum of
|
||||
* KSTAT_NAMED_STR_BUFLEN() for all KSTAT_DATA_STRING statistics) plus the
|
||||
* space required to store the kstat_named_t's.
|
||||
*
|
||||
* The default update routine will update ks_data_size automatically for
|
||||
* variable-length kstats containing long strings (using the default update
|
||||
* routine only makes sense if the string is the only thing that is changing
|
||||
* in size, and ks_ndata is constant). Fixed-length kstats containing long
|
||||
* strings must explicitly change ks_data_size (after creation but before
|
||||
* initialization) to reflect the correct amount of space required for the
|
||||
* long strings and the kstat_named_t's.
|
||||
*/
|
||||
#define KSTAT_DATA_STRING 9
|
||||
|
||||
/* These types are obsolete */
|
||||
|
||||
#define KSTAT_DATA_LONGLONG KSTAT_DATA_INT64
|
||||
#define KSTAT_DATA_ULONGLONG KSTAT_DATA_UINT64
|
||||
#define KSTAT_DATA_FLOAT 5
|
||||
#define KSTAT_DATA_DOUBLE 6
|
||||
|
||||
#define KSTAT_NAMED_PTR(kptr) ((kstat_named_t *)(kptr)->ks_data)
|
||||
|
||||
/*
|
||||
* Retrieve the pointer of the string contained in the given named kstat.
|
||||
*/
|
||||
#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.str.addr.ptr)
|
||||
|
||||
/*
|
||||
* Retrieve the length of the buffer required to store the string in the given
|
||||
* named kstat.
|
||||
*/
|
||||
#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.str.len)
|
||||
|
||||
/*
|
||||
* Interrupt statistics.
|
||||
*
|
||||
* An interrupt is a hard interrupt (sourced from the hardware device
|
||||
* itself), a soft interrupt (induced by the system via the use of
|
||||
* some system interrupt source), a watchdog interrupt (induced by
|
||||
* a periodic timer call), spurious (an interrupt entry point was
|
||||
* entered but there was no interrupt condition to service),
|
||||
* or multiple service (an interrupt condition was detected and
|
||||
* serviced just prior to returning from any of the other types).
|
||||
*
|
||||
* Measurement of the spurious class of interrupts is useful for
|
||||
* autovectored devices in order to pinpoint any interrupt latency
|
||||
* problems in a particular system configuration.
|
||||
*
|
||||
* Devices that have more than one interrupt of the same
|
||||
* type should use multiple structures.
|
||||
*/
|
||||
|
||||
#define KSTAT_INTR_HARD 0
|
||||
#define KSTAT_INTR_SOFT 1
|
||||
#define KSTAT_INTR_WATCHDOG 2
|
||||
#define KSTAT_INTR_SPURIOUS 3
|
||||
#define KSTAT_INTR_MULTSVC 4
|
||||
|
||||
#define KSTAT_NUM_INTRS 5
|
||||
|
||||
typedef struct kstat_intr {
|
||||
uint_t intrs[KSTAT_NUM_INTRS]; /* interrupt counters */
|
||||
} kstat_intr_t;
|
||||
|
||||
#define KSTAT_INTR_PTR(kptr) ((kstat_intr_t *)(kptr)->ks_data)
|
||||
|
||||
/*
|
||||
* I/O statistics.
|
||||
*/
|
||||
|
||||
typedef struct kstat_io {
|
||||
|
||||
/*
|
||||
* Basic counters.
|
||||
*
|
||||
* The counters should be updated at the end of service
|
||||
* (e.g., just prior to calling biodone()).
|
||||
*/
|
||||
|
||||
u_longlong_t nread; /* number of bytes read */
|
||||
u_longlong_t nwritten; /* number of bytes written */
|
||||
uint_t reads; /* number of read operations */
|
||||
uint_t writes; /* number of write operations */
|
||||
|
||||
/*
|
||||
* Accumulated time and queue length statistics.
|
||||
*
|
||||
* Accumulated time statistics are kept as a running sum
|
||||
* of "active" time. Queue length statistics are kept as a
|
||||
* running sum of the product of queue length and elapsed time
|
||||
* at that length -- i.e., a Riemann sum for queue length
|
||||
* integrated against time. (You can also think of the active time
|
||||
* as a Riemann sum, for the boolean function (queue_length > 0)
|
||||
* integrated against time, or you can think of it as the
|
||||
* Lebesgue measure of the set on which queue_length > 0.)
|
||||
*
|
||||
* ^
|
||||
* | _________
|
||||
* 8 | i4 |
|
||||
* | | |
|
||||
* Queue 6 | |
|
||||
* Length | _________ | |
|
||||
* 4 | i2 |_______| |
|
||||
* | | i3 |
|
||||
* 2_______| |
|
||||
* | i1 |
|
||||
* |_______________________________|
|
||||
* Time-> t1 t2 t3 t4
|
||||
*
|
||||
* At each change of state (entry or exit from the queue),
|
||||
* we add the elapsed time (since the previous state change)
|
||||
* to the active time if the queue length was non-zero during
|
||||
* that interval; and we add the product of the elapsed time
|
||||
* times the queue length to the running length*time sum.
|
||||
*
|
||||
* This method is generalizable to measuring residency
|
||||
* in any defined system: instead of queue lengths, think
|
||||
* of "outstanding RPC calls to server X".
|
||||
*
|
||||
* A large number of I/O subsystems have at least two basic
|
||||
* "lists" of transactions they manage: one for transactions
|
||||
* that have been accepted for processing but for which processing
|
||||
* has yet to begin, and one for transactions which are actively
|
||||
* being processed (but not done). For this reason, two cumulative
|
||||
* time statistics are defined here: wait (pre-service) time,
|
||||
* and run (service) time.
|
||||
*
|
||||
* All times are 64-bit nanoseconds (hrtime_t), as returned by
|
||||
* gethrtime().
|
||||
*
|
||||
* The units of cumulative busy time are accumulated nanoseconds.
|
||||
* The units of cumulative length*time products are elapsed time
|
||||
* times queue length.
|
||||
*
|
||||
* Updates to the fields below are performed implicitly by calls to
|
||||
* these five functions:
|
||||
*
|
||||
* kstat_waitq_enter()
|
||||
* kstat_waitq_exit()
|
||||
* kstat_runq_enter()
|
||||
* kstat_runq_exit()
|
||||
*
|
||||
* kstat_waitq_to_runq() (see below)
|
||||
* kstat_runq_back_to_waitq() (see below)
|
||||
*
|
||||
* Since kstat_waitq_exit() is typically followed immediately
|
||||
* by kstat_runq_enter(), there is a single kstat_waitq_to_runq()
|
||||
* function which performs both operations. This is a performance
|
||||
* win since only one timestamp is required.
|
||||
*
|
||||
* In some instances, it may be necessary to move a request from
|
||||
* the run queue back to the wait queue, e.g. for write throttling.
|
||||
* For these situations, call kstat_runq_back_to_waitq().
|
||||
*
|
||||
* These fields should never be updated by any other means.
|
||||
*/
|
||||
|
||||
hrtime_t wtime; /* cumulative wait (pre-service) time */
|
||||
hrtime_t wlentime; /* cumulative wait length*time product */
|
||||
hrtime_t wlastupdate; /* last time wait queue changed */
|
||||
hrtime_t rtime; /* cumulative run (service) time */
|
||||
hrtime_t rlentime; /* cumulative run length*time product */
|
||||
hrtime_t rlastupdate; /* last time run queue changed */
|
||||
|
||||
uint_t wcnt; /* count of elements in wait state */
|
||||
uint_t rcnt; /* count of elements in run state */
|
||||
|
||||
} kstat_io_t;
|
||||
|
||||
#define KSTAT_IO_PTR(kptr) ((kstat_io_t *)(kptr)->ks_data)
|
||||
|
||||
/*
|
||||
* Event timer statistics - cumulative elapsed time and number of events.
|
||||
*
|
||||
* Updates to these fields are performed implicitly by calls to
|
||||
* kstat_timer_start() and kstat_timer_stop().
|
||||
*/
|
||||
|
||||
typedef struct kstat_timer {
|
||||
char name[KSTAT_STRLEN]; /* event name */
|
||||
uchar_t resv; /* reserved */
|
||||
u_longlong_t num_events; /* number of events */
|
||||
hrtime_t elapsed_time; /* cumulative elapsed time */
|
||||
hrtime_t min_time; /* shortest event duration */
|
||||
hrtime_t max_time; /* longest event duration */
|
||||
hrtime_t start_time; /* previous event start time */
|
||||
hrtime_t stop_time; /* previous event stop time */
|
||||
} kstat_timer_t;
|
||||
|
||||
#define KSTAT_TIMER_PTR(kptr) ((kstat_timer_t *)(kptr)->ks_data)
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
#include <sys/t_lock.h>
|
||||
|
||||
extern kid_t kstat_chain_id; /* bumped at each state change */
|
||||
extern void kstat_init(void); /* initialize kstat framework */
|
||||
|
||||
/*
|
||||
* Adding and deleting kstats.
|
||||
*
|
||||
* The typical sequence to add a kstat is:
|
||||
*
|
||||
* ksp = kstat_create(module, instance, name, class, type, ndata, flags);
|
||||
* if (ksp) {
|
||||
* ... provider initialization, if necessary
|
||||
* kstat_install(ksp);
|
||||
* }
|
||||
*
|
||||
* There are three logically distinct steps here:
|
||||
*
|
||||
* Step 1: System Initialization (kstat_create)
|
||||
*
|
||||
* kstat_create() performs system initialization. kstat_create()
|
||||
* allocates memory for the entire kstat (header plus data), initializes
|
||||
* all header fields, initializes the data section to all zeroes, assigns
|
||||
* a unique KID, and puts the kstat onto the system's kstat chain.
|
||||
* The returned kstat is marked invalid (KSTAT_FLAG_INVALID is set),
|
||||
* because the provider (caller) has not yet had a chance to initialize
|
||||
* the data section.
|
||||
*
|
||||
* By default, kstats are exported to all zones on the system. A kstat may be
|
||||
* created via kstat_create_zone() to specify a zone to which the statistics
|
||||
* should be exported. kstat_zone_add() may be used to specify additional
|
||||
* zones to which the statistics are to be exported.
|
||||
*
|
||||
* Step 2: Provider Initialization
|
||||
*
|
||||
* The provider performs any necessary initialization of the data section,
|
||||
* e.g. setting the name fields in a KSTAT_TYPE_NAMED. Virtual kstats set
|
||||
* the ks_data field at this time. The provider may also set the ks_update,
|
||||
* ks_snapshot, ks_private, and ks_lock fields if necessary.
|
||||
*
|
||||
* Step 3: Installation (kstat_install)
|
||||
*
|
||||
* Once the kstat is completely initialized, kstat_install() clears the
|
||||
* INVALID flag, thus making the kstat accessible to the outside world.
|
||||
* kstat_install() also clears the DORMANT flag for persistent kstats.
|
||||
*
|
||||
* Removing a kstat from the system
|
||||
*
|
||||
* kstat_delete(ksp) removes ksp from the kstat chain and frees all
|
||||
* associated system resources. NOTE: When you call kstat_delete(),
|
||||
* you must NOT be holding that kstat's ks_lock. Otherwise, you may
|
||||
* deadlock with a kstat reader.
|
||||
*
|
||||
* Persistent kstats
|
||||
*
|
||||
* From the provider's point of view, persistence is transparent. The only
|
||||
* difference between ephemeral (normal) kstats and persistent kstats
|
||||
* is that you pass KSTAT_FLAG_PERSISTENT to kstat_create(). Magically,
|
||||
* this has the effect of making your data visible even when you're
|
||||
* not home. Persistence is important to tools like iostat, which want
|
||||
* to get a meaningful picture of disk activity. Without persistence,
|
||||
* raw disk i/o statistics could never accumulate: they would come and
|
||||
* go with each open/close of the raw device.
|
||||
*
|
||||
* The magic of persistence works by slightly altering the behavior of
|
||||
* kstat_create() and kstat_delete(). The first call to kstat_create()
|
||||
* creates a new kstat, as usual. However, kstat_delete() does not
|
||||
* actually delete the kstat: it performs one final update of the data
|
||||
* (i.e., calls the ks_update routine), marks the kstat as dormant, and
|
||||
* sets the ks_lock, ks_update, ks_private, and ks_snapshot fields back
|
||||
* to their default values (since they might otherwise point to garbage,
|
||||
* e.g. if the provider is going away). kstat clients can still access
|
||||
* the dormant kstat just like a live kstat; they just continue to see
|
||||
* the final data values as long as the kstat remains dormant.
|
||||
* All subsequent kstat_create() calls simply find the already-existing,
|
||||
* dormant kstat and return a pointer to it, without altering any fields.
|
||||
* The provider then performs its usual initialization sequence, and
|
||||
* calls kstat_install(). kstat_install() uses the old data values to
|
||||
* initialize the native data (i.e., ks_update is called with KSTAT_WRITE),
|
||||
* thus making it seem like you were never gone.
|
||||
*/
|
||||
|
||||
extern kstat_t *kstat_create(const char *, int, const char *, const char *,
|
||||
uchar_t, uint_t, uchar_t);
|
||||
extern kstat_t *kstat_create_zone(const char *, int, const char *,
|
||||
const char *, uchar_t, uint_t, uchar_t, zoneid_t);
|
||||
extern void kstat_install(kstat_t *);
|
||||
extern void kstat_delete(kstat_t *);
|
||||
extern void kstat_named_setstr(kstat_named_t *knp, const char *src);
|
||||
extern void kstat_set_string(char *, const char *);
|
||||
extern void kstat_delete_byname(const char *, int, const char *);
|
||||
extern void kstat_delete_byname_zone(const char *, int, const char *, zoneid_t);
|
||||
extern void kstat_named_init(kstat_named_t *, const char *, uchar_t);
|
||||
extern void kstat_timer_init(kstat_timer_t *, const char *);
|
||||
extern void kstat_waitq_enter(kstat_io_t *);
|
||||
extern void kstat_waitq_exit(kstat_io_t *);
|
||||
extern void kstat_runq_enter(kstat_io_t *);
|
||||
extern void kstat_runq_exit(kstat_io_t *);
|
||||
extern void kstat_waitq_to_runq(kstat_io_t *);
|
||||
extern void kstat_runq_back_to_waitq(kstat_io_t *);
|
||||
extern void kstat_timer_start(kstat_timer_t *);
|
||||
extern void kstat_timer_stop(kstat_timer_t *);
|
||||
|
||||
extern void kstat_zone_add(kstat_t *, zoneid_t);
|
||||
extern void kstat_zone_remove(kstat_t *, zoneid_t);
|
||||
extern int kstat_zone_find(kstat_t *, zoneid_t);
|
||||
|
||||
extern kstat_t *kstat_hold_bykid(kid_t kid, zoneid_t);
|
||||
extern kstat_t *kstat_hold_byname(const char *, int, const char *, zoneid_t);
|
||||
extern void kstat_rele(kstat_t *);
|
||||
|
||||
#endif /* defined(_KERNEL) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_KSTAT_H */
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MNTENT_H
|
||||
#define _SYS_MNTENT_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MNTTAB "/proc/mounts"
|
||||
#define VFSTAB "/etc/vfstab"
|
||||
#define MNTMAXSTR 128
|
||||
|
||||
#define MNTTYPE_ZFS "zfs" /* ZFS file system */
|
||||
#define MNTTYPE_UFS "ufs" /* Unix file system */
|
||||
#define MNTTYPE_SMBFS "smbfs" /* SMBFS file system */
|
||||
#define MNTTYPE_NFS "nfs" /* NFS file system */
|
||||
#define MNTTYPE_NFS3 "nfs3" /* NFS Version 3 file system */
|
||||
#define MNTTYPE_NFS4 "nfs4" /* NFS Version 4 file system */
|
||||
#define MNTTYPE_CACHEFS "cachefs" /* Cache File System */
|
||||
#define MNTTYPE_PCFS "pcfs" /* PC (MSDOS) file system */
|
||||
#define MNTTYPE_PC MNTTYPE_PCFS /* Deprecated name; use MNTTYPE_PCFS */
|
||||
#define MNTTYPE_LOFS "lofs" /* Loop back file system */
|
||||
#define MNTTYPE_LO MNTTYPE_LOFS /* Deprecated name; use MNTTYPE_LOFS */
|
||||
#define MNTTYPE_HSFS "hsfs" /* High Sierra (9660) file system */
|
||||
#define MNTTYPE_SWAP "swap" /* Swap file system */
|
||||
#define MNTTYPE_TMPFS "tmpfs" /* Tmp volatile file system */
|
||||
#define MNTTYPE_AUTOFS "autofs" /* Automounter ``file'' system */
|
||||
#define MNTTYPE_MNTFS "mntfs" /* In-kernel mnttab */
|
||||
#define MNTTYPE_DEV "dev" /* /dev file system */
|
||||
#define MNTTYPE_CTFS "ctfs" /* Contract file system */
|
||||
#define MNTTYPE_OBJFS "objfs" /* Kernel object file system */
|
||||
#define MNTTYPE_SHAREFS "sharefs" /* Kernel sharetab file system */
|
||||
|
||||
|
||||
#define MNTOPT_RO "ro" /* Read only */
|
||||
#define MNTOPT_RW "rw" /* Read/write */
|
||||
#define MNTOPT_RQ "rq" /* Read/write with quotas */
|
||||
#define MNTOPT_QUOTA "quota" /* Check quotas */
|
||||
#define MNTOPT_NOQUOTA "noquota" /* Don't check quotas */
|
||||
#define MNTOPT_ONERROR "onerror" /* action to taken on error */
|
||||
#define MNTOPT_SOFT "soft" /* Soft mount */
|
||||
#define MNTOPT_SEMISOFT "semisoft" /* partial soft, uncommited interface */
|
||||
#define MNTOPT_HARD "hard" /* Hard mount */
|
||||
#define MNTOPT_SUID "suid" /* Both setuid and devices allowed */
|
||||
#define MNTOPT_NOSUID "nosuid" /* Neither setuid nor devices allowed */
|
||||
#define MNTOPT_DEVICES "devices" /* Device-special allowed */
|
||||
#define MNTOPT_NODEVICES "nodevices" /* Device-special disallowed */
|
||||
#define MNTOPT_SETUID "setuid" /* Set uid allowed */
|
||||
#define MNTOPT_NOSETUID "nosetuid" /* Set uid not allowed */
|
||||
#define MNTOPT_GRPID "grpid" /* SysV-compatible gid on create */
|
||||
#define MNTOPT_REMOUNT "remount" /* Change mount options */
|
||||
#define MNTOPT_NOSUB "nosub" /* Disallow mounts on subdirs */
|
||||
#define MNTOPT_MULTI "multi" /* Do multi-component lookup */
|
||||
#define MNTOPT_INTR "intr" /* Allow NFS ops to be interrupted */
|
||||
#define MNTOPT_NOINTR "nointr" /* Don't allow interrupted ops */
|
||||
#define MNTOPT_PORT "port" /* NFS server IP port number */
|
||||
#define MNTOPT_SECURE "secure" /* Secure (AUTH_DES) mounting */
|
||||
#define MNTOPT_RSIZE "rsize" /* Max NFS read size (bytes) */
|
||||
#define MNTOPT_WSIZE "wsize" /* Max NFS write size (bytes) */
|
||||
#define MNTOPT_TIMEO "timeo" /* NFS timeout (1/10 sec) */
|
||||
#define MNTOPT_RETRANS "retrans" /* Max retransmissions (soft mnts) */
|
||||
#define MNTOPT_ACTIMEO "actimeo" /* Attr cache timeout (sec) */
|
||||
#define MNTOPT_ACREGMIN "acregmin" /* Min attr cache timeout (files) */
|
||||
#define MNTOPT_ACREGMAX "acregmax" /* Max attr cache timeout (files) */
|
||||
#define MNTOPT_ACDIRMIN "acdirmin" /* Min attr cache timeout (dirs) */
|
||||
#define MNTOPT_ACDIRMAX "acdirmax" /* Max attr cache timeout (dirs) */
|
||||
#define MNTOPT_NOAC "noac" /* Don't cache attributes at all */
|
||||
#define MNTOPT_NOCTO "nocto" /* No close-to-open consistency */
|
||||
#define MNTOPT_BG "bg" /* Do mount retries in background */
|
||||
#define MNTOPT_FG "fg" /* Do mount retries in foreground */
|
||||
#define MNTOPT_RETRY "retry" /* Number of mount retries */
|
||||
#define MNTOPT_DEV "dev" /* Device id of mounted fs */
|
||||
#define MNTOPT_POSIX "posix" /* Get static pathconf for mount */
|
||||
#define MNTOPT_MAP "map" /* Automount map */
|
||||
#define MNTOPT_DIRECT "direct" /* Automount direct map mount */
|
||||
#define MNTOPT_INDIRECT "indirect" /* Automount indirect map mount */
|
||||
#define MNTOPT_LLOCK "llock" /* Local locking (no lock manager) */
|
||||
#define MNTOPT_IGNORE "ignore" /* Ignore this entry */
|
||||
#define MNTOPT_VERS "vers" /* protocol version number indicator */
|
||||
#define MNTOPT_PROTO "proto" /* protocol network_id indicator */
|
||||
#define MNTOPT_SEC "sec" /* Security flavor indicator */
|
||||
#define MNTOPT_SYNCDIR "syncdir" /* Synchronous local directory ops */
|
||||
#define MNTOPT_NOSETSEC "nosec" /* Do no allow setting sec attrs */
|
||||
#define MNTOPT_NOPRINT "noprint" /* Do not print messages */
|
||||
#define MNTOPT_LARGEFILES "largefiles" /* allow large files */
|
||||
#define MNTOPT_NOLARGEFILES "nolargefiles" /* don't allow large files */
|
||||
#define MNTOPT_FORCEDIRECTIO "forcedirectio" /* Force DirectIO on all files */
|
||||
#define MNTOPT_NOFORCEDIRECTIO "noforcedirectio" /* No Force DirectIO */
|
||||
#define MNTOPT_DISABLEDIRECTIO "disabledirectio" /* Disable DirectIO ioctls */
|
||||
#define MNTOPT_PUBLIC "public" /* Use NFS public file handlee */
|
||||
#define MNTOPT_LOGGING "logging" /* enable logging */
|
||||
#define MNTOPT_NOLOGGING "nologging" /* disable logging */
|
||||
#define MNTOPT_ATIME "atime" /* update atime for files */
|
||||
#define MNTOPT_NOATIME "noatime" /* do not update atime for files */
|
||||
#define MNTOPT_GLOBAL "global" /* Cluster-wide global mount */
|
||||
#define MNTOPT_NOGLOBAL "noglobal" /* Mount local to single node */
|
||||
#define MNTOPT_DFRATIME "dfratime" /* Deferred access time updates */
|
||||
#define MNTOPT_NODFRATIME "nodfratime" /* No Deferred access time updates */
|
||||
#define MNTOPT_NBMAND "nbmand" /* allow non-blocking mandatory locks */
|
||||
#define MNTOPT_NONBMAND "nonbmand" /* deny non-blocking mandatory locks */
|
||||
#define MNTOPT_XATTR "xattr" /* enable extended attributes */
|
||||
#define MNTOPT_NOXATTR "noxattr" /* disable extended attributes */
|
||||
#define MNTOPT_EXEC "exec" /* enable executables */
|
||||
#define MNTOPT_NOEXEC "noexec" /* disable executables */
|
||||
#define MNTOPT_RESTRICT "restrict" /* restricted autofs mount */
|
||||
#define MNTOPT_BROWSE "browse" /* browsable autofs mount */
|
||||
#define MNTOPT_NOBROWSE "nobrowse" /* non-browsable autofs mount */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_MNTENT_H */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T*/
|
||||
/* All Rights Reserved */
|
||||
/*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
/* Copyright 2006 Ricardo Correia */
|
||||
|
||||
#ifndef _SYS_MNTTAB_H
|
||||
#define _SYS_MNTTAB_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef MNTTAB
|
||||
#undef MNTTAB
|
||||
#endif
|
||||
|
||||
#define MNTTAB "/proc/mounts"
|
||||
#define MNT_LINE_MAX 1024
|
||||
|
||||
#define MNT_TOOLONG 1 /* entry exceeds MNT_LINE_MAX */
|
||||
#define MNT_TOOMANY 2 /* too many fields in line */
|
||||
#define MNT_TOOFEW 3 /* too few fields in line */
|
||||
|
||||
struct mnttab {
|
||||
char *mnt_special;
|
||||
char *mnt_mountp;
|
||||
char *mnt_fstype;
|
||||
char *mnt_mntopts;
|
||||
};
|
||||
|
||||
/*
|
||||
* NOTE: fields in extmnttab should match struct mnttab till new fields
|
||||
* are encountered, this allows hasmntopt to work properly when its arg is
|
||||
* a pointer to an extmnttab struct cast to a mnttab struct pointer.
|
||||
*/
|
||||
|
||||
struct extmnttab {
|
||||
char *mnt_special;
|
||||
char *mnt_mountp;
|
||||
char *mnt_fstype;
|
||||
char *mnt_mntopts;
|
||||
uint_t mnt_major;
|
||||
uint_t mnt_minor;
|
||||
};
|
||||
|
||||
extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
|
||||
extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
|
||||
extern int getextmntent(FILE *fp, struct extmnttab *mp, int len);
|
||||
|
||||
static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt)
|
||||
{
|
||||
struct mntent mnt_new;
|
||||
|
||||
mnt_new.mnt_opts = mnt->mnt_mntopts;
|
||||
|
||||
return hasmntopt(&mnt_new, opt);
|
||||
}
|
||||
|
||||
#define hasmntopt _sol_hasmntopt
|
||||
#define getmntent _sol_getmntent
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_MOUNT_H
|
||||
#define _SOL_SYS_MOUNT_H
|
||||
|
||||
#include_next <sys/mount.h>
|
||||
|
||||
#include <sys/mntent.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* LINUX */
|
||||
/*
|
||||
* Some old glibc headers don't define BLKGETSIZE64
|
||||
* and we don't want to require the kernel headers
|
||||
*/
|
||||
#if !defined(BLKGETSIZE64)
|
||||
#define BLKGETSIZE64 _IOR(0x12,114,size_t)
|
||||
#endif
|
||||
|
||||
#define MS_FORCE MNT_FORCE
|
||||
#define MS_OVERLAY 32768
|
||||
#define MS_NOMNTTAB 0 /* Not supported in Linux */
|
||||
#define MS_OPTIONSTR 0 /* Not necessary in Linux */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1994 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sys/note.h: interface for annotating source with info for tools
|
||||
*
|
||||
* This is the underlying interface; NOTE (/usr/include/note.h) is the
|
||||
* preferred interface, but all exported header files should include this
|
||||
* file directly and use _NOTE so as not to take "NOTE" from the user's
|
||||
* namespace. For consistency, *all* kernel source should use _NOTE.
|
||||
*
|
||||
* By default, annotations expand to nothing. This file implements
|
||||
* that. Tools using annotations will interpose a different version
|
||||
* of this file that will expand annotations as needed.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_NOTE_H
|
||||
#define _SYS_NOTE_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _NOTE
|
||||
#define _NOTE(s)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_NOTE_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_PARAM_H
|
||||
#define _SOL_SYS_PARAM_H
|
||||
|
||||
#include_next <sys/param.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* File system parameters and macros.
|
||||
*
|
||||
* The file system is made out of blocks of at most MAXBSIZE units,
|
||||
* with smaller units (fragments) only in the last direct block.
|
||||
* MAXBSIZE primarily determines the size of buffers in the buffer
|
||||
* pool. It may be made larger without any effect on existing
|
||||
* file systems; however making it smaller make make some file
|
||||
* systems unmountable.
|
||||
*
|
||||
* Note that the blocked devices are assumed to have DEV_BSIZE
|
||||
* "sectors" and that fragments must be some multiple of this size.
|
||||
*/
|
||||
#define MAXBSIZE 8192
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
|
||||
#define MAXNAMELEN 256
|
||||
#define MAXOFFSET_T 0x7fffffffffffffffl
|
||||
|
||||
#define UID_NOBODY 60001 /* user ID no body */
|
||||
#define GID_NOBODY UID_NOBODY
|
||||
#define UID_NOACCESS 60002 /* user ID no access */
|
||||
|
||||
#define MAXUID 2147483647 /* max user id */
|
||||
#define MAXPROJID MAXUID /* max project id */
|
||||
|
||||
#define PAGESIZE (sysconf(_SC_PAGESIZE))
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_PROCESSOR_H
|
||||
#define _SOL_SYS_PROCESSOR_H
|
||||
|
||||
#define getcpuid() (-1)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
#include <sys/kmem.h>
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_SDT_H
|
||||
#define _SOL_SYS_SDT_H
|
||||
|
||||
#define DTRACE_PROBE1(a,b,c) ((void) 0)
|
||||
#define DTRACE_PROBE2(a,b,c,d,e) ((void) 0)
|
||||
#define DTRACE_PROBE3(a,b,c,d,e,f,g) ((void) 0)
|
||||
#define DTRACE_PROBE4(a,b,c,d,e,f,g,h,i) ((void) 0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Ricardo Correia. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_STAT_H
|
||||
#define _SOL_STAT_H
|
||||
|
||||
#include_next <sys/stat.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* LINUX */
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
static inline int zfsfuse_fstat64(int fd, struct stat64 *buf)
|
||||
{
|
||||
if(fstat64(fd, buf) == -1)
|
||||
return -1;
|
||||
|
||||
if(S_ISBLK(buf->st_mode)) {
|
||||
/* LINUX */
|
||||
uint64_t size;
|
||||
if(real_ioctl(fd, BLKGETSIZE64, &size) != 0) {
|
||||
fprintf(stderr, "failed to read device size: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
buf->st_size = size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define fstat64(fd, buf) zfsfuse_fstat64(fd, buf)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SUNDDI_H
|
||||
#define _SOL_SUNDDI_H
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/u8_textprep.h>
|
||||
|
||||
static inline int
|
||||
ddi_strtoul(const char *hw_serial, char **nptr, int base, unsigned long *result)
|
||||
{
|
||||
char *end;
|
||||
|
||||
*result = strtoul(hw_serial, &end, base);
|
||||
if (*result == 0)
|
||||
return (errno);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DISTFILES = eventdefs.h
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSEVENT_EVENTDEFS_H
|
||||
#define _SYS_SYSEVENT_EVENTDEFS_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* eventdefs.h contains public definitions for sysevent types (classes
|
||||
* and subclasses). All additions/removal/changes are subject
|
||||
* to PSARC approval.
|
||||
*/
|
||||
|
||||
/* Sysevent Class definitions */
|
||||
#define EC_NONE "EC_none"
|
||||
#define EC_PRIV "EC_priv"
|
||||
#define EC_PLATFORM "EC_platform" /* events private to platform */
|
||||
#define EC_DR "EC_dr" /* Dynamic reconfiguration event class */
|
||||
#define EC_ENV "EC_env" /* Environmental monitor event class */
|
||||
#define EC_DOMAIN "EC_domain" /* Domain event class */
|
||||
#define EC_AP_DRIVER "EC_ap_driver" /* Alternate Pathing event class */
|
||||
#define EC_IPMP "EC_ipmp" /* IP Multipathing event class */
|
||||
#define EC_DEV_ADD "EC_dev_add" /* device add event class */
|
||||
#define EC_DEV_REMOVE "EC_dev_remove" /* device remove event class */
|
||||
#define EC_DEV_BRANCH "EC_dev_branch" /* device tree branch event class */
|
||||
#define EC_FM "EC_fm" /* FMA error report event */
|
||||
#define EC_ZFS "EC_zfs" /* ZFS event */
|
||||
|
||||
/*
|
||||
* The following event class is reserved for exclusive use
|
||||
* by Sun Cluster software.
|
||||
*/
|
||||
#define EC_CLUSTER "EC_Cluster"
|
||||
|
||||
/*
|
||||
* The following classes are exclusively reserved for use by the
|
||||
* Solaris Volume Manager (SVM)
|
||||
*/
|
||||
#define EC_SVM_CONFIG "EC_SVM_Config"
|
||||
#define EC_SVM_STATE "EC_SVM_State"
|
||||
|
||||
/*
|
||||
* EC_SVM_CONFIG subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/svm.h
|
||||
*/
|
||||
#define ESC_SVM_CREATE "ESC_SVM_Create"
|
||||
#define ESC_SVM_DELETE "ESC_SVM_Delete"
|
||||
#define ESC_SVM_ADD "ESC_SVM_Add"
|
||||
#define ESC_SVM_REMOVE "ESC_SVM_Remove"
|
||||
#define ESC_SVM_REPLACE "ESC_SVM_Replace"
|
||||
#define ESC_SVM_GROW "ESC_SVM_Grow"
|
||||
#define ESC_SVM_RENAME_SRC "ESC_SVM_Rename_Src"
|
||||
#define ESC_SVM_RENAME_DST "ESC_SVM_Rename_Dst"
|
||||
#define ESC_SVM_MEDIATOR_ADD "ESC_SVM_Mediator_Add"
|
||||
#define ESC_SVM_MEDIATOR_DELETE "ESC_SVM_Mediator_Delete"
|
||||
#define ESC_SVM_HOST_ADD "ESC_SVM_Host_Add"
|
||||
#define ESC_SVM_HOST_DELETE "ESC_SVM_Host_Delete"
|
||||
#define ESC_SVM_DRIVE_ADD "ESC_SVM_Drive_Add"
|
||||
#define ESC_SVM_DRIVE_DELETE "ESC_SVM_Drive_Delete"
|
||||
#define ESC_SVM_DETACH "ESC_SVM_Detach"
|
||||
#define ESC_SVM_DETACHING "ESC_SVM_Detaching"
|
||||
#define ESC_SVM_ATTACH "ESC_SVM_Attach"
|
||||
#define ESC_SVM_ATTACHING "ESC_SVM_Attaching"
|
||||
|
||||
/*
|
||||
* EC_SVM_STATE subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/svm.h
|
||||
*/
|
||||
#define ESC_SVM_INIT_START "ESC_SVM_Init_Start"
|
||||
#define ESC_SVM_INIT_FAILED "ESC_SVM_Init_Failed"
|
||||
#define ESC_SVM_INIT_FATAL "ESC_SVM_Init_Fatal"
|
||||
#define ESC_SVM_INIT_SUCCESS "ESC_SVM_Init_Success"
|
||||
#define ESC_SVM_IOERR "ESC_SVM_Ioerr"
|
||||
#define ESC_SVM_ERRED "ESC_SVM_Erred"
|
||||
#define ESC_SVM_LASTERRED "ESC_SVM_Lasterred"
|
||||
#define ESC_SVM_OK "ESC_SVM_Ok"
|
||||
#define ESC_SVM_ENABLE "ESC_SVM_Enable"
|
||||
#define ESC_SVM_RESYNC_START "ESC_SVM_Resync_Start"
|
||||
#define ESC_SVM_RESYNC_FAILED "ESC_SVM_Resync_Failed"
|
||||
#define ESC_SVM_RESYNC_SUCCESS "ESC_SVM_Resync_Success"
|
||||
#define ESC_SVM_RESYNC_DONE "ESC_SVM_Resync_Done"
|
||||
#define ESC_SVM_HOTSPARED "ESC_SVM_Hotspared"
|
||||
#define ESC_SVM_HS_FREED "ESC_SVM_HS_Freed"
|
||||
#define ESC_SVM_HS_CHANGED "ESC_SVM_HS_Changed"
|
||||
#define ESC_SVM_TAKEOVER "ESC_SVM_Takeover"
|
||||
#define ESC_SVM_RELEASE "ESC_SVM_Release"
|
||||
#define ESC_SVM_OPEN_FAIL "ESC_SVM_Open_Fail"
|
||||
#define ESC_SVM_OFFLINE "ESC_SVM_Offline"
|
||||
#define ESC_SVM_ONLINE "ESC_SVM_Online"
|
||||
#define ESC_SVM_CHANGE "ESC_SVM_Change"
|
||||
#define ESC_SVM_EXCHANGE "ESC_SVM_Exchange"
|
||||
#define ESC_SVM_REGEN_START "ESC_SVM_Regen_Start"
|
||||
#define ESC_SVM_REGEN_DONE "ESC_SVM_Regen_Done"
|
||||
#define ESC_SVM_REGEN_FAILED "ESC_SVM_Regen_Failed"
|
||||
|
||||
/*
|
||||
* EC_DR subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/dr.h
|
||||
*/
|
||||
|
||||
/* Attachment point state change */
|
||||
#define ESC_DR_AP_STATE_CHANGE "ESC_dr_ap_state_change"
|
||||
#define ESC_DR_REQ "ESC_dr_req" /* Request DR */
|
||||
#define ESC_DR_TARGET_STATE_CHANGE "ESC_dr_target_state_change"
|
||||
|
||||
/*
|
||||
* EC_ENV subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/env.h
|
||||
*/
|
||||
#define ESC_ENV_TEMP "ESC_env_temp" /* Temperature change event subclass */
|
||||
#define ESC_ENV_FAN "ESC_env_fan" /* Fan status change event subclass */
|
||||
#define ESC_ENV_POWER "ESC_env_power" /* Power supply change event subclass */
|
||||
#define ESC_ENV_LED "ESC_env_led" /* LED change event subclass */
|
||||
|
||||
/*
|
||||
* EC_DOMAIN subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/domain.h
|
||||
*/
|
||||
|
||||
/* Domain state change */
|
||||
#define ESC_DOMAIN_STATE_CHANGE "ESC_domain_state_change"
|
||||
/* Domain loghost name change */
|
||||
#define ESC_DOMAIN_LOGHOST_CHANGE "ESC_domain_loghost_change"
|
||||
|
||||
/*
|
||||
* EC_AP_DRIVER subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/ap_driver.h
|
||||
*/
|
||||
|
||||
/* Alternate Pathing path switch */
|
||||
#define ESC_AP_DRIVER_PATHSWITCH "ESC_ap_driver_pathswitch"
|
||||
/* Alternate Pathing database commit */
|
||||
#define ESC_AP_DRIVER_COMMIT "ESC_ap_driver_commit"
|
||||
/* Alternate Pathing physical path status change */
|
||||
#define ESC_AP_DRIVER_PHYS_PATH_STATUS_CHANGE \
|
||||
"ESC_ap_driver_phys_path_status_change"
|
||||
|
||||
/*
|
||||
* EC_IPMP subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/ipmp.h
|
||||
*/
|
||||
|
||||
/* IPMP group has changed state */
|
||||
#define ESC_IPMP_GROUP_STATE "ESC_ipmp_group_state"
|
||||
|
||||
/* IPMP group has been created or removed */
|
||||
#define ESC_IPMP_GROUP_CHANGE "ESC_ipmp_group_change"
|
||||
|
||||
/* IPMP group has had an interface added or removed */
|
||||
#define ESC_IPMP_GROUP_MEMBER_CHANGE "ESC_ipmp_group_member_change"
|
||||
|
||||
/* Interface within an IPMP group has changed state or type */
|
||||
#define ESC_IPMP_IF_CHANGE "ESC_ipmp_if_change"
|
||||
|
||||
|
||||
/*
|
||||
* EC_DEV_ADD and EC_DEV_REMOVE subclass definitions - supporting attributes
|
||||
* (name/value pairs) are found in sys/sysevent/dev.h
|
||||
*/
|
||||
#define ESC_DISK "disk" /* disk device */
|
||||
#define ESC_NETWORK "network" /* network interface */
|
||||
#define ESC_PRINTER "printer" /* printer device */
|
||||
#define ESC_LOFI "lofi" /* lofi device */
|
||||
|
||||
/*
|
||||
* EC_DEV_BRANCH subclass definitions - supporting attributes (name/value pairs)
|
||||
* are found in sys/sysevent/dev.h
|
||||
*/
|
||||
|
||||
/* device tree branch added */
|
||||
#define ESC_DEV_BRANCH_ADD "ESC_dev_branch_add"
|
||||
|
||||
/* device tree branch removed */
|
||||
#define ESC_DEV_BRANCH_REMOVE "ESC_dev_branch_remove"
|
||||
|
||||
/* FMA Fault and Error event protocol subclass */
|
||||
#define ESC_FM_ERROR "ESC_FM_error"
|
||||
#define ESC_FM_ERROR_REPLAY "ESC_FM_error_replay"
|
||||
|
||||
/* Service processor subclass definitions */
|
||||
#define ESC_PLATFORM_SP_RESET "ESC_platform_sp_reset"
|
||||
|
||||
/*
|
||||
* EC_ACPIEV subclass definitions
|
||||
*/
|
||||
#define EC_ACPIEV "EC_acpiev"
|
||||
#define ESC_ACPIEV_ADD "ESC_acpiev_add"
|
||||
#define ESC_ACPIEV_REMOVE "ESC_acpiev_remove"
|
||||
#define ESC_ACPIEV_WARN "ESC_acpiev_warn"
|
||||
#define ESC_ACPIEV_LOW "ESC_acpiev_low"
|
||||
#define ESC_ACPIEV_STATE_CHANGE "ESC_acpiev_state_change"
|
||||
|
||||
/*
|
||||
* ZFS subclass definitions. supporting attributes (name/value paris) are found
|
||||
* in sys/fs/zfs.h
|
||||
*/
|
||||
#define ESC_ZFS_RESILVER_START "ESC_ZFS_resilver_start"
|
||||
#define ESC_ZFS_RESILVER_FINISH "ESC_ZFS_resilver_finish"
|
||||
#define ESC_ZFS_VDEV_REMOVE "ESC_ZFS_vdev_remove"
|
||||
#define ESC_ZFS_POOL_DESTROY "ESC_ZFS_pool_destroy"
|
||||
#define ESC_ZFS_VDEV_CLEAR "ESC_ZFS_vdev_clear"
|
||||
#define ESC_ZFS_VDEV_CHECK "ESC_ZFS_vdev_check"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_SYSEVENT_EVENTDEFS_H */
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_SYSMACROS_H
|
||||
#define _SOL_SYS_SYSMACROS_H
|
||||
|
||||
#include_next <sys/sysmacros.h>
|
||||
|
||||
#define makedevice(maj,min) makedev(maj,min)
|
||||
|
||||
/* common macros */
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
#ifndef ABS
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compatibility macros/typedefs needed for Solaris -> Linux port
|
||||
*/
|
||||
#define P2ALIGN(x, align) ((x) & -(align))
|
||||
#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
|
||||
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
(-(-(type)(x) & -(type)(align)))
|
||||
#define P2PHASE(x, align) ((x) & ((align) - 1))
|
||||
#define P2NPHASE(x, align) (-(x) & ((align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
(-(type)(x) & ((type)(align) - 1))
|
||||
#define ISP2(x) (((x) & ((x) - 1)) == 0)
|
||||
#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
|
||||
|
||||
/*
|
||||
* Typed version of the P2* macros. These macros should be used to ensure
|
||||
* that the result is correctly calculated based on the data type of (x),
|
||||
* which is passed in as the last argument, regardless of the data
|
||||
* type of the alignment. For example, if (x) is of type uint64_t,
|
||||
* and we want to round it up to a page boundary using "PAGESIZE" as
|
||||
* the alignment, we can do either
|
||||
* P2ROUNDUP(x, (uint64_t)PAGESIZE)
|
||||
* or
|
||||
* P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
|
||||
*/
|
||||
#define P2ALIGN_TYPED(x, align, type) \
|
||||
((type)(x) & -(type)(align))
|
||||
#define P2PHASE_TYPED(x, align, type) \
|
||||
((type)(x) & ((type)(align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
(-(type)(x) & ((type)(align) - 1))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
(-(-(type)(x) & -(type)(align)))
|
||||
#define P2END_TYPED(x, align, type) \
|
||||
(-(~(type)(x) & -(type)(align)))
|
||||
#define P2PHASEUP_TYPED(x, align, phase, type) \
|
||||
((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
|
||||
#define P2CROSS_TYPED(x, y, align, type) \
|
||||
(((type)(x) ^ (type)(y)) > (type)(align) - 1)
|
||||
#define P2SAMEHIGHBIT_TYPED(x, y, type) \
|
||||
(((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
|
||||
|
||||
#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof)
|
||||
|
||||
/* avoid any possibility of clashing with <stddef.h> version */
|
||||
|
||||
#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_TIME_H
|
||||
#define _SOL_SYS_TIME_H
|
||||
|
||||
#include_next <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
typedef longlong_t hrtime_t;
|
||||
typedef struct timespec timestruc_t;
|
||||
|
||||
static inline hrtime_t gethrtime(void) {
|
||||
struct timespec ts;
|
||||
|
||||
if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
|
||||
fprintf(stderr, "Error: clock_gettime(CLOCK_MONOTONIC) failed\n");
|
||||
fprintf(stderr, "Make sure you are are running kernel 2.6.x and have glibc 2.3.3 or newer installed\n");
|
||||
fprintf(stderr, "Aborting...\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
return (((u_int64_t)ts.tv_sec) * NANOSEC) + ts.tv_nsec;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_TYPES_H
|
||||
#define _SOL_SYS_TYPES_H
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/feature_tests.h>
|
||||
#include_next <sys/types.h>
|
||||
#include <sys/param.h> /* for NBBY */
|
||||
#include <sys/types32.h>
|
||||
|
||||
typedef longlong_t offset_t;
|
||||
typedef u_longlong_t u_offset_t;
|
||||
typedef u_longlong_t len_t;
|
||||
typedef longlong_t diskaddr_t;
|
||||
|
||||
typedef short pri_t;
|
||||
|
||||
typedef int zoneid_t;
|
||||
typedef int projid_t;
|
||||
|
||||
typedef int major_t;
|
||||
typedef int minor_t;
|
||||
|
||||
typedef ushort_t o_mode_t; /* old file attribute type */
|
||||
|
||||
/*
|
||||
* Definitions remaining from previous partial support for 64-bit file
|
||||
* offsets. This partial support for devices greater than 2gb requires
|
||||
* compiler support for long long.
|
||||
*/
|
||||
#ifdef _LONG_LONG_LTOH
|
||||
typedef union {
|
||||
offset_t _f; /* Full 64 bit offset value */
|
||||
struct {
|
||||
int32_t _l; /* lower 32 bits of offset value */
|
||||
int32_t _u; /* upper 32 bits of offset value */
|
||||
} _p;
|
||||
} lloff_t;
|
||||
#endif
|
||||
|
||||
#ifdef _LONG_LONG_HTOL
|
||||
typedef union {
|
||||
offset_t _f; /* Full 64 bit offset value */
|
||||
struct {
|
||||
int32_t _u; /* upper 32 bits of offset value */
|
||||
int32_t _l; /* lower 32 bits of offset value */
|
||||
} _p;
|
||||
} lloff_t;
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TYPES32_H
|
||||
#define _SYS_TYPES32_H
|
||||
|
||||
|
||||
|
||||
#include <sys/int_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interoperability types for programs. Used for:
|
||||
*
|
||||
* Crossing between 32-bit and 64-bit domains.
|
||||
*
|
||||
* On disk data formats such as filesystem meta data
|
||||
* and disk label.
|
||||
*
|
||||
* Note: Applications should never include this
|
||||
* header file.
|
||||
*/
|
||||
typedef uint32_t caddr32_t;
|
||||
typedef int32_t daddr32_t;
|
||||
typedef int32_t off32_t;
|
||||
typedef uint32_t ino32_t;
|
||||
typedef int32_t blkcnt32_t;
|
||||
typedef uint32_t fsblkcnt32_t;
|
||||
typedef uint32_t fsfilcnt32_t;
|
||||
typedef int32_t id32_t;
|
||||
typedef uint32_t major32_t;
|
||||
typedef uint32_t minor32_t;
|
||||
typedef int32_t key32_t;
|
||||
typedef uint32_t mode32_t;
|
||||
typedef uint32_t uid32_t;
|
||||
typedef uint32_t gid32_t;
|
||||
typedef uint32_t nlink32_t;
|
||||
typedef uint32_t dev32_t;
|
||||
typedef int32_t pid32_t;
|
||||
typedef uint32_t size32_t;
|
||||
typedef int32_t ssize32_t;
|
||||
typedef int32_t time32_t;
|
||||
typedef int32_t clock32_t;
|
||||
|
||||
struct timeval32 {
|
||||
time32_t tv_sec; /* seconds */
|
||||
int32_t tv_usec; /* and microseconds */
|
||||
};
|
||||
|
||||
typedef struct timespec32 {
|
||||
time32_t tv_sec; /* seconds */
|
||||
int32_t tv_nsec; /* and nanoseconds */
|
||||
} timespec32_t;
|
||||
|
||||
typedef struct timespec32 timestruc32_t;
|
||||
|
||||
typedef struct itimerspec32 {
|
||||
struct timespec32 it_interval;
|
||||
struct timespec32 it_value;
|
||||
} itimerspec32_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_TYPES32_H */
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/*
|
||||
* University Copyright- Copyright (c) 1982, 1986, 1988
|
||||
* The Regents of the University of California
|
||||
* All Rights Reserved
|
||||
*
|
||||
* University Acknowledgment- Portions of this document are derived from
|
||||
* software developed by the University of California, Berkeley, and its
|
||||
* contributors.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_UIO_H
|
||||
#define _SOL_SYS_UIO_H
|
||||
|
||||
/* struct iovec is defined in glibc's sys/uio.h */
|
||||
#include_next <sys/uio.h>
|
||||
|
||||
typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t;
|
||||
|
||||
#define UIO_SYSSPACE 1
|
||||
|
||||
#endif /* _SYS_UIO_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_UTSNAME_H
|
||||
#define _SOL_UTSNAME_H
|
||||
|
||||
#include_next <sys/utsname.h>
|
||||
|
||||
struct utsname utsname;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_UUID_H
|
||||
#define _SYS_UUID_H
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The copyright in this file is taken from the original Leach
|
||||
* & Salz UUID specification, from which this implementation
|
||||
* is derived.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||
* Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
|
||||
* Digital Equipment Corporation, Maynard, Mass. Copyright (c) 1998
|
||||
* Microsoft. To anyone who acknowledges that this file is provided
|
||||
* "AS IS" without any express or implied warranty: permission to use,
|
||||
* copy, modify, and distribute this file for any purpose is hereby
|
||||
* granted without fee, provided that the above copyright notices and
|
||||
* this notice appears in all source code copies, and that none of the
|
||||
* names of Open Software Foundation, Inc., Hewlett-Packard Company,
|
||||
* or Digital Equipment Corporation be used in advertising or
|
||||
* publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Neither Open Software
|
||||
* Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
|
||||
* Equipment Corporation makes any representations about the
|
||||
* suitability of this software for any purpose.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t nodeID[6];
|
||||
} uuid_node_t;
|
||||
|
||||
/*
|
||||
* The uuid type used throughout when referencing uuids themselves
|
||||
*/
|
||||
struct uuid {
|
||||
uint32_t time_low;
|
||||
uint16_t time_mid;
|
||||
uint16_t time_hi_and_version;
|
||||
uint8_t clock_seq_hi_and_reserved;
|
||||
uint8_t clock_seq_low;
|
||||
uint8_t node_addr[6];
|
||||
};
|
||||
|
||||
#define UUID_LEN 16
|
||||
|
||||
#define UUID_PRINTABLE_STRING_LENGTH 37
|
||||
|
||||
typedef uchar_t uuid_t[UUID_LEN];
|
||||
|
||||
/*
|
||||
* Convert a uuid to/from little-endian format
|
||||
*/
|
||||
#define UUID_LE_CONVERT(dest, src) \
|
||||
{ \
|
||||
(dest) = (src); \
|
||||
(dest).time_low = LE_32((dest).time_low); \
|
||||
(dest).time_mid = LE_16((dest).time_mid); \
|
||||
(dest).time_hi_and_version = LE_16((dest).time_hi_and_version); \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_UUID_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VA_LIST_H
|
||||
#define _SYS_VA_LIST_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VMEM_H
|
||||
#define _SYS_VMEM_H
|
||||
|
||||
/* vmem_t is necessary in the declaration but it's not used in the dummy implementation */
|
||||
struct vmem;
|
||||
typedef struct vmem vmem_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 1997-1998,2002 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
|
||||
#ifndef _SYS_VTOC_H
|
||||
#define _SYS_VTOC_H
|
||||
|
||||
|
||||
|
||||
#include <sys/dklabel.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note: the VTOC is not implemented fully, nor in the manner
|
||||
* that AT&T implements it. AT&T puts the vtoc structure
|
||||
* into a sector, usually the second sector (pdsector is first).
|
||||
*
|
||||
* Sun incorporates the tag, flag, version, and volume vtoc fields into
|
||||
* its Disk Label, which already has some vtoc-equivalent fields.
|
||||
* Upon reading the vtoc with read_vtoc(), the following exceptions
|
||||
* occur:
|
||||
* v_bootinfo [all] returned as zero
|
||||
* v_sanity returned as VTOC_SANE
|
||||
* if Disk Label was sane
|
||||
* v_sectorsz returned as 512
|
||||
* v_reserved [all] retunred as zero
|
||||
* timestamp [all] returned as zero
|
||||
*
|
||||
* See dklabel.h, read_vtoc(), and write_vtoc().
|
||||
*/
|
||||
|
||||
#define V_NUMPAR NDKMAP /* The number of partitions */
|
||||
/* (from dkio.h) */
|
||||
|
||||
#define VTOC_SANE 0x600DDEEE /* Indicates a sane VTOC */
|
||||
#define V_VERSION 0x01 /* layout version number */
|
||||
|
||||
/*
|
||||
* Partition identification tags
|
||||
*/
|
||||
#define V_UNASSIGNED 0x00 /* unassigned partition */
|
||||
#define V_BOOT 0x01 /* Boot partition */
|
||||
#define V_ROOT 0x02 /* Root filesystem */
|
||||
#define V_SWAP 0x03 /* Swap filesystem */
|
||||
#define V_USR 0x04 /* Usr filesystem */
|
||||
#define V_BACKUP 0x05 /* full disk */
|
||||
#define V_STAND 0x06 /* Stand partition */
|
||||
#define V_VAR 0x07 /* Var partition */
|
||||
#define V_HOME 0x08 /* Home partition */
|
||||
#define V_ALTSCTR 0x09 /* Alternate sector partition */
|
||||
#define V_CACHE 0x0a /* Cache (cachefs) partition */
|
||||
#define V_RESERVED 0x0b /* SMI reserved data */
|
||||
|
||||
/*
|
||||
* Partition permission flags
|
||||
*/
|
||||
#define V_UNMNT 0x01 /* Unmountable partition */
|
||||
#define V_RONLY 0x10 /* Read only */
|
||||
|
||||
/*
|
||||
* error codes for reading & writing vtoc
|
||||
*/
|
||||
#define VT_ERROR (-2) /* errno supplies specific error */
|
||||
#define VT_EIO (-3) /* I/O error accessing vtoc */
|
||||
#define VT_EINVAL (-4) /* illegal value in vtoc or request */
|
||||
#define VT_ENOTSUP (-5) /* VTOC op. not supported */
|
||||
|
||||
struct partition {
|
||||
ushort_t p_tag; /* ID tag of partition */
|
||||
ushort_t p_flag; /* permision flags */
|
||||
daddr_t p_start; /* start sector no of partition */
|
||||
long p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
struct vtoc {
|
||||
unsigned long v_bootinfo[3]; /* info needed by mboot (unsupported) */
|
||||
unsigned long v_sanity; /* to verify vtoc sanity */
|
||||
unsigned long v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
ushort_t v_sectorsz; /* sector size in bytes */
|
||||
ushort_t v_nparts; /* number of partitions */
|
||||
unsigned long v_reserved[10]; /* free space */
|
||||
struct partition v_part[V_NUMPAR]; /* partition headers */
|
||||
time_t timestamp[V_NUMPAR]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
};
|
||||
|
||||
#if defined(_SYSCALL32)
|
||||
struct partition32 {
|
||||
uint16_t p_tag; /* ID tag of partition */
|
||||
uint16_t p_flag; /* permision flags */
|
||||
daddr32_t p_start; /* start sector no of partition */
|
||||
int32_t p_size; /* # of blocks in partition */
|
||||
};
|
||||
|
||||
struct vtoc32 {
|
||||
uint32_t v_bootinfo[3]; /* info needed by mboot (unsupported) */
|
||||
uint32_t v_sanity; /* to verify vtoc sanity */
|
||||
uint32_t v_version; /* layout version */
|
||||
char v_volume[LEN_DKL_VVOL]; /* volume name */
|
||||
uint16_t v_sectorsz; /* sector size in bytes */
|
||||
uint16_t v_nparts; /* number of partitions */
|
||||
uint32_t v_reserved[10]; /* free space */
|
||||
struct partition32 v_part[V_NUMPAR]; /* partition headers */
|
||||
time32_t timestamp[V_NUMPAR]; /* partition timestamp (unsupported) */
|
||||
char v_asciilabel[LEN_DKL_ASCII]; /* for compatibility */
|
||||
};
|
||||
|
||||
#define vtoc32tovtoc(v32, v) \
|
||||
{ \
|
||||
int i; \
|
||||
v.v_bootinfo[0] = v32.v_bootinfo[0]; \
|
||||
v.v_bootinfo[1] = v32.v_bootinfo[1]; \
|
||||
v.v_bootinfo[2] = v32.v_bootinfo[2]; \
|
||||
v.v_sanity = v32.v_sanity; \
|
||||
v.v_version = v32.v_version; \
|
||||
bcopy(v32.v_volume, v.v_volume, LEN_DKL_VVOL); \
|
||||
v.v_sectorsz = v32.v_sectorsz; \
|
||||
v.v_nparts = v32.v_nparts; \
|
||||
v.v_version = v32.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v.v_reserved[i] = v32.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v.v_part[i].p_tag = (ushort_t)v32.v_part[i].p_tag; \
|
||||
v.v_part[i].p_flag = (ushort_t)v32.v_part[i].p_flag; \
|
||||
v.v_part[i].p_start = (daddr_t)v32.v_part[i].p_start; \
|
||||
v.v_part[i].p_size = (long)v32.v_part[i].p_size; \
|
||||
} \
|
||||
for (i = 0; i < V_NUMPAR; i++) \
|
||||
v.timestamp[i] = (time_t)v32.timestamp[i]; \
|
||||
bcopy(v32.v_asciilabel, v.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
#define vtoctovtoc32(v, v32) \
|
||||
{ \
|
||||
int i; \
|
||||
v32.v_bootinfo[0] = v.v_bootinfo[0]; \
|
||||
v32.v_bootinfo[1] = v.v_bootinfo[1]; \
|
||||
v32.v_bootinfo[2] = v.v_bootinfo[2]; \
|
||||
v32.v_sanity = v.v_sanity; \
|
||||
v32.v_version = v.v_version; \
|
||||
bcopy(v.v_volume, v32.v_volume, LEN_DKL_VVOL); \
|
||||
v32.v_sectorsz = v.v_sectorsz; \
|
||||
v32.v_nparts = v.v_nparts; \
|
||||
v32.v_version = v.v_version; \
|
||||
for (i = 0; i < 10; i++) \
|
||||
v32.v_reserved[i] = v.v_reserved[i]; \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
v32.v_part[i].p_tag = (ushort_t)v.v_part[i].p_tag; \
|
||||
v32.v_part[i].p_flag = (ushort_t)v.v_part[i].p_flag; \
|
||||
v32.v_part[i].p_start = (daddr32_t)v.v_part[i].p_start; \
|
||||
v32.v_part[i].p_size = (int32_t)v.v_part[i].p_size; \
|
||||
} \
|
||||
for (i = 0; i < V_NUMPAR; i++) { \
|
||||
if (v.timestamp[i] > TIME32_MAX) \
|
||||
v32.timestamp[i] = TIME32_MAX; \
|
||||
else \
|
||||
v32.timestamp[i] = (time32_t)v.timestamp[i]; \
|
||||
} \
|
||||
bcopy(v.v_asciilabel, v32.v_asciilabel, LEN_DKL_ASCII); \
|
||||
}
|
||||
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* These defines are the mode parameter for the checksum routines.
|
||||
*/
|
||||
#define CK_CHECKSUM 0 /* check checksum */
|
||||
#define CK_MAKESUM 1 /* generate checksum */
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
||||
extern int read_vtoc(int, struct vtoc *);
|
||||
extern int write_vtoc(int, struct vtoc *);
|
||||
|
||||
#else
|
||||
|
||||
extern int read_vtoc();
|
||||
extern int write_vtoc();
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_VTOC_H */
|
||||
@@ -0,0 +1 @@
|
||||
DISTFILES = label.h
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SOL_UCRED_H
|
||||
#define _SOL_UCRED_H
|
||||
|
||||
typedef int ucred_t;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _ZONE_H
|
||||
#define _ZONE_H
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/zone.h>
|
||||
#include <sys/priv.h>
|
||||
#include <tsol/label.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GLOBAL_ZONEID 0
|
||||
#define GLOBAL_ZONEID_NAME "global"
|
||||
|
||||
/*
|
||||
* Functions for mapping between id and name for active zones.
|
||||
*/
|
||||
extern zoneid_t getzoneid(void);
|
||||
extern zoneid_t getzoneidbyname(const char *);
|
||||
extern ssize_t getzonenamebyid(zoneid_t, char *, size_t);
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* NOTE
|
||||
*
|
||||
* The remaining contents of this file are private to the implementation
|
||||
* of Solaris and are subject to change at any time without notice,
|
||||
* Applications using these interfaces may fail to run on future releases.
|
||||
*/
|
||||
|
||||
extern int zonept(int, zoneid_t);
|
||||
extern int zone_get_id(const char *, zoneid_t *);
|
||||
|
||||
/* System call API */
|
||||
extern zoneid_t zone_create(const char *, const char *,
|
||||
const struct priv_set *, const char *, size_t, const char *, size_t, int *,
|
||||
int, int, const bslabel_t *, int);
|
||||
extern int zone_boot(zoneid_t);
|
||||
extern int zone_destroy(zoneid_t);
|
||||
extern ssize_t zone_getattr(zoneid_t, int, void *, size_t);
|
||||
extern int zone_setattr(zoneid_t, int, void *, size_t);
|
||||
extern int zone_enter(zoneid_t);
|
||||
extern int zone_list(zoneid_t *, uint_t *);
|
||||
extern int zone_shutdown(zoneid_t);
|
||||
extern int zone_version(int *);
|
||||
extern int zone_add_datalink(zoneid_t, char *);
|
||||
extern int zone_remove_datalink(zoneid_t, char *);
|
||||
extern int zone_check_datalink(zoneid_t *, char *);
|
||||
extern int zone_list_datalink(zoneid_t, int *, char *);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ZONE_H */
|
||||
Reference in New Issue
Block a user