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_writepage(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
41 void *data);
42
43 void hmdfs_server_readdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
44 void *data);
45
46 void hmdfs_server_mkdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
47 void *data);
48
49 void hmdfs_server_create(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
50 void *data);
51
52 void hmdfs_server_rmdir(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
53 void *data);
54
55 void hmdfs_server_unlink(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
56 void *data);
57
58 void hmdfs_server_rename(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
59 void *data);
60
61 void hmdfs_server_setattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
62 void *data);
63 void hmdfs_server_getattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
64 void *data);
65 void hmdfs_server_statfs(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
66 void *data);
67 void hmdfs_server_syncfs(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
68 void *data);
69 void hmdfs_server_getxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
70 void *data);
71 void hmdfs_server_setxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
72 void *data);
73 void hmdfs_server_listxattr(struct hmdfs_peer *con, struct hmdfs_head_cmd *cmd,
74 void *data);
75 void hmdfs_server_get_drop_push(struct hmdfs_peer *con,
76 struct hmdfs_head_cmd *cmd, void *data);
77
78 void __init hmdfs_server_add_node_evt_cb(void);
79 #endif
80