|
static bool | checkFSImage (const std::string &filepath, uid_t userId, const std::string &fs, bool fix=true) |
| Checks if the given fs image exists and is mountable.
|
|
static bool | checkFSImageAt (int dirFd, const std::string &filepath, uid_t userId, const std::string &fs, bool fix=true) |
|
static bool | createFSImage (const std::string &filepath, uid_t userId, size_t size, const std::string &fs) |
| Create a filesystem image of the given size and format.
|
|
static bool | createFSImageAt (int dirFd, const std::string &filepath, uid_t userId, size_t size, const std::string &fs) |
|
static void | deleteFSImage (const std::string &filepath) |
| Removes a package's private data image file.
|
|
static void | deleteFSImageAt (int dirFd, const std::string &filepath) |
|
|
static const std::string | xAttrUserIdName = "user.storage.plugin" |
|
◆ checkFSImage()
bool ImageManager::checkFSImage |
( |
const std::string & |
filepath, |
|
|
uid_t |
userId, |
|
|
const std::string & |
fs, |
|
|
bool |
fix = true |
|
) |
| |
|
static |
Checks if the given fs image exists and is mountable.
The function will fail in the following cases:
- the image file doesn't exist
- xattr are supported and the value for the "user.storage.plugin" doesn't match the supplied userId
- the image file exists but fsck.ext failed and it couldn't correct the errors
If the file system image existed and fsck validated (or repaired) it, true is returned.
- Parameters
-
[in] | filepath | The fully qualified path to the filesystem image |
[in] | userId | The expected user id set in the xattr of the image file |
[in] | fix | If true and the filesystem image exists but is corrupt it will attempt to fix the corruption. |
- Returns
- true on success and false on the failure.
◆ createFSImage()
bool ImageManager::createFSImage |
( |
const std::string & |
filepath, |
|
|
uid_t |
userId, |
|
|
size_t |
size, |
|
|
const std::string & |
fs |
|
) |
| |
|
static |
Create a filesystem image of the given size and format.
This function creates an empty file of the given size and then uses one of the mkfs tools to write a file system structure into the file.
- Warning
- If this function aborts in the middle of the process there is a possibility it could leak temporary files. Some sort of clean-up needs be down at start-up to remove previous temporary files.
- Parameters
-
[in] | filepath | The fully qualified path to the filesystem image |
[in] | userId | The user id to set set in the xattr of the image |
[in] | size | This size of the image to create in bytes |
[in] | fs | The filesystem type of image file (ext4) |
- Returns
- true on success and false on the failure.
◆ deleteFSImage()
void ImageManager::deleteFSImage |
( |
const std::string & |
filepath | ) |
|
|
static |
Removes a package's private data image file.
Simply a wrapper around the unlink call.
- Parameters
-
[in] | filepath | The fully qualified path to the filesystem image |
The documentation for this class was generated from the following files:
- rdkPlugins/Storage/source/ImageManager.h
- rdkPlugins/Storage/source/ImageManager.cpp