]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blob - include/linux/nfs_ssc.h
Merge tag 'powerpc-5.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[mirror_ubuntu-kernels.git] / include / linux / nfs_ssc.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * include/linux/nfs_ssc.h
4 *
5 * Author: Dai Ngo <dai.ngo@oracle.com>
6 *
7 * Copyright (c) 2020, Oracle and/or its affiliates.
8 */
9
10 #include <linux/nfs_fs.h>
11
12 extern struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl;
13
14 /*
15 * NFS_V4
16 */
17 struct nfs4_ssc_client_ops {
18 struct file *(*sco_open)(struct vfsmount *ss_mnt,
19 struct nfs_fh *src_fh, nfs4_stateid *stateid);
20 void (*sco_close)(struct file *filep);
21 };
22
23 /*
24 * NFS_FS
25 */
26 struct nfs_ssc_client_ops {
27 void (*sco_sb_deactive)(struct super_block *sb);
28 };
29
30 struct nfs_ssc_client_ops_tbl {
31 const struct nfs4_ssc_client_ops *ssc_nfs4_ops;
32 const struct nfs_ssc_client_ops *ssc_nfs_ops;
33 };
34
35 extern void nfs42_ssc_register_ops(void);
36 extern void nfs42_ssc_unregister_ops(void);
37
38 extern void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops);
39 extern void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops);
40
41 #ifdef CONFIG_NFSD_V4_2_INTER_SSC
42 static inline struct file *nfs42_ssc_open(struct vfsmount *ss_mnt,
43 struct nfs_fh *src_fh, nfs4_stateid *stateid)
44 {
45 if (nfs_ssc_client_tbl.ssc_nfs4_ops)
46 return (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_open)(ss_mnt, src_fh, stateid);
47 return ERR_PTR(-EIO);
48 }
49
50 static inline void nfs42_ssc_close(struct file *filep)
51 {
52 if (nfs_ssc_client_tbl.ssc_nfs4_ops)
53 (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_close)(filep);
54 }
55 #endif
56
57 /*
58 * NFS_FS
59 */
60 extern void nfs_ssc_register(const struct nfs_ssc_client_ops *ops);
61 extern void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops);
62
63 static inline void nfs_do_sb_deactive(struct super_block *sb)
64 {
65 if (nfs_ssc_client_tbl.ssc_nfs_ops)
66 (*nfs_ssc_client_tbl.ssc_nfs_ops->sco_sb_deactive)(sb);
67 }