]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - module/icp/os/modconf.c
eb50767b74d80773a90d6eb6f2786ee68a91e74f
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #include <sys/zfs_context.h>
27 #include <sys/modctl.h>
30 * Null operations; used for uninitialized and "misc" modules.
32 static int mod_null(struct modlmisc
*, struct modlinkage
*);
33 static int mod_infonull(void *, struct modlinkage
*, int *);
36 * Cryptographic Modules
38 struct mod_ops mod_cryptoops
= {
39 mod_null
, mod_null
, mod_infonull
43 * Null operation; return 0.
46 mod_null(struct modlmisc
*modl
, struct modlinkage
*modlp
)
52 * Status for User modules.
55 mod_infonull(void *modl
, struct modlinkage
*modlp
, int *p0
)
57 *p0
= -1; /* for modinfo display */
63 * (This routine is in the Solaris SPARC DDI/DKI)
66 mod_install(struct modlinkage
*modlp
)
68 int retval
= -1; /* No linkage structures */
69 struct modlmisc
**linkpp
;
70 struct modlmisc
**linkpp1
;
72 if (modlp
->ml_rev
!= MODREV_1
) {
73 cmn_err(CE_WARN
, "mod_install: "
74 "modlinkage structure is not MODREV_1\n");
77 linkpp
= (struct modlmisc
**)&modlp
->ml_linkage
[0];
79 while (*linkpp
!= NULL
) {
80 if ((retval
= MODL_INSTALL(*linkpp
, modlp
)) != 0) {
81 linkpp1
= (struct modlmisc
**)&modlp
->ml_linkage
[0];
83 while (linkpp1
!= linkpp
) {
84 MODL_REMOVE(*linkpp1
, modlp
); /* clean up */
94 static char *reins_err
=
95 "Could not reinstall %s\nReboot to correct the problem";
98 * Remove a module. This is called by the module wrapper routine.
99 * (This routine is in the Solaris SPARC DDI/DKI)
102 mod_remove(struct modlinkage
*modlp
)
105 struct modlmisc
**linkpp
, *last_linkp
;
107 linkpp
= (struct modlmisc
**)&modlp
->ml_linkage
[0];
109 while (*linkpp
!= NULL
) {
110 if ((retval
= MODL_REMOVE(*linkpp
, modlp
)) != 0) {
111 last_linkp
= *linkpp
;
112 linkpp
= (struct modlmisc
**)&modlp
->ml_linkage
[0];
113 while (*linkpp
!= last_linkp
) {
114 if (MODL_INSTALL(*linkpp
, modlp
) != 0) {
115 cmn_err(CE_WARN
, reins_err
,
116 (*linkpp
)->misc_linkinfo
);
130 * (This routine is in the Solaris SPARC DDI/DKI)
133 mod_info(struct modlinkage
*modlp
, struct modinfo
*modinfop
)
137 struct modspecific_info
*msip
;
138 struct modlmisc
**linkpp
;
140 modinfop
->mi_rev
= modlp
->ml_rev
;
142 linkpp
= (struct modlmisc
**)modlp
->ml_linkage
;
143 msip
= &modinfop
->mi_msinfo
[0];
145 for (i
= 0; i
< MODMAXLINK
; i
++) {
146 if (*linkpp
== NULL
) {
147 msip
->msi_linkinfo
[0] = '\0';
149 (void) strlcpy(msip
->msi_linkinfo
,
150 (*linkpp
)->misc_linkinfo
, MODMAXLINKINFOLEN
);
151 retval
= MODL_INFO(*linkpp
, modlp
, &msip
->msi_p0
);
159 if (modinfop
->mi_info
== MI_INFO_LINKAGE
) {
161 * Slight kludge used to extract the address of the
162 * modlinkage structure from the module (just after
163 * loading a module for the very first time)
165 modinfop
->mi_base
= (void *)modlp
;