fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _SV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Storage Volume Character and Block Driver (SV)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Public header file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SPARC case 1998/036.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PSARC case 1999/023.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SV_MAXPATH NSC_MAXPATH
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SV_DEVICE "/dev/sv"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ioctl structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_name_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char svn_path[SV_MAXPATH]; /* path to underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t svn_timestamp; /* timestamp of successful enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svn_nblocks; /* size of device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svn_mode; /* NSC_DEVICE | NSC_CACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_name_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_name32_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char svn_path[SV_MAXPATH]; /* path to underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svn_timestamp; /* timestamp of successful enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svn_nblocks; /* size of device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svn_mode; /* NSC_DEVICE | NSC_CACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_name32_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_list_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t svl_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t svl_timestamp; /* time of successful {en,dis}able */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svl_count; /* Count of elements in svl_names */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svl_maxdevs; /* Max # of devices that can be used */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sv_name_t *svl_names; /* pointer to names array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_list_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_list32_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info32_t svl_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svl_timestamp; /* time of successful {en,dis}able */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svl_count; /* Count of elements in svl_names */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svl_maxdevs; /* Max # of devices that can be used */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t svl_names; /* pointer to names array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_list32_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_conf_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t svc_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char svc_path[SV_MAXPATH]; /* path to underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svc_flag; /* NSC_DEVICE | NSC_CACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte major_t svc_major; /* major_t of underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte minor_t svc_minor; /* minor_t of underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_conf_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_conf32_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info32_t svc_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char svc_path[SV_MAXPATH]; /* path to underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svc_flag; /* NSC_DEVICE | NSC_CACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte major_t svc_major; /* major_t of underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte minor_t svc_minor; /* minor_t of underlying raw device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_conf32_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_version_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t svv_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svv_major_rev; /* Major revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svv_minor_rev; /* Minor revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svv_micro_rev; /* Micro revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int svv_baseline_rev; /* Baseline revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_version_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_version32_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info32_t svv_error; /* Error information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svv_major_rev; /* Major revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svv_minor_rev; /* Minor revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svv_micro_rev; /* Micro revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t svv_baseline_rev; /* Baseline revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_version32_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SV guard devices.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sv_guard_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sg_magic; /* Magic # */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sg_version; /* Version # */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *sg_pathname; /* Pathname of device to guard */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *sg_module; /* Module name of client */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int sg_kernel; /* Prevent user access if true */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t sg_error; /* Error to be returned to client */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sv_guard_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SV_SG_MAGIC 0x47554152
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SV_SG_VERSION 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ioctl numbers.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define __SV__(x) (('S'<<16)|('V'<<8)|(x))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVIOC_ENABLE __SV__(1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVIOC_DISABLE __SV__(2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVIOC_LIST __SV__(3)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVIOC_VERSION __SV__(4)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVIOC_UNLOAD __SV__(5)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * seconds to wait before unload, to drain lingering IOs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SV_WAIT_UNLOAD 10
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SV_H */