mirror of
https://github.com/AltraMayor/f3.git
synced 2025-12-13 20:39:59 +01:00
f3probe: protect block device
This patch makes f3probe read and save in memory the content of all written blocks before writting them during the probe, and restore the original content of those blocks after probing the device. In order words, f3probe behaves likes the probed device were read only. All the necessary memory to protect the probed device is preallocated, so an on-going probe does not fail due to lack of memory. Although this feature adds an important protection layer, users should be conscious that things can go wrong, and the data will be lost. This patch also adds option --debug-keep-file to help debugging the new code this patch adds, and option --destructive to disable the protection.
This commit is contained in:
@@ -34,12 +34,15 @@ struct device;
|
||||
|
||||
struct device *create_file_device(const char *filename,
|
||||
uint64_t real_size_byte, uint64_t fake_size_byte, int wrap,
|
||||
int block_order);
|
||||
int block_order, int keep_file);
|
||||
|
||||
struct device *create_block_device(const char *filename);
|
||||
|
||||
struct device *create_safe_device(struct device *dev, int max_blocks);
|
||||
|
||||
void free_device(struct device *dev);
|
||||
|
||||
int probe_device_max_blocks(struct device *dev);
|
||||
void probe_device(struct device *dev, uint64_t *preal_size_byte,
|
||||
uint64_t *pannounced_size_byte, int *pwrap, int *block_order);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user