Skip to content
Snippets Groups Projects
  1. Nov 10, 2017
  2. Nov 08, 2017
  3. Nov 07, 2017
  4. Nov 02, 2017
  5. Oct 31, 2017
    • Tianjie Xu's avatar
      Add the brotli compressor for bsdiff · 1c26e2ed
      Tianjie Xu authored
      Add a new compressor interface; and the brotli compressor which is
      similar to the existing bz2 one.
      
      Also add a new CompressorType argument to PatchWriter's init function;
      this allows us to choose the right compressor based on the input option
      in the future.
      
      Bug: 34220646
      Test:  Run bsdiff/bspatch with brotli compressor/decompressor over a
      list of files from angler's system image. Make succeeds.
      Change-Id: Id9a3db2d7d051dcb751a1fc362f4c3b9226e878b
      1c26e2ed
  6. Oct 27, 2017
    • Alex Deymo's avatar
      Merge changes Idfaedbd4,I17aac1d3,I1f005f10,I01eded0b,I26846be9 · e0c9ef7e
      Alex Deymo authored
      * changes:
        Pass the size of the new file to the PatchWriterInterface::Init()
        Cleanup bsdiff public API.
        Expose the PatchWriter generator in the public API.
        Correct SplitPatchWriter() comment.
        Add/remove includes to match used types.
      e0c9ef7e
    • Alex Deymo's avatar
      Pass the size of the new file to the PatchWriterInterface::Init() · 4dadd8b4
      Alex Deymo authored
      Most patch formats include the size of the new file in the header.
      To help streaming the patch to disk while generating it, this CL
      passes the size of the new file to the patch writer on initialization.
      
      To do this, we also move the Init() call to the patch writer to the
      DiffEncoder, which makes more sense since the Close() call is also made
      from the DiffEnconder.
      
      Bug: None
      Test: Updated tests to check for this value.
      Change-Id: Idfaedbd492d68ab6e6cb2c1cb3883947f068c3aa
      4dadd8b4
    • Alex Deymo's avatar
      Cleanup bsdiff public API. · e4458302
      Alex Deymo authored
      The original function used to generate a patch from two files is no
      longer used elsewhere so this patch removes it in favour of the newer
      version that takes the streams from memory buffers and uses a patch
      writer to generate the patch.
      
      Bug: None.
      Test: Ran `bsdiff` manually, verified bspatch applied correctly.
      
      Change-Id: I17aac1d3dd405d733ff6dc35abe8e683adea0d4f
      e4458302
    • Alex Deymo's avatar
      Expose the PatchWriter generator in the public API. · 8a179e5e
      Alex Deymo authored
      We want to expose the patch writers constructors in the public API
      without necesarily exposing the internal details. For that, we use a
      factory in the public API so callers can create the PatchWriters they
      need.
      
      We will extend this file with new patch formats.
      
      Bug: 34220646
      Test: Used this interface from the bsdiff_main.cc (see follow up CL).
      Change-Id: I1f005f103886579eacf37b7d9767b713e066030c
      8a179e5e
    • Alex Deymo's avatar
      Correct SplitPatchWriter() comment. · 30964e83
      Alex Deymo authored
      Bug: None
      Test: Compiles.
      Change-Id: I01eded0b094083eb79ccc4c59458e1b88952145d
      30964e83
    • Alex Deymo's avatar
      Add/remove includes to match used types. · ea72d9f6
      Alex Deymo authored
      uint64_t and similar types are defined in stdint.h, and size_t is
      defined in stddef.h. While these headers are included virtually
      everywhere anyways we should include what we use, specially in public
      headers.
      
      Bug: None
      Test: still compiles.
      
      Change-Id: I26846be960bf9c989372a05e9c4369caf02888cd
      ea72d9f6
    • Alex Deymo's avatar
      e3f27662
    • Tianjie Xu's avatar
      Merge "Add an interface for bspatch reader" · 68540f68
      Tianjie Xu authored
      68540f68
  7. Oct 26, 2017
    • Tianjie Xu's avatar
      Add an interface for bspatch reader · 65288122
      Tianjie Xu authored
      Add a wrapper class to separate the patch read from data stream
      decompression. Therefore, bspatch will be able to process the patch
      that is compressed with various tools.
      
      Test: unittest pass
      Change-Id: I5214e0451bde80366e8a70b960703afb2b2a7d97
      65288122
    • Alex Deymo's avatar
      Add some more checkings to the DiffEncoder. · aefc253c
      Alex Deymo authored
      Check that we don't attempt to use the region outside the old file.
      While this is supported by our decoder, there's no reason why we should
      do that and it often means a bug in the encoder.
      
      Bug: None
      Test: Added unittests that would fail without the fixes.
      Change-Id: Ifd6d8763ae4e6b3f29a5a1289f22900a278dd1b0
      aefc253c
  8. Oct 24, 2017
  9. Oct 20, 2017
    • Alex Deymo's avatar
      Select SuffixArray size at runtime. · 48ad5ab7
      Alex Deymo authored
      The suffix array is used to search for strings from the new file in the
      old file. The size of each element of the suffix array must be big
      enough to hold the length of the old file. In most of the cases we use,
      if not all of them, the old file is smaller than 2 GiB, which allows to
      use 32-bit integers for the suffix array.
      
      The previous code decided whether to use 64-bit or 32-bit integers
      based on the large-file surpport, even in 32-bit computers architectures
      which would not work in those cases; and would also use twice as much
      memory when constructing the suffix array of inputs smaller than 2 GiB.
      
      This patch selects the suffix array size based on the input size,
      effectively using half the memory in the most common case. This also
      improves the runtime performance due to lower cache pressure.
      
      As a side effect, this patch hides the suffix array implementation
      details from the public interface. This removes the limitation where
      the caller of libbsdiff and libbsdiff needed to be compiled with the
      same large-file support flags; and also hides the dependency on
      libdivsufsort from the public interface.
      
      While doing so, instead of re-implementing the suffix array search
      algorithm (which had a history of bugs and corner cases) we re-use the
      one from libdivsufsort, adapted to the bsdiff algorithm use-case.
      
      The result is about 40% faster when diffing 10MiB files, and the patch
      size is within 0.1%, due to differences in the position selected
      whenever more than one match is available.
      
      Bug: 34220646
      Test: Added unittests for the suffix array.
      
      Change-Id: Ib9dc85a83bbf10157a3937c5687e5663ab0d20d5
      48ad5ab7
  10. Oct 11, 2017
  11. Oct 09, 2017
    • Alex Deymo's avatar
      Merge "Reduce PatchWriterInterface functionality." · ac6eabf6
      Alex Deymo authored
      am: f356f501
      
      Change-Id: I67fd6ee62c22784c228c21c8eac5d35c3e745e5e
      ac6eabf6
    • Treehugger Robot's avatar
    • Alex Deymo's avatar
      Reduce PatchWriterInterface functionality. · 68c0e7f2
      Alex Deymo authored
      The recently introduced PatchWriterInterface had both the patch file
      format logic and the diff/extra streams selection from the control
      entries. While this simplifies the bsdiff main algorithm and makes
      invalid usages of the BsdiffPatchWriter evident, writing alternative
      PatchWriterInterface classes required to replicate the diff/extra
      stream selection logic.
      
      This patch splits out the diff/extra stream generation and all the
      checks around those to a new helper class DiffEncoder. The public
      interface PatchWriterInterface now has two methods to accept the diff
      and extra stream data, and does not compute them.
      
      Bug: 34220646
      Test: Added unittests. Ran bsdiff on some pairs of files obtaining the same result as before.
      Change-Id: I5f303c06f1e10910eb00dcfda38c6811977a91cf
      68c0e7f2
  12. Sep 29, 2017
  13. Sep 28, 2017
    • Alex Deymo's avatar
      Add unittest for the PatchWriter. · fb3b632f
      Alex Deymo authored
      Split the unittest logic between bsdiff() function and the PatchWriter.
      This patch now tests individually the PatchWriter logic that writes to
      disk and the bsdiff() logic to create patches in the same very simple
      cases.
      
      We also update the Android.bp file to only pass -DBSDIFF_TARGET_UNITTEST
      when building for the target.
      
      Bug: 34220646
      Test: ran unittests.
      
      Change-Id: I9350157ee4a0b5a617f44bb187bd7652f6d6f017
      fb3b632f
    • Alex Deymo's avatar
      Make BsdiffPatchWriter into an Interface. · 538a75d1
      Alex Deymo authored
      Currently, all bsdiff() functions take a filename for the patch, which
      is called with a temporary file in all cases. To help expose an
      interface that allows to write bsdiff patches in different formats (for
      example, changing the compressor and header format) we expose the
      PatchWriterInterface class in the public interface so callers can use
      a different one or define their own to help experimenting with bsdiff
      enconding improvements.
      
      Bug: 34220646
      Test: make bsdiff and update_engine; ran bsdiff_unittest
      
      Change-Id: Ie450b2790137665bc033cb36d037171090b18a4b
      538a75d1
    • Alex Deymo's avatar
      Update .gitignore to exclude tracked files. · f9331d61
      Alex Deymo authored
      .gitignore was ignoring all the files in the include/bsdiff/ directory
      because the path includes "bsdiff". This fixes it to ignore only the
      "bsdiff" path on the root directory.
      
      Bug: None
      Test: git ls-files -i --exclude-standard
      Change-Id: Icc85d8b4b6214786cdf13b3e886e2d7240bbccdb
      f9331d61
  14. Sep 27, 2017
  15. Sep 26, 2017
    • Alex Deymo's avatar
      Include missing header. · 35fd1e0c
      Alex Deymo authored
      Include stdint.h for uint64_t. Also remove a redundant return at the
      end of a function.
      
      Bug: None
      Test: make
      Change-Id: I7712bd8020bc063463f5fee09fa05439b462cfac
      35fd1e0c
  16. Sep 25, 2017
  17. Sep 20, 2017
Loading