xref: /linux/fs/smb/client/cifs_swn.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1*38c8a9a5SSteve French /* SPDX-License-Identifier: GPL-2.0 */
2*38c8a9a5SSteve French /*
3*38c8a9a5SSteve French  * Witness Service client for CIFS
4*38c8a9a5SSteve French  *
5*38c8a9a5SSteve French  * Copyright (c) 2020 Samuel Cabrero <scabrero@suse.de>
6*38c8a9a5SSteve French  */
7*38c8a9a5SSteve French 
8*38c8a9a5SSteve French #ifndef _CIFS_SWN_H
9*38c8a9a5SSteve French #define _CIFS_SWN_H
10*38c8a9a5SSteve French #include "cifsglob.h"
11*38c8a9a5SSteve French 
12*38c8a9a5SSteve French struct cifs_tcon;
13*38c8a9a5SSteve French struct sk_buff;
14*38c8a9a5SSteve French struct genl_info;
15*38c8a9a5SSteve French 
16*38c8a9a5SSteve French #ifdef CONFIG_CIFS_SWN_UPCALL
17*38c8a9a5SSteve French extern int cifs_swn_register(struct cifs_tcon *tcon);
18*38c8a9a5SSteve French 
19*38c8a9a5SSteve French extern int cifs_swn_unregister(struct cifs_tcon *tcon);
20*38c8a9a5SSteve French 
21*38c8a9a5SSteve French extern int cifs_swn_notify(struct sk_buff *skb, struct genl_info *info);
22*38c8a9a5SSteve French 
23*38c8a9a5SSteve French extern void cifs_swn_dump(struct seq_file *m);
24*38c8a9a5SSteve French 
25*38c8a9a5SSteve French extern void cifs_swn_check(void);
26*38c8a9a5SSteve French 
cifs_swn_set_server_dstaddr(struct TCP_Server_Info * server)27*38c8a9a5SSteve French static inline bool cifs_swn_set_server_dstaddr(struct TCP_Server_Info *server)
28*38c8a9a5SSteve French {
29*38c8a9a5SSteve French 	if (server->use_swn_dstaddr) {
30*38c8a9a5SSteve French 		server->dstaddr = server->swn_dstaddr;
31*38c8a9a5SSteve French 		return true;
32*38c8a9a5SSteve French 	}
33*38c8a9a5SSteve French 	return false;
34*38c8a9a5SSteve French }
35*38c8a9a5SSteve French 
cifs_swn_reset_server_dstaddr(struct TCP_Server_Info * server)36*38c8a9a5SSteve French static inline void cifs_swn_reset_server_dstaddr(struct TCP_Server_Info *server)
37*38c8a9a5SSteve French {
38*38c8a9a5SSteve French 	server->use_swn_dstaddr = false;
39*38c8a9a5SSteve French }
40*38c8a9a5SSteve French 
41*38c8a9a5SSteve French #else
42*38c8a9a5SSteve French 
cifs_swn_register(struct cifs_tcon * tcon)43*38c8a9a5SSteve French static inline int cifs_swn_register(struct cifs_tcon *tcon) { return 0; }
cifs_swn_unregister(struct cifs_tcon * tcon)44*38c8a9a5SSteve French static inline int cifs_swn_unregister(struct cifs_tcon *tcon) { return 0; }
cifs_swn_notify(struct sk_buff * s,struct genl_info * i)45*38c8a9a5SSteve French static inline int cifs_swn_notify(struct sk_buff *s, struct genl_info *i) { return 0; }
cifs_swn_dump(struct seq_file * m)46*38c8a9a5SSteve French static inline void cifs_swn_dump(struct seq_file *m) {}
cifs_swn_check(void)47*38c8a9a5SSteve French static inline void cifs_swn_check(void) {}
cifs_swn_set_server_dstaddr(struct TCP_Server_Info * server)48*38c8a9a5SSteve French static inline bool cifs_swn_set_server_dstaddr(struct TCP_Server_Info *server) { return false; }
cifs_swn_reset_server_dstaddr(struct TCP_Server_Info * server)49*38c8a9a5SSteve French static inline void cifs_swn_reset_server_dstaddr(struct TCP_Server_Info *server) {}
50*38c8a9a5SSteve French 
51*38c8a9a5SSteve French #endif /* CONFIG_CIFS_SWN_UPCALL */
52*38c8a9a5SSteve French #endif /* _CIFS_SWN_H */
53