rpc: remove svc_create(), it is not used

This commit is contained in:
Gleb Smirnoff 2025-01-08 20:00:12 -08:00
parent 3a0cdb2675
commit ebb36fcaae
2 changed files with 0 additions and 83 deletions

View file

@ -578,19 +578,6 @@ extern void svcpool_destroy(SVCPOOL *pool);
*/
extern void svcpool_close(SVCPOOL *pool);
/*
* Transport independent svc_create routine.
*/
extern int svc_create(SVCPOOL *, void (*)(struct svc_req *, SVCXPRT *),
const rpcprog_t, const rpcvers_t, const char *);
/*
* void (*dispatch)(); -- dispatch routine
* const rpcprog_t prognum; -- program number
* const rpcvers_t versnum; -- version number
* const char *nettype; -- network type
*/
/*
* Generic server creation routine. It takes a netconfig structure
* instead of a nettype.

View file

@ -64,76 +64,6 @@
extern int __svc_vc_setflag(SVCXPRT *, int);
/*
* The highest level interface for server creation.
* It tries for all the nettokens in that particular class of token
* and returns the number of handles it can create and/or find.
*
* It creates a link list of all the handles it could create.
* If svc_create() is called multiple times, it uses the handle
* created earlier instead of creating a new handle every time.
*/
int
svc_create(
SVCPOOL *pool,
void (*dispatch)(struct svc_req *, SVCXPRT *),
rpcprog_t prognum, /* Program number */
rpcvers_t versnum, /* Version number */
const char *nettype) /* Networktype token */
{
int g, num = 0;
SVCGROUP *grp;
SVCXPRT *xprt;
struct netconfig *nconf;
void *handle;
if ((handle = __rpc_setconf(nettype)) == NULL) {
printf("svc_create: unknown protocol");
return (0);
}
while ((nconf = __rpc_getconf(handle)) != NULL) {
for (g = 0; g < SVC_MAXGROUPS; g++) {
grp = &pool->sp_groups[g];
mtx_lock(&grp->sg_lock);
TAILQ_FOREACH(xprt, &grp->sg_xlist, xp_link) {
if (strcmp(xprt->xp_netid, nconf->nc_netid))
continue;
/* Found an old one, use it */
mtx_unlock(&grp->sg_lock);
(void) rpcb_unset(prognum, versnum, nconf);
if (svc_reg(xprt, prognum, versnum,
dispatch, nconf) == FALSE) {
printf(
"svc_create: could not register prog %u vers %u on %s\n",
(unsigned)prognum, (unsigned)versnum,
nconf->nc_netid);
mtx_lock(&grp->sg_lock);
} else {
num++;
mtx_lock(&grp->sg_lock);
break;
}
}
mtx_unlock(&grp->sg_lock);
}
if (xprt == NULL) {
/* It was not found. Now create a new one */
xprt = svc_tp_create(pool, dispatch, prognum, versnum,
NULL, nconf);
if (xprt) {
num++;
SVC_RELEASE(xprt);
}
}
}
__rpc_endconf(handle);
/*
* In case of num == 0; the error messages are generated by the
* underlying layers; and hence not needed here.
*/
return (num);
}
/*
* The high level interface to svc_tli_create().
* It tries to create a server for "nconf" and registers the service