1 /* SPDX-License-Identifier: GPL-2.0 */
3 * include/linux/nfs_ssc.h
5 * Author: Dai Ngo <dai.ngo@oracle.com>
7 * Copyright (c) 2020, Oracle and/or its affiliates.
10 #include <linux/nfs_fs.h>
11 #include <linux/sunrpc/svc.h>
13 extern struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl
;
18 struct nfs4_ssc_client_ops
{
19 struct file
*(*sco_open
)(struct vfsmount
*ss_mnt
,
20 struct nfs_fh
*src_fh
, nfs4_stateid
*stateid
);
21 void (*sco_close
)(struct file
*filep
);
27 struct nfs_ssc_client_ops
{
28 void (*sco_sb_deactive
)(struct super_block
*sb
);
31 struct nfs_ssc_client_ops_tbl
{
32 const struct nfs4_ssc_client_ops
*ssc_nfs4_ops
;
33 const struct nfs_ssc_client_ops
*ssc_nfs_ops
;
36 extern void nfs42_ssc_register_ops(void);
37 extern void nfs42_ssc_unregister_ops(void);
39 extern void nfs42_ssc_register(const struct nfs4_ssc_client_ops
*ops
);
40 extern void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops
*ops
);
42 #ifdef CONFIG_NFSD_V4_2_INTER_SSC
43 static inline struct file
*nfs42_ssc_open(struct vfsmount
*ss_mnt
,
44 struct nfs_fh
*src_fh
, nfs4_stateid
*stateid
)
46 if (nfs_ssc_client_tbl
.ssc_nfs4_ops
)
47 return (*nfs_ssc_client_tbl
.ssc_nfs4_ops
->sco_open
)(ss_mnt
, src_fh
, stateid
);
51 static inline void nfs42_ssc_close(struct file
*filep
)
53 if (nfs_ssc_client_tbl
.ssc_nfs4_ops
)
54 (*nfs_ssc_client_tbl
.ssc_nfs4_ops
->sco_close
)(filep
);
58 struct nfsd4_ssc_umount_item
{
59 struct list_head nsui_list
;
62 * nsui_refcnt inited to 2, 1 on list and 1 for consumer. Entry
63 * is removed when refcnt drops to 1 and nsui_expire expires.
65 refcount_t nsui_refcnt
;
66 unsigned long nsui_expire
;
67 struct vfsmount
*nsui_vfsmount
;
68 char nsui_ipaddr
[RPC_MAX_ADDRBUFLEN
+ 1];
74 extern void nfs_ssc_register(const struct nfs_ssc_client_ops
*ops
);
75 extern void nfs_ssc_unregister(const struct nfs_ssc_client_ops
*ops
);
77 static inline void nfs_do_sb_deactive(struct super_block
*sb
)
79 if (nfs_ssc_client_tbl
.ssc_nfs_ops
)
80 (*nfs_ssc_client_tbl
.ssc_nfs_ops
->sco_sb_deactive
)(sb
);