1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * fs/hmdfs/hmdfs_server.h
4 *
5 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
6 */
7
8 #ifndef HMDFS_SERVER_H
9 #define HMDFS_SERVER_H
10
11 #include "hmdfs.h"
12 #include "comm/transport.h"
13 #include "comm/socket_adapter.h"
14
15 #define DATA_SEC_LEVEL0 0
16 #define DATA_SEC_LEVEL1 1
17 #define DATA_SEC_LEVEL2 2
18 #define DATA_SEC_LEVEL3 3
19 #define DATA_SEC_LEVEL4 4
20 #define DATA_SEC_LEVEL_LABEL "user.security"
21 #define DATA_SEC_LEVEL_LENGTH 10
22
hmdfs_send_err_response(struct hmdfs_peer * con,struct hmdfs_head_cmd * cmd,int err)23 static inline void hmdfs_send_err_response(struct hmdfs_peer *con,
24 struct hmdfs_head_cmd *cmd, int err)
25 {
26 if (hmdfs_sendmessage_response(con, cmd, 0, NULL, (__u32)err))
27 hmdfs_warning("send err failed");
28 }
29
30 void hmdfs_server_open(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
31 void *data);
32 void hmdfs_server_atomic_open(struct hmdfs_peer *con,
33 struct hmdfs_head_cmd *cmd, void *data);
34 void hmdfs_server_fsync(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
35 void *data);
36 void hmdfs_server_release(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
37 void *data);
38 void hmdfs_server_readpage(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
39 void *data);
40 void hmdfs_server_readpages(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
41 void *data);
42 void hmdfs_server_readpages_open(struct hmdfs_peer *con,
43 struct hmdfs_head_cmd *cmd, void *data);
44 void hmdfs_server_writepage(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
45 void *data);
46
47 void hmdfs_server_readdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
48 void *data);
49
50 void hmdfs_server_mkdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
51 void *data);
52
53 void hmdfs_server_create(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
54 void *data);
55
56 void hmdfs_server_rmdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
57 void *data);
58
59 void hmdfs_server_unlink(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
60 void *data);
61
62 void hmdfs_server_rename(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
63 void *data);
64
65 void hmdfs_server_setattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
66 void *data);
67 void hmdfs_server_getattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
68 void *data);
69 void hmdfs_server_statfs(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
70 void *data);
71 void hmdfs_server_syncfs(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
72 void *data);
73 void hmdfs_server_getxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
74 void *data);
75 void hmdfs_server_setxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
76 void *data);
77 void hmdfs_server_listxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
78 void *data);
79 void hmdfs_server_get_drop_push(struct hmdfs_peer *con,
80 struct hmdfs_head_cmd *cmd, void *data);
81
82 void __init hmdfs_server_add_node_evt_cb(void);
83 #endif
84