1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Copyright (C) 2018 Samsung Electronics Co., Ltd. 4 */ 5 6 #ifndef __TREE_CONNECT_MANAGEMENT_H__ 7 #define __TREE_CONNECT_MANAGEMENT_H__ 8 9 #include <linux/hashtable.h> 10 11 #include "../ksmbd_netlink.h" 12 13 struct ksmbd_share_config; 14 struct ksmbd_user; 15 struct ksmbd_conn; 16 17 #define TREE_CONN_EXPIRE 1 18 19 struct ksmbd_tree_connect { 20 int id; 21 22 unsigned int flags; 23 struct ksmbd_share_config *share_conf; 24 struct ksmbd_user *user; 25 26 struct list_head list; 27 28 int maximal_access; 29 bool posix_extensions; 30 unsigned long status; 31 }; 32 33 struct ksmbd_tree_conn_status { 34 unsigned int ret; 35 struct ksmbd_tree_connect *tree_conn; 36 }; 37 38 static inline int test_tree_conn_flag(struct ksmbd_tree_connect *tree_conn, 39 int flag) 40 { 41 return tree_conn->flags & flag; 42 } 43 44 struct ksmbd_session; 45 46 struct ksmbd_tree_conn_status 47 ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess, 48 const char *share_name); 49 50 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess, 51 struct ksmbd_tree_connect *tree_conn); 52 53 struct ksmbd_tree_connect *ksmbd_tree_conn_lookup(struct ksmbd_session *sess, 54 unsigned int id); 55 56 struct ksmbd_share_config *ksmbd_tree_conn_share(struct ksmbd_session *sess, 57 unsigned int id); 58 59 int ksmbd_tree_conn_session_logoff(struct ksmbd_session *sess); 60 61 #endif /* __TREE_CONNECT_MANAGEMENT_H__ */ 62