ptree_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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
* 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) 1999-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _PTREE_IMPL_H
#define _PTREE_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <synch.h>
#include <pthread.h>
typedef uint64_t picl_hdl_t;
/*
* Hash table size of Ptree and PICL tables
*/
#define HASH_TBL_SIZE 128
#define HASH_INDEX(s, x) ((int)((x) & ((s) - 1)))
/*
* Invalid PICL handle
*/
#define PICL_INVALID_PICLHDL (picl_hdl_t)0
/*
* Is the object PICLized?
*/
/*
* A handle is a 64-bit quantity with the daemon's pid value in top 32 bits
* and the raw handle value in the lower 32 bits.
*/
#define HASH_VAL(x) ((x) & 0xFFFFFFFF)
#define GET_PID(x) ((x) >> 32)
/*
* Lock type when locking a node
*/
#define RDLOCK_NODE 1
#define WRLOCK_NODE 2
/*
* Property access operation
*/
#define PROP_READ 1
#define PROP_WRITE 2
/*
* PICL object type
*/
typedef struct picl_obj picl_obj_t;
/*
* Hash table structure
*/
struct hash_elem {
union {
void *data;
} u;
};
typedef struct hash_elem hash_elem_t;
typedef struct {
int hash_size;
hash_elem_t **tbl;
} hash_t;
/*
* Property expression list
*/
typedef struct prop_list {
char *pname;
char *pval;
} prop_list_t;
/*
* PICL property (scalar or a table entry)
*/
struct picl_prop {
void *pvalue;
};
typedef struct picl_prop picl_prop_t;
/*
* PICL node
*/
struct picl_node {
char *classname;
};
typedef struct picl_node picl_node_t;
/*
* PICL object types
*/
#define PICL_OBJ_NODE 0x1
#define PICL_OBJ_PROP 0x2
#define PICL_OBJ_TABLE 0x4
#define PICL_OBJ_TABLEENTRY 0x8
/*
* PICL object
*/
struct picl_obj {
union {
} u;
};
/*
* PICL event queue structures
*/
struct eventq {
const char *ename;
const void *earg;
};
/*
* Event handler list
*/
struct eh_list {
char *ename;
void *cookie;
short execflg;
short wakeupflg;
};
typedef struct eh_list evt_handler_t;
#define SUPER_USER 0
#define MIN(x, y) ((x) < (y) ? (x) : (y))
typedef struct picld_plugin_reg_list {
struct picld_plugin_reg_list *next;
typedef struct picld_plinfo {
char *libname;
char *pathname;
void *dlh;
struct picld_plinfo *next;
extern int xptree_initialize(int);
extern void xptree_destroy(void);
extern int xptree_reinitialize(void);
/*
* PICL daemon verbose level flag
*/
extern int verbose_level;
#ifdef __cplusplus
}
#endif
#endif /* _PTREE_IMPL_H */