Loading...
Searching...
No Matches
Tiny VCDIFF

Decoder for interleaved VCDIFF deltas. More...

Detailed Description

Decoder for interleaved VCDIFF deltas.

Introduction

tiny-vcdiff is a decoder for binary delta files that have been generated by open-vcdiff in the interleaved format.

Usage

Every delta requires a source (the known data) and a target (the reconstructed data). This implementation provides backends for the Memory Technology Device and Virtual File System (VFS) layer storage drivers.

Example

The example down below uses a Memory Technology Device device as known source data and writes the resulting target data into a Virtual File System (VFS) layer file.

#include "vcdiff.h"
#include "vcdiff_mtd.h"
#include "vcdiff_vfs.h"
int apply_delta (const uint8_t *data, size_t data_len,
mtd_dev_t *source_mtd,
int traget_fd)
{
int rc;
vcdiff_t vcdiff;
vcdiff_init(&vcdiff);
/* make sure source_mtd is already powered on */
vcdiff_mtd_t source = VCDIFF_MTD_INIT(source_mtd);
vcdiff_set_source_driver(&vcdiff, &vcdiff_mtd_driver, &source);
/* make sure the vfs file is already opened for writing */
vcdiff_vfs_t target = VCDIFF_VFS_INIT(fd_target);
vcdiff_set_target_driver(&vcdiff, &vcdiff_vfs_driver, &target);
rc = vcdiff_apply_delta(&vcdiff, data, data_len);
if (rc != 0) {
return rc;
}
rc = vcdiff_finish(&vcdiff);
return rc;
}
MTD device descriptor.
Definition mtd.h:112
Context for the underlying MTD device.
Definition vcdiff_mtd.h:43
Context for the underlying file.
Definition vcdiff_vfs.h:36
const vcdiff_driver_t vcdiff_mtd_driver
Driver for accessing MTD devices.
#define VCDIFF_MTD_INIT(DEV)
Initializes vcdiff_mtd_t.
Definition vcdiff_mtd.h:68
const vcdiff_driver_t vcdiff_vfs_driver
Driver for accessing VFS-based file access.
#define VCDIFF_VFS_INIT(FD)
Initializes vcdiff_vfs_t.
Definition vcdiff_vfs.h:49

License

Licensed under MIT.

See also
https://github.com/jue89/tiny-vcdiff.git

Files

file  vcdiff_mtd.h
 
file  vcdiff_vfs.h