1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef STORAGE_SERVICE_UTILS_ERRNO_H
16 #define STORAGE_SERVICE_UTILS_ERRNO_H
17 
18 #include <sys/types.h>
19 #include <unordered_map>
20 
21 namespace OHOS {
22 constexpr int32_t E_ERR = -1;
23 constexpr int32_t STORAGE_SERVICE_SYS_CAP_TAG = 13600000;
24 
25 enum ErrNo {
26     E_OK = 0,
27     E_PERMISSION_DENIED = 1,    // no permission
28     E_WRITE_DESCRIPTOR_ERR = 2, // ipc error
29     E_EXIST = 3,                // exist
30     E_WRONG_TYPE = 4,           // wrong file type
31     E_USER_STATE = 5,           // wrong user state
32     E_NON_EXIST = 6,            // no such item
33     E_PREPARE_DIR = 7,          // failed to prepare dir
34     E_DESTROY_DIR = 8,          // failed to destroy dir
35     E_MOUNT,                    // mount error
36     E_UMOUNT,                   // umount error
37     E_SET_POLICY,               // set policy error
38     E_USERID_RANGE,             // id out or range
39     E_VOL_STATE,                // volume state check fail
40     E_WAIT,                     // wait
41     E_NOT_SUPPORT,              // not support
42     E_SYS_CALL,                 // syscall error
43     E_NO_CHILD,                 // child not exist
44     E_WRITE_PARCEL_ERR,
45     E_WRITE_REPLY_ERR,
46     E_SA_IS_NULLPTR,
47     E_REMOTE_IS_NULLPTR,
48     E_SERVICE_IS_NULLPTR,
49     E_DEATH_RECIPIENT_IS_NULLPTR,
50     E_BUNDLEMGR_ERROR,
51     E_MEDIALIBRARY_ERROR,
52     E_SYS_ERR,
53     E_KEY_TYPE_INVAL,
54     E_DIFF_UID_GID,
55     E_PARAMS_INVAL,
56     E_ACTIVE_EL2_FAILED,
57     E_CLEAR_KEY_FAILED,
58     E_KEY_NOT_ACTIVED,
59     E_MTP_IS_MOUNTING,
60     E_MTP_PREPARE_DIR_ERR,
61     E_MTP_MOUNT_FAILED,
62     E_MTP_UMOUNT_FAILED,
63 };
64 
65 enum JsErrCode {
66     E_PERMISSION = 201,
67     E_PERMISSION_SYS = 202,
68     E_PARAMS = 401,
69     E_DEVICENOTSUPPORT = 801,
70     E_OSNOTSUPPORT = 901,
71     E_IPCSS = STORAGE_SERVICE_SYS_CAP_TAG + 1,
72     E_SUPPORTEDFS,
73     E_MOUNT_ERR,
74     E_UNMOUNT,
75     E_VOLUMESTATE,
76     E_PREPARE,
77     E_DELETE,
78     E_NOOBJECT,
79     E_OUTOFRANGE,
80 };
81 
82 }
83 #endif // STORAGE_SERVICE_UTILS_ERRNO_H