aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_ssc.h
blob: f5ba0fbff72fe3ef19e354cb8e644cecd156243c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * include/linux/nfs_ssc.h
 *
 * Author: Dai Ngo <dai.ngo@oracle.com>
 *
 * Copyright (c) 2020, Oracle and/or its affiliates.
 */

#include <linux/nfs_fs.h>

extern struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl;

/*
 * NFS_V4
 */
struct nfs4_ssc_client_ops {
	struct file *(*sco_open)(struct vfsmount *ss_mnt,
		struct nfs_fh *src_fh, nfs4_stateid *stateid);
	void (*sco_close)(struct file *filep);
};

/*
 * NFS_FS
 */
struct nfs_ssc_client_ops {
	void (*sco_sb_deactive)(struct super_block *sb);
};

struct nfs_ssc_client_ops_tbl {
	const struct nfs4_ssc_client_ops *ssc_nfs4_ops;
	const struct nfs_ssc_client_ops *ssc_nfs_ops;
};

extern void nfs42_ssc_register_ops(void);
extern void nfs42_ssc_unregister_ops(void);

extern void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops);
extern void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops);

#ifdef CONFIG_NFSD_V4_2_INTER_SSC
static inline struct file *nfs42_ssc_open(struct vfsmount *ss_mnt,
		struct nfs_fh *src_fh, nfs4_stateid *stateid)
{
	if (nfs_ssc_client_tbl.ssc_nfs4_ops)
		return (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_open)(ss_mnt, src_fh, stateid);
	return ERR_PTR(-EIO);
}

static inline void nfs42_ssc_close(struct file *filep)
{
	if (nfs_ssc_client_tbl.ssc_nfs4_ops)
		(*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_close)(filep);
}
#endif

/*
 * NFS_FS
 */
extern void nfs_ssc_register(const struct nfs_ssc_client_ops *ops);
extern void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops);

static inline void nfs_do_sb_deactive(struct super_block *sb)
{
	if (nfs_ssc_client_tbl.ssc_nfs_ops)
		(*nfs_ssc_client_tbl.ssc_nfs_ops->sco_sb_deactive)(sb);
}