devinfo_impl.h revision b9ccdc5a0f0a722ae408b257a831b90011369316
/*
* 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
* 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_DEVINFO_IMPL_H
#define _SYS_DEVINFO_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file is separate from libdevinfo.h because the devinfo driver
* needs to know about the stuff. Library consumer should not care
* about stuff defined here.
*
* The only exception is di_priv_data (consolidation private) and
* DINFO* ioctls.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* ioctl commands for devinfo driver */
#define DIIOC_MASK (0xffff00ff)
/*
* Any combination of the following ORed together will take a snapshot
* of the device configuration data.
*/
/* private bits */
/* new public flag for the layered drivers framework */
/*
* Straight ioctl commands, not bitwise operation
*/
/*
* ioctl for taking a snapshot a single node and all nodes
*/
#define DINFOCPYONE DIIOC
/* driver ops encoding */
#define DI_BUS_OPS 0x1
#define DI_CB_OPS 0x2
#define DI_STREAM_OPS 0x4
/* property list enumeration */
#define DI_PROP_DRV_LIST 0
#define DI_PROP_SYS_LIST 1
#define DI_PROP_GLB_LIST 2
#define DI_PROP_HW_LIST 3
/* misc parameters */
#define MAX_TREE_DEPTH 64
#define MAX_PTR_IN_PRV 5
#define DI_SNAPSHOT_VERSION_0 0 /* reserved */
#define DI_BIG_ENDIAN 0 /* reserved */
#define DI_CACHE_PERMS (0444)
#define DI_CACHE_SNAPSHOT_FLAGS \
/*
* multipath component definitions: Follows the registered component of
* the mpxio system.
*/
#define MULTIPATH_COMPONENT_NONE 0
#define MULTIPATH_COMPONENT_VHCI 0x1
#define MULTIPATH_COMPONENT_PHCI 0x2
#define MULTIPATH_COMPONENT_CLIENT 0x4
/*
* devinfo driver snapshot data structure
*/
struct di_all {
int version; /* snapshot version, reserved */
int cache_magic; /* magic number for cached snapshot */
int pd_version; /* private data format version */
int endianness; /* reserved for future use */
int generation; /* reserved for future use */
int n_ppdata; /* size of ppdata_format array */
int n_dpdata; /* size of pddata_format array */
int devcnt; /* size of devnames array */
};
struct di_devnm {
int flags; /* driver attachment info */
int instance; /* next instance to assign */
};
struct di_lnode;
struct di_link {
int count;
int spec_type; /* block or char access type */
};
struct di_lnode {
/*
* public information describing a link endpoint
*/
/*
* di_link ptr to links comming into this node
* (this lnode is the target of these di_links)
*/
/*
* di_link ptr to links going out of this node
* (this lnode is the source of these di_links)
*/
/*
* di_lnode pointer to the next lnode associated with the
* same di_node
*/
};
struct di_node { /* useful info to export for each tree node */
/*
* offset to di_node structures
*/
/*
* offset to char strings of current node
*/
/*
* offset to property lists, private data, etc.
*/
/*
* misc values
*/
int compat_length; /* size of compatible name list */
int drv_major; /* for indexing into devnames array */
/*
* value attributes of current node
*/
int instance; /* instance number */
int nodeid; /* node id */
int attributes; /* node attributes */
/*
*/
/*
* devi_flags field
*/
};
/*
* chain of ddi_minor_data structure
*/
struct di_minor {
int spec_type; /* block or char */
unsigned int mdclass; /* no longer used, may be removed */
};
typedef enum {
/*
* multipathing information structures
*/
struct di_path {
int path_instance; /* path instance */
};
/*
* Flags for snap_state
*/
/*
* path properties
*/
struct di_path_prop {
int prop_type; /* property data type */
int prop_len; /* prop length in bytes */
};
/*
* Now the properties.
*/
struct di_prop {
int prop_flags; /* mark prop value types & more */
int prop_len; /* prop len in bytes (boolean if 0) */
int prop_list; /* which list (DI_PROP_SYS_LIST), etc */
};
/*
* Private data stuff for supporting prtconf.
* Allows one level of indirection of fixed sized obj or obj array.
* The array size may be an int member of the array.
*/
struct di_priv_format {
struct { /* ptrs to dereference */
int size; /* size of object assoc. this ptr */
int offset; /* location of pointer within struct */
int len_offset; /* offset to var. containing the len */
} ptr[MAX_PTR_IN_PRV];
};
struct di_priv_data {
int version;
int n_parent;
int n_driver;
struct di_priv_format *parent;
struct di_priv_format *driver;
};
/*
* structure passed in from ioctl
*/
struct dinfo_io {
char root_path[MAXPATHLEN];
struct di_priv_data priv;
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DEVINFO_IMPL_H */