cifs_swn.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Witness Service client for CIFS
  4. *
  5. * Copyright (c) 2020 Samuel Cabrero <[email protected]>
  6. */
  7. #ifndef _CIFS_SWN_H
  8. #define _CIFS_SWN_H
  9. #include "cifsglob.h"
  10. struct cifs_tcon;
  11. struct sk_buff;
  12. struct genl_info;
  13. #ifdef CONFIG_CIFS_SWN_UPCALL
  14. extern int cifs_swn_register(struct cifs_tcon *tcon);
  15. extern int cifs_swn_unregister(struct cifs_tcon *tcon);
  16. extern int cifs_swn_notify(struct sk_buff *skb, struct genl_info *info);
  17. extern void cifs_swn_dump(struct seq_file *m);
  18. extern void cifs_swn_check(void);
  19. static inline bool cifs_swn_set_server_dstaddr(struct TCP_Server_Info *server)
  20. {
  21. if (server->use_swn_dstaddr) {
  22. server->dstaddr = server->swn_dstaddr;
  23. return true;
  24. }
  25. return false;
  26. }
  27. static inline void cifs_swn_reset_server_dstaddr(struct TCP_Server_Info *server)
  28. {
  29. server->use_swn_dstaddr = false;
  30. }
  31. #else
  32. static inline int cifs_swn_register(struct cifs_tcon *tcon) { return 0; }
  33. static inline int cifs_swn_unregister(struct cifs_tcon *tcon) { return 0; }
  34. static inline int cifs_swn_notify(struct sk_buff *s, struct genl_info *i) { return 0; }
  35. static inline void cifs_swn_dump(struct seq_file *m) {}
  36. static inline void cifs_swn_check(void) {}
  37. static inline bool cifs_swn_set_server_dstaddr(struct TCP_Server_Info *server) { return false; }
  38. static inline void cifs_swn_reset_server_dstaddr(struct TCP_Server_Info *server) {}
  39. #endif /* CONFIG_CIFS_SWN_UPCALL */
  40. #endif /* _CIFS_SWN_H */