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 
16 #ifndef MOUNT_POINT_H
17 #define MOUNT_POINT_H
18 
19 #include <atomic>
20 #include <functional>
21 
22 #include "dfsu_mount_argument_descriptors.h"
23 #include "nocopyable.h"
24 
25 namespace OHOS {
26 namespace Storage {
27 namespace DistributedFile {
28 class MountPoint final : public NoCopyable {
29 public:
30     MountPoint(const Utils::MountArgument &mountArg);
31     ~MountPoint() = default;
32 
GetID()33     uint32_t GetID() const
34     {
35         return id_;
36     };
37 
isAccountLess()38     bool isAccountLess() const
39     {
40         return mountArg_.accountless_;
41     };
42 
43     std::string ToString() const;
44     Utils::MountArgument GetMountArgument() const;
45     bool operator==(const MountPoint &rop) const;
46 
47 private:
48     friend class OsAccountObserver;
49     Utils::MountArgument mountArg_;
50     void Mount() const;
51     void Umount() const;
52     static std::atomic<uint32_t> idGen_;
53     uint32_t id_ {0};
54 };
55 } // namespace DistributedFile
56 } // namespace Storage
57 } // namespace OHOS
58 #endif // MOUNT_POINT_H