Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
DynamicMountDetails.h
1 /*
2 * If not stated otherwise in this file or this component's LICENSE file the
3 * following copyright and licenses apply:
4 *
5 * Copyright 2022 Sky UK
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19 /*
20  * File: DynamicMountDetails.h
21  *
22  */
23 #ifndef DYNAMICMOUNTDETAILS_H
24 #define DYNAMICMOUNTDETAILS_H
25 
26 #include "MountProperties.h"
27 
28 #include <RdkPluginBase.h>
29 
30 #include <sys/types.h>
31 #include <string>
32 #include <memory>
33 
34 
35 // -----------------------------------------------------------------------------
47 {
48 public:
49  DynamicMountDetails() = delete;
53 
54 private:
55  friend class Storage;
56 
57 public:
58  DynamicMountDetails(const std::string& rootfsPath,
59  const DynamicMountProperties& mount,
60  const std::shared_ptr<DobbyRdkPluginUtils> &utils);
61 
62 public:
63  bool onCreateRuntime() const;
64  bool onCreateContainer() const;
65  bool onPostStop() const;
66 
67 private:
68  bool addMount() const;
69 
70  const std::string mRootfsPath;
71  DynamicMountProperties mMountProperties;
72  const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
73 };
74 
75 #endif // !defined(DYNAMICMOUNTDETAILS_H)
Class that represents a single mount within a container when the source exists on the host.
Definition: DynamicMountDetails.h:47
bool onPostStop() const
Unmounts dynamic mounts.
Definition: DynamicMountDetails.cpp:204
bool addMount() const
Add mount between source and destination.
Definition: DynamicMountDetails.cpp:239
bool onCreateContainer() const
Adds bind mount only if source exists on the host.
Definition: DynamicMountDetails.cpp:127
bool onCreateRuntime() const
Creates destination path so it exists before mounting.
Definition: DynamicMountDetails.cpp:54
Dobby RDK Storage Plugin.
Definition: Storage.h:45
DynamicMountProperties struct used for Storage plugin.
Definition: MountProperties.h:51