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 
16 struct ksmbd_tree_connect {
17 	int				id;
18 
19 	unsigned int			flags;
20 	struct ksmbd_share_config	*share_conf;
21 	struct ksmbd_user		*user;
22 
23 	struct list_head		list;
24 
25 	int				maximal_access;
26 	bool				posix_extensions;
27 };
28 
29 struct ksmbd_tree_conn_status {
30 	unsigned int			ret;
31 	struct ksmbd_tree_connect	*tree_conn;
32 };
33 
test_tree_conn_flag(struct ksmbd_tree_connect * tree_conn,int flag)34 static inline int test_tree_conn_flag(struct ksmbd_tree_connect *tree_conn,
35 				      int flag)
36 {
37 	return tree_conn->flags & flag;
38 }
39 
40 struct ksmbd_session;
41 
42 struct ksmbd_tree_conn_status
43 ksmbd_tree_conn_connect(struct ksmbd_session *sess, char *share_name);
44 
45 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess,
46 			       struct ksmbd_tree_connect *tree_conn);
47 
48 struct ksmbd_tree_connect *ksmbd_tree_conn_lookup(struct ksmbd_session *sess,
49 						  unsigned int id);
50 
51 struct ksmbd_share_config *ksmbd_tree_conn_share(struct ksmbd_session *sess,
52 						 unsigned int id);
53 
54 int ksmbd_tree_conn_session_logoff(struct ksmbd_session *sess);
55 
56 #endif /* __TREE_CONNECT_MANAGEMENT_H__ */
57