sisong / HDiffPatch

a C\C++ library and command-line tools for Diff & Patch between binary files or directories(folder); cross-platform; runs fast; create small delta/differential; support large files and limit memory requires when diff & patch.
Other
1.52k stars 280 forks source link

Add support for block devices #344

Closed uglym8 closed 1 year ago

uglym8 commented 1 year ago

Hey, This PR adds support for block devices to be used as source or destination. You can test it using loop devices before trying on real ones.

diff generation:

$ sudo ./hdiffz -c-zstd /dev/loop0 /dev/loop1 9_13_over_loop.hdiffz
old : "/dev/loop0"
new : "/dev/loop1"
out : "9_13_over_loop.hdiffz"
hdiffz run with compress plugin: "zstd"
oldDataSize : 1073741824
newDataSize : 1073741824
diffDataSize: 5997552
diff    time: 12.737 s
  out diff file ok!

load diffFile for test by patch:
diffDataSize: 5997552
patch   time: 0.269 s
  patch check diff data ok!

all   time: 13.024 s

diff application:

$ sudo ./hpatchz -f /dev/loop0 9_13_over_loop.hdiffz /dev/loop1 
old : "/dev/loop0"
diff: "9_13_over_loop.hdiffz"
out : "/dev/loop1"
hpatchz run with decompress plugin: "zstd" (need decompress 4)
oldDataSize : 1073741824
diffDataSize: 5997552
newDataSize : 1073741824
  patch ok!

hpatchz time: 1.200 s
sisong commented 1 year ago

ref #337