mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-26 14:51:52 +03:00
fcbcb6b5a8
* toolbox: compress: moved decompressor implementation to separate func * toolbox: compress: callback-based api; cli: storage unpack command * toolbox: compress: separate r/w contexts for stream api * targets: f18: sync API * compress: naming fixes & cleanup * toolbox: compress: using hs buffer size for stream buffers * toolbox: tar: heatshrink stream mode * toolbox: compress: docs & small cleanup * toolbox: tar: header support for .hs; updater: now uses .hs for resources; .hs.tar: now rewindable * toolbox: compress: fixed hs stream tail handling * updater: reworked progress for resources cleanup; rebalanced stage weights * updater: single-pass decompression; scripts: print resources compression ratio * updater: fixed warnings * toolbox: tar: doxygen * docs: update * docs: info or tarhs format; scripts: added standalone compression/decompression tool for heatshrink-formatted streams * scripts: tarhs: fixed parameter handling * cli: storage extract command; toolbox: tar: guess type based on extension * unit_tests: added test for streamed raw hs decompressor `compress_decode_streamed` * unit_tests: compress: added extraction test for .tar.hs * rpc: autodetect compressed archives * scripts: minor cleanup of common parts * scripts: update: now using in-memory intermediate tar stream * scripts: added hs.py wrapper for heatshrink-related ops (single object and directory-as-tar compression) * scripts: naming fixes * Toolbox: export compress_config_heatshrink_default as const symbol * Toolbox: fix various types naming * Toolbox: more of types naming fixes * Toolbox: use size_t in compress io callbacks and structures * UnitTests: update to match new compress API * Toolbox: proper path_extract_extension usage Co-authored-by: あく <alleteam@gmail.com>
26 lines
942 B
C
26 lines
942 B
C
#include <core/record.h>
|
|
#include "storage.h"
|
|
#include <toolbox/tar/tar_archive.h>
|
|
|
|
FS_Error storage_int_backup(Storage* storage, const char* dstname) {
|
|
furi_check(storage);
|
|
|
|
TarArchive* archive = tar_archive_alloc(storage);
|
|
bool success = tar_archive_open(archive, dstname, TarOpenModeWrite) &&
|
|
tar_archive_add_dir(archive, STORAGE_INT_PATH_PREFIX, "") &&
|
|
tar_archive_finalize(archive);
|
|
tar_archive_free(archive);
|
|
return success ? FSE_OK : FSE_INTERNAL;
|
|
}
|
|
|
|
FS_Error
|
|
storage_int_restore(Storage* storage, const char* srcname, Storage_name_converter converter) {
|
|
furi_check(storage);
|
|
|
|
TarArchive* archive = tar_archive_alloc(storage);
|
|
bool success = tar_archive_open(archive, srcname, TarOpenModeRead) &&
|
|
tar_archive_unpack_to(archive, STORAGE_INT_PATH_PREFIX, converter);
|
|
tar_archive_free(archive);
|
|
return success ? FSE_OK : FSE_INTERNAL;
|
|
}
|