ARM: wire up memfd_create syscall
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / include / sdp / fs_request.h
CommitLineData
3c2a0909
S
1/*
2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3 *
4 * Sensitive Data Protection
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef FS_REQUEST_H_
21#define FS_REQUEST_H_
22
23#include <linux/slab.h>
24
25#define FSOP_SDP_SET_SENSITIVE 10
26#define FSOP_SDP_SET_PROTECTED 11
27
28#define FSOP_DLP_FILE_OPENED 21
29#define FSOP_DLP_FILE_CLOSED 22
30#define FSOP_DLP_FILE_INIT 23
31#define FSOP_DLP_FILE_INIT_RESTRICTED 24
32#define FSOP_DLP_FILE_REMOVE 25
33#define FSOP_DLP_FILE_RENAME 26
34#define FSOP_DLP_FILE_ACCESS_DENIED 27
35#define FSOP_DLP_FILE_OPENED_CREATOR 28
36#define FSOP_DLP_FILE_REMOVE_MEDIA 29
37
38#define FSOP_AUDIT_FAIL_ENCRYPT 51
39#define FSOP_AUDIT_FAIL_DECRYPT 52
40
41// opcode, ret, inode
42typedef void (*fs_request_cb_t)(int, int, unsigned long);
43
44typedef struct sdp_fs_command {
45 int req_id;
46
47 int opcode;
48 int user_id;
49 int part_id;
50 unsigned long ino;
51 int pid;
52}sdp_fs_command_t;
53
54extern int sdp_fs_request(sdp_fs_command_t *sdp_req, fs_request_cb_t callback);
55
56static inline sdp_fs_command_t *sdp_fs_command_alloc(int opcode, int pid,
57 int userid, int partid, unsigned long ino, gfp_t gfp) {
58 sdp_fs_command_t *cmd;
59
60 cmd = kmalloc(sizeof(sdp_fs_command_t), gfp);
61
9aaf89b0
S
62 if(cmd == NULL) {
63 printk(KERN_ERR "sdp_fs_command_alloc is failed\n");
64 return NULL;
65 }
66
3c2a0909
S
67 cmd->opcode = opcode;
68 cmd->pid = pid;
69 cmd->user_id = userid;
70 cmd->part_id = partid;
71 cmd->ino = ino;
72
73 return cmd;
74}
75
76static inline void sdp_fs_command_free(sdp_fs_command_t *cmd)
77{
78 kzfree(cmd);
79}
80
81#endif /* FS_REQUEST_H_ */