usr/src/cmd/rad/rad_container.h
author David Powell <david.e.powell@oracle.com>
Tue, 23 Nov 2010 15:54:20 -0800
changeset 604 20d9acfeb7fb
parent 575 e5ca78dfe938
child 650 265ab927a268
permissions -rw-r--r--
17421 name key order preservation 17422 rad dynamic namespace support 17423 rad kstat module

/*
 * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */

#ifndef	_RAD_CONTAINER_H
#define	_RAD_CONTAINER_H

#include <stdlib.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/list.h>

#include <rad/adr.h>
#include <rad/adr_object.h>

#include "rad_object.h"
#include "rad_modapi.h"

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct rad_dynamic {
	adr_name_t	*rd_pattern;
	rad_dyn_list_t	rd_list;
	rad_dyn_lookup_t rd_lookup;
	void		*rd_arg;
	list_node_t	rd_node;
} rad_dynamic_t;

/* The container itself; contains instances */
struct rad_container {
	pthread_mutex_t c_lock;
	int		c_ninstances;	/* # of instances */
	list_t		c_instances;	/* instances */
	list_t		c_dynamic;	/* dynamic namespace providers */
	long long	c_id;		/* last instance ID allocated */
	rad_instance_t	*c_contobj;	/* container object */
};

void cont_create(rad_container_t *);
conerr_t cont_list(rad_container_t *, adr_name_t *, data_t **);
conerr_t cont_lookup(rad_container_t *, const char *, rad_instance_t **,
    data_t **);
conerr_t cont_lookup_id(rad_container_t *, long long, rad_instance_t **,
    data_t **);

boolean_t cont_insert_contobj(rad_container_t *);

#ifdef	__cplusplus
}
#endif

#endif	/* _RAD_CONTAINER_H */