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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     1
/*
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     2
 * CDDL HEADER START
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     3
 *
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     7
 *
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    11
 * and limitations under the License.
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    12
 *
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    18
 *
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    19
 * CDDL HEADER END
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    20
 */
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    21
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    22
/*
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    23
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    24
 */
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    25
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    26
#ifndef	_RAD_CONTAINER_H
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    27
#define	_RAD_CONTAINER_H
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    28
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    29
#include <stdlib.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    30
#include <pthread.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    31
#include <sys/types.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    32
#include <sys/list.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    33
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    34
#include <rad/adr.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    35
#include <rad/adr_object.h>
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    36
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    37
#include "rad_object.h"
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    38
#include "rad_modapi.h"
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    39
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    40
#ifdef	__cplusplus
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    41
extern "C" {
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    42
#endif
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    43
604
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    44
typedef struct rad_dynamic {
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    45
	adr_name_t	*rd_pattern;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    46
	rad_dyn_list_t	rd_list;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    47
	rad_dyn_lookup_t rd_lookup;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    48
	void		*rd_arg;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    49
	list_node_t	rd_node;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    50
} rad_dynamic_t;
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    51
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    52
/* The container itself; contains instances */
575
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    53
struct rad_container {
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    54
	pthread_mutex_t c_lock;
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    55
	int		c_ninstances;	/* # of instances */
604
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    56
	list_t		c_instances;	/* instances */
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    57
	list_t		c_dynamic;	/* dynamic namespace providers */
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    58
	long long	c_id;		/* last instance ID allocated */
575
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    59
	rad_instance_t	*c_contobj;	/* container object */
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    60
};
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    61
604
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    62
void cont_create(rad_container_t *);
575
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    63
conerr_t cont_list(rad_container_t *, adr_name_t *, data_t **);
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    64
conerr_t cont_lookup(rad_container_t *, const char *, rad_instance_t **,
604
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    65
    data_t **);
575
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    66
conerr_t cont_lookup_id(rad_container_t *, long long, rad_instance_t **,
604
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    67
    data_t **);
20d9acfeb7fb 17421 name key order preservation
David Powell <david.e.powell@oracle.com>
parents: 575
diff changeset
    68
575
e5ca78dfe938 17085 add component prefixes to adr's method/attribute
David Powell <david.e.powell@oracle.com>
parents: 573
diff changeset
    69
boolean_t cont_insert_contobj(rad_container_t *);
573
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    70
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    71
#ifdef	__cplusplus
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    72
}
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    73
#endif
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    74
f0add9469f92 17058 support removing objects
David Powell <david.e.powell@oracle.com>
parents:
diff changeset
    75
#endif	/* _RAD_CONTAINER_H */