/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_SUNLDI_IMPL_H
#define _SYS_SUNLDI_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/dditypes.h>
/*
* NOTE
*
* The contents of this file are private to this implementation
* of Solaris and are subject to change at any time without notice.
*
* Applications and drivers using these interfaces will fail
* to run on future releases.
*/
/*
* LDI hash definitions
*/
/*
* Obsolete LDI event interfaces are available for now but are deprecated and a
* warning will be issued to consumers.
*/
/*
* Flag for LDI handle's lh_flags field
*/
/*
* LDI initialization function
*/
void ldi_init(void);
/*
* LDI streams linking interfaces
*/
/*
* LDI module identifier
*/
struct ldi_ident {
/* protected by ldi_ident_hash_lock */
};
/*
* LDI handle
*/
struct ldi_handle {
/* protected by ldi_handle_hash_lock */
#ifdef LDI_OBSOLETE_EVENT
/* fields protected by lh_lock */
#endif
};
/*
* LDI event information
*/
#ifdef LDI_OBSOLETE_EVENT
typedef struct ldi_event {
/* fields protected by le_lhp->lh_lock */
void (*le_handler)();
void *le_arg;
} ldi_event_t;
#endif
typedef struct ldi_ev_callback_impl {
int lec_spec;
int (*lec_notify)();
void (*lec_finalize)();
void *lec_arg;
void *lec_cookie;
void *lec_id;
/*
* Members of "struct ldi_ev_callback_list" are protected by their le_lock
* member. The struct is currently only used once, as a file-level global,
* and the locking protocol is currently implemented in ldi_ev_lock() and
* ldi_ev_unlock().
*
* When delivering events to subscribers, ldi_invoke_notify() and
* ldi_invoke_finalize() will walk the list of callbacks: le_head. It is
* possible that an invoked callback function will need to unregister an
* arbitrary number of callbacks from this list.
*
* To enable ldi_ev_remove_callbacks() to remove elements from the list
* without breaking the walk-in-progress, we store the next element in the
* walk direction on the struct as le_walker_next and le_walker_prev.
*/
struct ldi_ev_callback_list {
int le_busy;
void *le_thread;
};
void *ev_data);
int ldi_result, void *ev_data);
/*
* LDI device usage interfaces
*
* ldi_usage_count(), ldi_usage_walker(), and ldi_usage_t
*
* These functions are used by the devinfo driver and fuser to get a
* device usage information from the LDI. These functions along with
* the ldi_usage_t data structure allow these other subsystems to have
* no knowledge of how the LDI stores it's internal state.
*
* ldi_usage_count() provides an count of how many kernel
* device clients currently exist.
*
* ldi_usage_walker() reports all kernel device usage information.
*/
#define LDI_USAGE_CONTINUE 0
typedef struct ldi_usage {
/*
* information about the kernel subsystem that is accessing
* the target device
*/
char *src_name;
/*
* information about the target device that is open
*/
char *tgt_name;
int tgt_spec_type;
} ldi_usage_t;
int ldi_usage_count();
void ldi_usage_walker(void *arg,
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SUNLDI_IMPL_H */