xref: /illumos-gate/usr/src/lib/udapl/libdat/include/dat/dat_registry.h (revision eb633035c80613ec93d62f90482837adaaf21a0a)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2002-2004, Network Appliance, Inc. All rights reserved.
24  */
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _DAT_REGISTRY_H_
32 #define	_DAT_REGISTRY_H_
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 /*
37  *
38  * HEADER: dat_registry.h
39  *
40  * PURPOSE: DAT registration API signatures
41  *
42  * Description: Contains registration external reference signatures for
43  * 		dat registry functions. This file is *only* included by
44  *		providers, not consumers.
45  *
46  * 		Header file for "uDAPL: User Direct Access Programming
47  *		Library, Version: 1.2"
48  *
49  * Mapping rules:
50  * 	All global symbols are prepended with "DAT_" or "dat_"
51  * 	All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'
52  * 	The method table is in the provider definition structure.
53  *
54  *
55  *
56  */
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 #if defined(_UDAT_H_)
63 #include <dat/udat_redirection.h>
64 #elif defined(_KDAT_H_)
65 #include <dat/kdat_redirection.h>
66 #else
67 #error Must include udat.h or kdat.h
68 #endif
69 
70 /*
71  * dat registration API.
72  *
73  * Technically the dat_ia_open is part of the registration API.  This
74  * is so the registration module can map the device name to a provider
75  * structure and then call the provider dat_ia_open function.
76  * dat_is_close is also part of the registration API so that the
77  * registration code can be aware when an ia is no longer in use.
78  *
79  */
80 
81 extern DAT_RETURN dat_registry_add_provider(
82 	IN  DAT_PROVIDER*,			/* provider */
83 	IN  const DAT_PROVIDER_INFO*);		/* provider info */
84 
85 extern DAT_RETURN dat_registry_remove_provider(
86 	IN  DAT_PROVIDER*, 			/* provider */
87 	IN  const DAT_PROVIDER_INFO*);		/* provider info */
88 
89 /*
90  * Provider initialization APIs.
91  *
92  * Providers that support being automatically loaded by the Registry must
93  * implement these APIs and export them as public symbols.
94  */
95 
96 #define	DAT_PROVIDER_INIT_FUNC_NAME  dat_provider_init
97 #define	DAT_PROVIDER_FINI_FUNC_NAME  dat_provider_fini
98 
99 #define	DAT_PROVIDER_INIT_FUNC_STR   "dat_provider_init"
100 #define	DAT_PROVIDER_FINI_FUNC_STR   "dat_provider_fini"
101 
102 typedef void (*DAT_PROVIDER_INIT_FUNC)(
103 	IN const DAT_PROVIDER_INFO *,
104 	IN const char *);	/* instance data */
105 
106 typedef void (*DAT_PROVIDER_FINI_FUNC)(
107 	IN const DAT_PROVIDER_INFO *);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif /* _DAT_REGISTRY_H_ */
114