xref: /illumos-gate/usr/src/lib/udapl/libdat/include/dat/dat_registry.h (revision 1da57d551424de5a9d469760be7c4b4d4f10a755)
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 /*
35  *
36  * HEADER: dat_registry.h
37  *
38  * PURPOSE: DAT registration API signatures
39  *
40  * Description: Contains registration external reference signatures for
41  * 		dat registry functions. This file is *only* included by
42  *		providers, not consumers.
43  *
44  * 		Header file for "uDAPL: User Direct Access Programming
45  *		Library, Version: 1.2"
46  *
47  * Mapping rules:
48  * 	All global symbols are prepended with "DAT_" or "dat_"
49  * 	All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'
50  * 	The method table is in the provider definition structure.
51  *
52  *
53  *
54  */
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 #if defined(_UDAT_H_)
61 #include <dat/udat_redirection.h>
62 #elif defined(_KDAT_H_)
63 #include <dat/kdat_redirection.h>
64 #else
65 #error Must include udat.h or kdat.h
66 #endif
67 
68 /*
69  * dat registration API.
70  *
71  * Technically the dat_ia_open is part of the registration API.  This
72  * is so the registration module can map the device name to a provider
73  * structure and then call the provider dat_ia_open function.
74  * dat_is_close is also part of the registration API so that the
75  * registration code can be aware when an ia is no longer in use.
76  *
77  */
78 
79 extern DAT_RETURN dat_registry_add_provider(
80 	IN  DAT_PROVIDER*,			/* provider */
81 	IN  const DAT_PROVIDER_INFO*);		/* provider info */
82 
83 extern DAT_RETURN dat_registry_remove_provider(
84 	IN  DAT_PROVIDER*, 			/* provider */
85 	IN  const DAT_PROVIDER_INFO*);		/* provider info */
86 
87 /*
88  * Provider initialization APIs.
89  *
90  * Providers that support being automatically loaded by the Registry must
91  * implement these APIs and export them as public symbols.
92  */
93 
94 #define	DAT_PROVIDER_INIT_FUNC_NAME  dat_provider_init
95 #define	DAT_PROVIDER_FINI_FUNC_NAME  dat_provider_fini
96 
97 #define	DAT_PROVIDER_INIT_FUNC_STR   "dat_provider_init"
98 #define	DAT_PROVIDER_FINI_FUNC_STR   "dat_provider_fini"
99 
100 typedef void (*DAT_PROVIDER_INIT_FUNC)(
101 	IN const DAT_PROVIDER_INFO *,
102 	IN const char *);	/* instance data */
103 
104 typedef void (*DAT_PROVIDER_FINI_FUNC)(
105 	IN const DAT_PROVIDER_INFO *);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* _DAT_REGISTRY_H_ */
112