• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 
16 #ifndef OHOS_STORAGE_MANAGER_VOLUME_CORE_H
17 #define OHOS_STORAGE_MANAGER_VOLUME_CORE_H
18 
19 #include "parcel.h"
20 
21 namespace OHOS {
22 namespace StorageManager {
23 enum VolumeType {
24     EMULATED = 1,
25     EXTERNAL,
26 };
27 enum VolumeState {
28     UNMOUNTED = 0,
29     CHECKING,
30     MOUNTED,
31     EJECTING,
32     REMOVED,
33     BAD_REMOVAL,
34     DAMAGED,
35     FUSE_REMOVED,
36 };
37 class VolumeCore : public Parcelable {
38 public:
39     VolumeCore();
40     VolumeCore(std::string id, int32_t type, std::string diskId);
41     VolumeCore(std::string id, int32_t type, std::string diskId, int32_t state);
42 
43     std::string GetId() const;
44     int32_t GetType();
45     std::string GetDiskId();
46     int32_t GetState();
47     void SetState(int32_t state);
48 
49     bool Marshalling(Parcel &parcel) const override;
50     static VolumeCore *Unmarshalling(Parcel &parcel);
51 private:
52     std::string id_;
53     int32_t type_ {};
54     std::string diskId_;
55     int32_t state_ = UNMOUNTED;
56     bool errorFlag_ = false;
57 };
58 } // StorageManager
59 } // OHOS
60 
61 #endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H