]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
SUNRPC: make various functions static, or not exported.
authorNeilBrown <neilb@suse.de>
Mon, 15 Jul 2024 07:14:15 +0000 (17:14 +1000)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 1 Sep 2024 14:04:56 +0000 (10:04 -0400)
Various functions are only used within the sunrpc module, and several
are only use in the one file.  So clean up:

These are marked static, and any EXPORT is removed.
  svc_rcpb_setup()
  svc_rqst_alloc()
  svc_rqst_free()  - also moved before first use
  svc_rpcbind_set_version()
  svc_drop() - also moved to svc.c

These are now not EXPORTed, but are not static.
  svc_authenticate()
  svc_sock_update_bufs()

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc.h
include/linux/sunrpc/svcauth.h
include/linux/sunrpc/svcsock.h
net/sunrpc/sunrpc.h
net/sunrpc/svc.c
net/sunrpc/svc_xprt.c
net/sunrpc/svcauth.c
net/sunrpc/svcsock.c

index a7d0406b9ef59cd8c94a0df9b2152228f4fced42..e4fa25fafa9795bfca79a6af802907e7b3e106da 100644 (file)
@@ -401,17 +401,13 @@ struct svc_procedure {
  */
 int sunrpc_set_pool_mode(const char *val);
 int sunrpc_get_pool_mode(char *val, size_t size);
-int svc_rpcb_setup(struct svc_serv *serv, struct net *net);
 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
 int svc_bind(struct svc_serv *serv, struct net *net);
 struct svc_serv *svc_create(struct svc_program *, unsigned int,
                            int (*threadfn)(void *data));
-struct svc_rqst *svc_rqst_alloc(struct svc_serv *serv,
-                                       struct svc_pool *pool, int node);
 bool              svc_rqst_replace_page(struct svc_rqst *rqstp,
                                         struct page *page);
 void              svc_rqst_release_pages(struct svc_rqst *rqstp);
-void              svc_rqst_free(struct svc_rqst *);
 void              svc_exit_thread(struct svc_rqst *);
 struct svc_serv *  svc_create_pooled(struct svc_program *prog,
                                     struct svc_stat *stats,
@@ -446,11 +442,6 @@ int                   svc_generic_rpcbind_set(struct net *net,
                                           u32 version, int family,
                                           unsigned short proto,
                                           unsigned short port);
-int               svc_rpcbind_set_version(struct net *net,
-                                          const struct svc_program *progp,
-                                          u32 version, int family,
-                                          unsigned short proto,
-                                          unsigned short port);
 
 #define        RPC_MAX_ADDRBUFLEN      (63U)
 
index 61c455f1e1f50feff85368c08d2acc5d054018f8..63cf6fb26dcc180c137c43472cd49b61d05d623c 100644 (file)
@@ -151,7 +151,6 @@ struct auth_ops {
 
 struct svc_xprt;
 
-extern enum svc_auth_status svc_authenticate(struct svc_rqst *rqstp);
 extern rpc_authflavor_t svc_auth_flavor(struct svc_rqst *rqstp);
 extern int     svc_authorise(struct svc_rqst *rqstp);
 extern enum svc_auth_status svc_set_client(struct svc_rqst *rqstp);
index 7c78ec6356b9286cd06323a085bdbbfa329c6c1d..bf45d9e8492afcaadf3e4bbf3cd2b9773ca4a2a9 100644 (file)
@@ -58,8 +58,6 @@ static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
  */
 void           svc_recv(struct svc_rqst *rqstp);
 void           svc_send(struct svc_rqst *rqstp);
-void           svc_drop(struct svc_rqst *);
-void           svc_sock_update_bufs(struct svc_serv *serv);
 int            svc_addsock(struct svc_serv *serv, struct net *net,
                            const int fd, char *name_return, const size_t len,
                            const struct cred *cred);
index d4a362c9e4b3bb403e1cce5614e323c3d542ab1b..e3c6e3b63f0ba6ded4294f655456673311a52bfe 100644 (file)
@@ -36,7 +36,11 @@ static inline int sock_is_loopback(struct sock *sk)
        return loopback;
 }
 
+struct svc_serv;
+struct svc_rqst;
 int rpc_clients_notifier_register(void);
 void rpc_clients_notifier_unregister(void);
 void auth_domain_cleanup(void);
+void svc_sock_update_bufs(struct svc_serv *serv);
+enum svc_auth_status svc_authenticate(struct svc_rqst *rqstp);
 #endif /* _NET_SUNRPC_SUNRPC_H */
index 88a59cfa5583c064d02df1b3632cb6021a24390d..561d20a5316e073537d89b4702558c9d0f747fb3 100644 (file)
@@ -32,6 +32,7 @@
 #include <trace/events/sunrpc.h>
 
 #include "fail.h"
+#include "sunrpc.h"
 
 #define RPCDBG_FACILITY        RPCDBG_SVCDSP
 
@@ -417,7 +418,7 @@ struct svc_pool *svc_pool_for_cpu(struct svc_serv *serv)
        return &serv->sv_pools[pidx % serv->sv_nrpools];
 }
 
-int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
+static int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
 {
        int err;
 
@@ -429,7 +430,6 @@ int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
        svc_unregister(serv, net);
        return 0;
 }
-EXPORT_SYMBOL_GPL(svc_rpcb_setup);
 
 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net)
 {
@@ -664,7 +664,20 @@ svc_release_buffer(struct svc_rqst *rqstp)
                        put_page(rqstp->rq_pages[i]);
 }
 
