From ebb36fcaae4dfd3720e43f8e6a9613e5d84227e0 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Wed, 8 Jan 2025 20:00:12 -0800 Subject: [PATCH] rpc: remove svc_create(), it is not used --- sys/rpc/svc.h | 13 -------- sys/rpc/svc_generic.c | 70 ------------------------------------------- 2 files changed, 83 deletions(-) diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h index d8a8d0139cc..92755a19848 100644 --- a/sys/rpc/svc.h +++ b/sys/rpc/svc.h @@ -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. diff --git a/sys/rpc/svc_generic.c b/sys/rpc/svc_generic.c index 6fb43dc5c94..12c96eca27c 100644 --- a/sys/rpc/svc_generic.c +++ b/sys/rpc/svc_generic.c @@ -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