Reword copyright notices on code in third_party for clarity.
[cumulus.git] / third_party / chunk.h
1 /* Cumulus: Efficient Filesystem Backup to the Cloud
2  * Copyright (C) 2006-2008  The Regents of the University of California
3  * Written by Michael Vrable <mvrable@cs.ucsd.edu>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19
20 /* Compute incremental backups at a sub-file level by chopping files up into
21  * blocks in a content-sensitive manner (using Rabin fingerprints). */
22
23 #ifndef _LBS_CHUNK_H
24 #define _LBS_CHUNK_H
25
26 #include <stdint.h>
27 #include <string>
28
29 /* Block breakpoints can only be computed for a single block of memory, all
30  * loaded at once.  compute_breaks will, given a block of memory, compute the
31  * offsets at which successive blocks should end.  These will be stored into
32  * the provided memory at breakpoints.  The maximum possible number of blocks
33  * (given the block size constaints) can be computed by compute_max_num_breaks
34  * so that the breakpoints array can be properly sized.  The actual number of
35  * blocks is returned by the compute_breaks function. */
36 int chunk_compute_max_num_breaks(size_t buflen);
37 int chunk_compute_breaks(const char *buf, size_t len, size_t *breakpoints);
38 std::string chunk_algorithm_name();
39
40 #endif // _LBS_CHUNK_H