Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Helper for knfsd's SSC to access ops in NFS client modules
0004  *
0005  * Author: Dai Ngo <dai.ngo@oracle.com>
0006  *
0007  * Copyright (c) 2020, Oracle and/or its affiliates.
0008  */
0009 
0010 #include <linux/module.h>
0011 #include <linux/fs.h>
0012 #include <linux/nfs_ssc.h>
0013 #include "../nfs/nfs4_fs.h"
0014 
0015 MODULE_LICENSE("GPL");
0016 
0017 struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl;
0018 EXPORT_SYMBOL_GPL(nfs_ssc_client_tbl);
0019 
0020 #ifdef CONFIG_NFS_V4_2
0021 /**
0022  * nfs42_ssc_register - install the NFS_V4 client ops in the nfs_ssc_client_tbl
0023  * @ops: NFS_V4 ops to be installed
0024  *
0025  * Return values:
0026  *   None
0027  */
0028 void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops)
0029 {
0030     nfs_ssc_client_tbl.ssc_nfs4_ops = ops;
0031 }
0032 EXPORT_SYMBOL_GPL(nfs42_ssc_register);
0033 
0034 /**
0035  * nfs42_ssc_unregister - uninstall the NFS_V4 client ops from
0036  *              the nfs_ssc_client_tbl
0037  * @ops: ops to be uninstalled
0038  *
0039  * Return values:
0040  *   None
0041  */
0042 void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops)
0043 {
0044     if (nfs_ssc_client_tbl.ssc_nfs4_ops != ops)
0045         return;
0046 
0047     nfs_ssc_client_tbl.ssc_nfs4_ops = NULL;
0048 }
0049 EXPORT_SYMBOL_GPL(nfs42_ssc_unregister);
0050 #endif /* CONFIG_NFS_V4_2 */
0051 
0052 #ifdef CONFIG_NFS_V4_2
0053 /**
0054  * nfs_ssc_register - install the NFS_FS client ops in the nfs_ssc_client_tbl
0055  * @ops: NFS_FS ops to be installed
0056  *
0057  * Return values:
0058  *   None
0059  */
0060 void nfs_ssc_register(const struct nfs_ssc_client_ops *ops)
0061 {
0062     nfs_ssc_client_tbl.ssc_nfs_ops = ops;
0063 }
0064 EXPORT_SYMBOL_GPL(nfs_ssc_register);
0065 
0066 /**
0067  * nfs_ssc_unregister - uninstall the NFS_FS client ops from
0068  *              the nfs_ssc_client_tbl
0069  * @ops: ops to be uninstalled
0070  *
0071  * Return values:
0072  *   None
0073  */
0074 void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops)
0075 {
0076     if (nfs_ssc_client_tbl.ssc_nfs_ops != ops)
0077         return;
0078     nfs_ssc_client_tbl.ssc_nfs_ops = NULL;
0079 }
0080 EXPORT_SYMBOL_GPL(nfs_ssc_unregister);
0081 
0082 #else
0083 void nfs_ssc_register(const struct nfs_ssc_client_ops *ops)
0084 {
0085 }
0086 EXPORT_SYMBOL_GPL(nfs_ssc_register);
0087 
0088 void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops)
0089 {
0090 }
0091 EXPORT_SYMBOL_GPL(nfs_ssc_unregister);
0092 #endif /* CONFIG_NFS_V4_2 */