svc_gen.c revision 2695d4f4d1e2a6022c8a279d40c3cb750964974d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#include <sys/sysmacros.h>
/*
* Create server-side kernel RPC `master' transport handle
*
* This is public interface for creation of a server RPC transport handle
* for a given file descriptor. This function is called from nfs_svc()
* and lm_svc().
*
* PSARC 2003/523 Contract Private Interface
* svc_tli_kcreate
* Changes must be reviewed by Solaris File Sharing
* Changes must be communicated to contract-2003-523@sun.com
*
* Arguments:
* - fp - connection end point
* - max_msgsize - max receive size
* - netid - netid
* - addrmask - address mask
* - nxprt - filled with outgoing transport handle
* - sct - callout table to be registered with this transport handle
* - closeproc - optional pointer to a closeproc for this transport or NULL
* - id - RPC pool id (currently only NFS_SVCPOOL_ID or LM_SVCPOOL_ID)
* - hotstream - very MT-hot flag (TRUE for NFS, FALSE for Lock Manager)
*
* Description:
* - make sure rpcmod is on the stream
* - call T_INFO_REQ to get the transport service type info
* - call transport-type specific `create' routine (svc_clts_kcreate(),
* svc_cots_kcreate()) to create and initialize transport for the stream
* - call svc_xprt_register() to register the transport handle into the
* service thread pool
* - initialize transport-type independent fields (synchronization objects,
* thread counts, callout table, closeproc)
* - optionally, for CLTS transports tell streams framework that the
* stream can be MT-hot
* - call transport-type specific `start' function to tell rpcmod that
* the transport is ready to receive.
*/
int
char *netid,
void (*closeproc)(const SVCMASTERXPRT *),
int id, /* thread pool */
{
int retval;
struct T_info_ack tinfo;
int error;
void **vp;
return (EINVAL);
return (ENOSTR);
/*
* Make sure that an RPC interface module is on the stream.
*/
break;
}
if (!wq) {
return (EINVAL);
}
/*
* Find out what type of transport this is.
*/
return (error);
}
/*
* Call transport-type specific `create' function.
* It will allocate transport structure.
*/
case T_CLTS:
break;
case T_COTS:
case T_COTS_ORD:
break;
default:
}
if (error)
return (error);
/*
* Initialize transport-type independent fields.
*/
xprt->xp_threads = 0;
xprt->xp_detached_threads = 0;
}
}
/*
* Register this transport handle after all fields have been
* initialized. The registration can fail only if we try to register
* with a non-existent pool (ENOENT) or a closing pool (EBUSY).
*/
/* if there was an addrmask, caller will delete it */
return (error);
}
/*
* Set the private RPC cell in the module's data.
*/
/*
* Inform the streams framework that the stream may be very MT hot.
*/
}
/*
* Tell rpcmod that the transport is fully initialized and
* ready to process requests.
*/
return (0);
}