17836SJohn.Forte@Sun.COM /*
27836SJohn.Forte@Sun.COM * CDDL HEADER START
37836SJohn.Forte@Sun.COM *
47836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the
57836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License").
67836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License.
77836SJohn.Forte@Sun.COM *
87836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing.
107836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions
117836SJohn.Forte@Sun.COM * and limitations under the License.
127836SJohn.Forte@Sun.COM *
137836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each
147836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the
167836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying
177836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner]
187836SJohn.Forte@Sun.COM *
197836SJohn.Forte@Sun.COM * CDDL HEADER END
207836SJohn.Forte@Sun.COM */
217836SJohn.Forte@Sun.COM /*
22*8760SRamana.Srikanth@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
237836SJohn.Forte@Sun.COM * Use is subject to license terms.
247836SJohn.Forte@Sun.COM */
257836SJohn.Forte@Sun.COM
267836SJohn.Forte@Sun.COM #include <sys/types.h>
277836SJohn.Forte@Sun.COM #include <sys/cmn_err.h>
287836SJohn.Forte@Sun.COM #include <sys/modctl.h>
297836SJohn.Forte@Sun.COM #include <sys/errno.h>
307836SJohn.Forte@Sun.COM
317836SJohn.Forte@Sun.COM #include <rpc/auth.h>
327836SJohn.Forte@Sun.COM #include <rpc/svc.h>
337836SJohn.Forte@Sun.COM
347836SJohn.Forte@Sun.COM #include <sys/nsctl/nsctl.h>
357836SJohn.Forte@Sun.COM #include <sys/nsctl/nsvers.h>
367836SJohn.Forte@Sun.COM #include "rdc_stub.h"
377836SJohn.Forte@Sun.COM
387836SJohn.Forte@Sun.COM static void null_dispatch(struct svc_req *req, SVCXPRT *xprt);
397836SJohn.Forte@Sun.COM static void (*dispatch)(struct svc_req *, SVCXPRT *) = null_dispatch;
407836SJohn.Forte@Sun.COM
417836SJohn.Forte@Sun.COM /*
427836SJohn.Forte@Sun.COM * Solaris module setup.
437836SJohn.Forte@Sun.COM */
447836SJohn.Forte@Sun.COM extern struct mod_ops mod_miscops;
457836SJohn.Forte@Sun.COM
467836SJohn.Forte@Sun.COM static struct modlmisc modlmisc = {
477836SJohn.Forte@Sun.COM &mod_miscops, /* Type of module */
487836SJohn.Forte@Sun.COM "nws:Remote Mirror kRPC Stub:" ISS_VERSION_STR
497836SJohn.Forte@Sun.COM };
507836SJohn.Forte@Sun.COM
517836SJohn.Forte@Sun.COM static struct modlinkage modlinkage = {
527836SJohn.Forte@Sun.COM MODREV_1,
537836SJohn.Forte@Sun.COM &modlmisc,
547836SJohn.Forte@Sun.COM NULL
557836SJohn.Forte@Sun.COM };
567836SJohn.Forte@Sun.COM
577836SJohn.Forte@Sun.COM
587836SJohn.Forte@Sun.COM int
_init(void)597836SJohn.Forte@Sun.COM _init(void)
607836SJohn.Forte@Sun.COM {
617836SJohn.Forte@Sun.COM return (mod_install(&modlinkage));
627836SJohn.Forte@Sun.COM }
637836SJohn.Forte@Sun.COM
647836SJohn.Forte@Sun.COM
657836SJohn.Forte@Sun.COM int
_fini(void)667836SJohn.Forte@Sun.COM _fini(void)
677836SJohn.Forte@Sun.COM {
687836SJohn.Forte@Sun.COM /* unload is forbidden */
697836SJohn.Forte@Sun.COM return (EBUSY);
707836SJohn.Forte@Sun.COM }
717836SJohn.Forte@Sun.COM
727836SJohn.Forte@Sun.COM
737836SJohn.Forte@Sun.COM int
_info(struct modinfo * modinfop)747836SJohn.Forte@Sun.COM _info(struct modinfo *modinfop)
757836SJohn.Forte@Sun.COM {
767836SJohn.Forte@Sun.COM return (mod_info(&modlinkage, modinfop));
777836SJohn.Forte@Sun.COM }
787836SJohn.Forte@Sun.COM
797836SJohn.Forte@Sun.COM
807836SJohn.Forte@Sun.COM /*
817836SJohn.Forte@Sun.COM * rdcstub_dispatch is the place holder for rdcsrv_dispatch.
827836SJohn.Forte@Sun.COM * rdcsrv registers this function as kRPC dispatch function.
837836SJohn.Forte@Sun.COM * If rdcsrv is unloaded (uninstall package), then dispatch
847836SJohn.Forte@Sun.COM * is set to null_dispatch
857836SJohn.Forte@Sun.COM */
867836SJohn.Forte@Sun.COM void
rdcstub_dispatch(struct svc_req * req,SVCXPRT * xprt)877836SJohn.Forte@Sun.COM rdcstub_dispatch(struct svc_req *req, SVCXPRT *xprt)
887836SJohn.Forte@Sun.COM {
897836SJohn.Forte@Sun.COM (*dispatch)(req, xprt);
907836SJohn.Forte@Sun.COM }
917836SJohn.Forte@Sun.COM
927836SJohn.Forte@Sun.COM /* ARGSUSED */
937836SJohn.Forte@Sun.COM static void
null_dispatch(struct svc_req * req,SVCXPRT * xprt)947836SJohn.Forte@Sun.COM null_dispatch(struct svc_req *req, SVCXPRT *xprt)
957836SJohn.Forte@Sun.COM {
967836SJohn.Forte@Sun.COM svcerr_noproc(xprt);
977836SJohn.Forte@Sun.COM }
987836SJohn.Forte@Sun.COM
997836SJohn.Forte@Sun.COM void
rdcstub_set_dispatch(void (* disp)(struct svc_req *,SVCXPRT *))1007836SJohn.Forte@Sun.COM rdcstub_set_dispatch(void (*disp)(struct svc_req *, SVCXPRT *))
1017836SJohn.Forte@Sun.COM {
1027836SJohn.Forte@Sun.COM ASSERT(disp != NULL);
1037836SJohn.Forte@Sun.COM dispatch = disp;
1047836SJohn.Forte@Sun.COM }
1057836SJohn.Forte@Sun.COM
1067836SJohn.Forte@Sun.COM void
rdcstub_unset_dispatch()1077836SJohn.Forte@Sun.COM rdcstub_unset_dispatch()
1087836SJohn.Forte@Sun.COM {
1097836SJohn.Forte@Sun.COM dispatch = null_dispatch;
1107836SJohn.Forte@Sun.COM }
111