diff options
Diffstat (limited to 'src/tools/imgtool/library.h')
-rw-r--r-- | src/tools/imgtool/library.h | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/src/tools/imgtool/library.h b/src/tools/imgtool/library.h index 6dc9ea8224b..7406cc2e526 100644 --- a/src/tools/imgtool/library.h +++ b/src/tools/imgtool/library.h @@ -26,7 +26,6 @@ #include "stream.h" #include "unicode.h" #include "charconv.h" -#include "pool.h" #include "timeconv.h" namespace imgtool @@ -459,39 +458,39 @@ char *imgtool_temp_str(void); struct imgtool_module { - imgtool_class imgclass; + imgtool_class imgclass = { 0 }; - const char *name; - const char *description; - const char *extensions; - const char *eoln; + std::string name; + std::string description; + std::string extensions; + std::string eoln; - size_t image_extra_bytes; + size_t image_extra_bytes = 0; /* flags */ - unsigned int initial_path_separator : 1; - unsigned int open_is_strict : 1; - unsigned int tracks_are_called_cylinders : 1; /* used for hard drivers */ - unsigned int writing_untested : 1; /* used when we support writing, but not in main build */ - unsigned int creation_untested : 1; /* used when we support creation, but not in main build */ - - imgtoolerr_t (*open) (imgtool::image &image, imgtool::stream::ptr &&stream); - void (*close) (imgtool::image &image); - void (*info) (imgtool::image &image, std::ostream &stream); - imgtoolerr_t (*create) (imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *opts); - imgtoolerr_t (*get_geometry) (imgtool::image &image, uint32_t *track, uint32_t *heads, uint32_t *sectors); - imgtoolerr_t (*read_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer); - imgtoolerr_t (*write_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len); - imgtoolerr_t (*read_block) (imgtool::image &image, void *buffer, uint64_t block); - imgtoolerr_t (*write_block) (imgtool::image &image, const void *buffer, uint64_t block); - imgtoolerr_t (*list_partitions)(imgtool::image &image, std::vector<imgtool::partition_info> &partitions); - - uint32_t block_size; - - const util::option_guide *createimage_optguide; - const char *createimage_optspec; - - const void *extra; + bool initial_path_separator = false; + bool open_is_strict = false; + bool tracks_are_called_cylinders = false; /* used for hard drivers */ + bool writing_untested = false; /* used when we support writing, but not in main build */ + bool creation_untested = false; /* used when we support creation, but not in main build */ + + imgtoolerr_t (*open) (imgtool::image &image, imgtool::stream::ptr &&stream) = nullptr; + void (*close) (imgtool::image &image) = nullptr; + void (*info) (imgtool::image &image, std::ostream &stream) = nullptr; + imgtoolerr_t (*create) (imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *opts) = nullptr; + imgtoolerr_t (*get_geometry) (imgtool::image &image, uint32_t *track, uint32_t *heads, uint32_t *sectors) = nullptr; + imgtoolerr_t (*read_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, std::vector<uint8_t> &buffer) = nullptr; + imgtoolerr_t (*write_sector) (imgtool::image &image, uint32_t track, uint32_t head, uint32_t sector, const void *buffer, size_t len) = nullptr; + imgtoolerr_t (*read_block) (imgtool::image &image, void *buffer, uint64_t block) = nullptr; + imgtoolerr_t (*write_block) (imgtool::image &image, const void *buffer, uint64_t block) = nullptr; + imgtoolerr_t (*list_partitions)(imgtool::image &image, std::vector<imgtool::partition_info> &partitions) = nullptr; + + uint32_t block_size = 0; + + const util::option_guide *createimage_optguide = nullptr; + std::string createimage_optspec; + + const void *extra = nullptr; }; namespace imgtool { @@ -531,7 +530,6 @@ public: const modulelist &modules() { return m_modules; } private: - object_pool * m_pool; modulelist m_modules; // internal lookup and iteration @@ -540,11 +538,6 @@ private: // helpers void add_class(const imgtool_class *imgclass); int module_compare(const imgtool_module *m1, const imgtool_module *m2, sort_type sort); - - // memory allocators for pooled library memory (these should go away in further C++-ification) - void *imgtool_library_malloc(size_t mem); - char *imgtool_library_strdup(const char *s); - char *imgtool_library_strdup_allow_null(const char *s); }; } // namespace imgtool |