-struct svc_rqst *
+static void
+svc_rqst_free(struct svc_rqst *rqstp)
+{
+       folio_batch_release(&rqstp->rq_fbatch);
+       svc_release_buffer(rqstp);
+       if (rqstp->rq_scratch_page)
+               put_page(rqstp->rq_scratch_page);
+       kfree(rqstp->rq_resp);
+       kfree(rqstp->rq_argp);
+       kfree(rqstp->rq_auth_data);
+       kfree_rcu(rqstp, rq_rcu_head);
+}
+
+static struct svc_rqst *
 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
 {
        struct svc_rqst *rqstp;
@@ -698,7 +711,6 @@ out_enomem:
        svc_rqst_free(rqstp);
        return NULL;
 }
-EXPORT_SYMBOL_GPL(svc_rqst_alloc);
 
 static struct svc_rqst *
 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
@@ -933,24 +945,6 @@ void svc_rqst_release_pages(struct svc_rqst *rqstp)
        }
 }
 
-/*
- * Called from a server thread as it's exiting. Caller must hold the "service
- * mutex" for the service.
- */
-void
-svc_rqst_free(struct svc_rqst *rqstp)
-{
-       folio_batch_release(&rqstp->rq_fbatch);
-       svc_release_buffer(rqstp);
-       if (rqstp->rq_scratch_page)
-               put_page(rqstp->rq_scratch_page);
-       kfree(rqstp->rq_resp);
-       kfree(rqstp->rq_argp);
-       kfree(rqstp->rq_auth_data);
-       kfree_rcu(rqstp, rq_rcu_head);
-}
-EXPORT_SYMBOL_GPL(svc_rqst_free);
-
 void
 svc_exit_thread(struct svc_rqst *rqstp)
 {
@@ -1098,6 +1092,7 @@ static int __svc_register(struct net *net, const char *progname,
        return error;
 }
 
+static
 int svc_rpcbind_set_version(struct net *net,
                            const struct svc_program *progp,
                            u32 version, int family,
@@ -1108,7 +1103,6 @@ int svc_rpcbind_set_version(struct net *net,
                                version, family, proto, port);
 
 }
-EXPORT_SYMBOL_GPL(svc_rpcbind_set_version);
 
 int svc_generic_rpcbind_set(struct net *net,
                            const struct svc_program *progp,
@@ -1526,6 +1520,14 @@ err_system_err:
        goto sendit;
 }
 
+/*
+ * Drop request
+ */
+static void svc_drop(struct svc_rqst *rqstp)
+{
+       trace_svc_drop(rqstp);
+}
+
 /**
  * svc_process - Execute one RPC transaction
  * @rqstp: RPC transaction context
index d3735ab3e6d1c62ac49f022fb0b449518998036b..53ebc719ff5ae387830c39c23fecce4578196a36 100644 (file)
@@ -905,15 +905,6 @@ void svc_recv(struct svc_rqst *rqstp)
 }
 EXPORT_SYMBOL_GPL(svc_recv);
 
-/*
- * Drop request
- */
-void svc_drop(struct svc_rqst *rqstp)
-{
-       trace_svc_drop(rqstp);
-}
-EXPORT_SYMBOL_GPL(svc_drop);
-
 /**
  * svc_send - Return reply to client
  * @rqstp: RPC transaction context
index 1619211f0960afbfdac1a22617a3e74f437672e1..93d9e949e26524553974519885c168ddb5286458 100644 (file)
@@ -98,7 +98,6 @@ enum svc_auth_status svc_authenticate(struct svc_rqst *rqstp)
        rqstp->rq_authop = aops;
        return aops->accept(rqstp);
 }
-EXPORT_SYMBOL_GPL(svc_authenticate);
 
 /**
  * svc_set_client - Assign an appropriate 'auth_domain' as the client
index 6b3f01beb294b99740ae4364acbe31cc92e4a980..825ec53576912ae4c9f69c031f6dd171f087d413 100644 (file)
@@ -1378,7 +1378,6 @@ void svc_sock_update_bufs(struct svc_serv *serv)
                set_bit(XPT_CHNGBUF, &svsk->sk_xprt.xpt_flags);
        spin_unlock_bh(&serv->sv_lock);
 }
-EXPORT_SYMBOL_GPL(svc_sock_update_bufs);
 
 /*
  * Initialize socket for RPC use and create svc_sock struct