softwarecontainer
0.18.0-739e8d7 2017-05-04
|
Public Member Functions | |
bool | bindMount (const std::string &src, const std::string &dst, const std::string &tmpContainerRoot, bool readOnly, bool writeBufferEnabled=false) |
bindMount Bind mount a src directory to another position dst. More... | |
bool | tmpfsMount (const std::string dst, const int maxSize) |
tmpfsMount Mount a tmpfs in the dst path and limit size of the tmpfs to maxSize More... | |
Protected Member Functions | |
bool | writeToFile (const std::string &path, const std::string &content) |
void | markFileForDeletion (const std::string &path) |
bool | overlayMount (const std::string &lower, const std::string &upper, const std::string &work, const std::string &dst) |
overlayMount Mount a directory with an overlay on top of it. More... | |
bool | syncOverlayMount (const std::string &lower, const std::string &upper) |
syncOverlayMount Copy the directory structure from upper layer to the lower layer More... | |
bool | createSharedMountPoint (const std::string &path) |
createSharedMountPoint Make the mount point shared, ie new mount points created in one bind mount will also be created in the other mount point. More... | |
bool | pathInList (const std::string path) |
checks whether given path is already added to clean up handlers or not More... | |
Protected Attributes | |
std::vector< std::unique_ptr< CleanUpHandler > > | m_cleanupHandlers |
m_cleanupHandlers A vector of cleanupHandlers added during the lifetime of the FileToolKitWithUndo that will be run from the destructor. More... | |
std::vector< std::unique_ptr< CreateDir > > | m_createDirList |
m_createDirList A vector of CreateDir classes. More... | |
Definition at line 28 of file filetoolkitwithundo.h.
bool softwarecontainer::FileToolkitWithUndo::bindMount | ( | const std::string & | src, |
const std::string & | dst, | ||
const std::string & | tmpContainerRoot, | ||
bool | readOnly, | ||
bool | writeBufferEnabled = false |
||
) |
bindMount Bind mount a src directory to another position dst.
src | Path to mount from |
dst | Path to mount to |
readOnly | Make the bind mount destination read only |
writeBufferEnabled | Enable write buffers on the bind mount. |
Definition at line 53 of file filetoolkitwithundo.cpp.
References softwarecontainer::existsInFileSystem(), softwarecontainer::isDirectory(), and m_createDirList.
Referenced by softwarecontainer::Container::bindMountInContainer().
bool softwarecontainer::FileToolkitWithUndo::tmpfsMount | ( | const std::string | dst, |
const int | maxSize | ||
) |
tmpfsMount Mount a tmpfs in the dst path and limit size of the tmpfs to maxSize
dst | The destination to mount a tmpfs on |
maxSize | The max size of the tmpfs being mounted |
Definition at line 177 of file filetoolkitwithundo.cpp.
References softwarecontainer::isDirectoryEmpty(), m_cleanupHandlers, and m_createDirList.
Referenced by softwarecontainer::SoftwareContainer::SoftwareContainer().
|
protected |
overlayMount Mount a directory with an overlay on top of it.
An overlay protects the lower filesystem from writes by writing to the upper file system through the work directory.
lower | The lower file system, this will be read only. |
upper | The upper file system, this can be a tmpfs/ramfs of some kind. This is where final writes wind up |
work | This is a work directory, preferably a tmpfs/ramfs of some kind. This is where writes wind up temporarily. |
dst | Where the overlay filesystem will be mounted. |
Definition at line 130 of file filetoolkitwithundo.cpp.
References m_cleanupHandlers, and m_createDirList.
Referenced by softwarecontainer::Container::create().
|
protected |
syncOverlayMount Copy the directory structure from upper layer to the lower layer
lower | The lower layer used in an overlay file system. |
upper | The upper layer in an overlay file system. |
Definition at line 171 of file filetoolkitwithundo.cpp.
References softwarecontainer::RecursiveCopy::copy(), and softwarecontainer::RecursiveCopy::getInstance().
|
protected |
createSharedMountPoint Make the mount point shared, ie new mount points created in one bind mount will also be created in the other mount point.
path | The mount path to make shared. |
Definition at line 206 of file filetoolkitwithundo.cpp.
References m_cleanupHandlers.
Referenced by softwarecontainer::Container::initialize().
|
protected |
checks whether given path is already added to clean up handlers or not
This function will be called only before adding new CleanUpHandler for FileCleanUpHandler and DirectoryCleanUpHandler. The reason behind this, only indicated CleanUpHandlers are related with file/directory removal operations.
a | string path name to check |
Definition at line 232 of file filetoolkitwithundo.cpp.
References m_cleanupHandlers.
Referenced by softwarecontainer::Container::bindMountInContainer().
|
protected |
m_cleanupHandlers A vector of cleanupHandlers added during the lifetime of the FileToolKitWithUndo that will be run from the destructor.
Definition at line 121 of file filetoolkitwithundo.h.
Referenced by softwarecontainer::Container::bindMountInContainer(), createSharedMountPoint(), overlayMount(), pathInList(), and tmpfsMount().
|
protected |
m_createDirList A vector of CreateDir classes.
This class handles directory cleaning operations when either interfered errors or when its destructor runs.
Definition at line 127 of file filetoolkitwithundo.h.
Referenced by bindMount(), softwarecontainer::Container::bindMountInContainer(), softwarecontainer::Container::initialize(), overlayMount(), softwarecontainer::SoftwareContainer::previouslyConfigured(), and tmpfsMount().