#include <locate_images.h>
Data Structures | |
struct | matcher |
base class for matcher functors object More... | |
Public Member Functions | |
extra_images () | |
void | populate (std::vector< std::string > const &paths, std::string const &archive_path, std::string const &root_path) |
std::vector< std::string > const | find (matcher const &match) const |
std::vector< std::string > const | find (std::string const &name) const |
return a vector of all directories that match the given name | |
std::string const | find_image_path (std::string const &image_name, image_error &error, bool fixup) const |
std::string | get_archive_path () const |
return the archive path used to populate the images name map | |
std::string | strip_path_prefix (std::string const &image) const |
int | get_uid () const |
return the uid for this extra_images, first valid uid is 1 | |
Private Types | |
typedef std::multimap < std::string, std::string > | images_t |
typedef images_t::value_type | value_type |
typedef images_t::const_iterator | const_iterator |
Private Member Functions | |
void | populate (std::vector< std::string > const &paths, std::string const &prefix_path) |
std::string const | locate_image (std::string const &image_name, image_error &error, bool fixup) const |
Private Attributes | |
images_t | images |
map from image basename to owning directory | |
std::string | archive_path |
the archive path passed to populate the images name map. | |
std::string | root_path |
int | uid |
unique identifier, first valid uid is 1 | |
Static Private Attributes | |
static int | suid |
unique uid generator |
A class containing mappings from an image basename, such as 'floppy.ko', to locations in the paths passed in to populate().
The name may exist multiple times; all locations are recorded in this container.
Definition at line 29 of file locate_images.h.
typedef images_t::const_iterator extra_images::const_iterator [private] |
Definition at line 91 of file locate_images.h.
typedef std::multimap<std::string, std::string> extra_images::images_t [private] |
Definition at line 89 of file locate_images.h.
typedef images_t::value_type extra_images::value_type [private] |
Definition at line 90 of file locate_images.h.
extra_images::extra_images | ( | ) |
Definition at line 26 of file locate_images.cpp.
std::vector<std::string> const extra_images::find | ( | std::string const & | name | ) | const |
return a vector of all directories that match the given name
vector< string > const extra_images::find | ( | extra_images::matcher const & | match | ) | const |
return a vector of all directories that match the functor
Definition at line 81 of file locate_images.cpp.
References images.
std::string const extra_images::find_image_path | ( | std::string const & | image_name, | |
image_error & | error, | |||
bool | fixup | |||
) | const |
image_name | binary image name | |
error | errors are flagged in this passed enum ref | |
fixup | if true return the fixed image name else always return image_name and update error |
Locate a (number of) matching absolute paths to the given image name. If we fail to find the file we fill in error and return the original string.
Referenced by image_name_storage::get_name(), and populate_for_image().
std::string extra_images::get_archive_path | ( | ) | const [inline] |
return the archive path used to populate the images name map
Definition at line 73 of file locate_images.h.
Referenced by report_image_error().
int extra_images::get_uid | ( | ) | const [inline] |
return the uid for this extra_images, first valid uid is 1
Definition at line 80 of file locate_images.h.
References uid.
Referenced by image_name_storage::get_name().
std::string const extra_images::locate_image | ( | std::string const & | image_name, | |
image_error & | error, | |||
bool | fixup | |||
) | const [private] |
void extra_images::populate | ( | std::vector< std::string > const & | paths, | |
std::string const & | prefix_path | |||
) | [private] |
void extra_images::populate | ( | std::vector< std::string > const & | paths, | |
std::string const & | archive_path, | |||
std::string const & | root_path | |||
) |
add all filenames found in the given paths prefixed by the archive path or the root path, recursively
std::string extra_images::strip_path_prefix | ( | std::string const & | image | ) | const |
Given an image name returned by find_image_path() return a filename with the archive_path or root_path stripped.
Referenced by parse_filename().
std::string extra_images::archive_path [private] |
the archive path passed to populate the images name map.
Definition at line 96 of file locate_images.h.
images_t extra_images::images [private] |
map from image basename to owning directory
Definition at line 94 of file locate_images.h.
Referenced by find().
std::string extra_images::root_path [private] |
A prefix added to locate binaries if they can't be found through the archive path
Definition at line 99 of file locate_images.h.
int extra_images::suid [static, private] |
unique uid generator
Definition at line 104 of file locate_images.h.
int extra_images::uid [private] |
unique identifier, first valid uid is 1
Definition at line 102 of file locate_images.h.
Referenced by get_uid().