CRC, manber function header file. More...
#include "global.h"
#include "interface.h"
#include <subversion-1/svn_delta.h>
Go to the source code of this file.
Data Structures | |
struct | cs__manber_hashes |
This structure is used for one big file. More... | |
Functions | |
int | cs__compare_file (struct estat *sts, char *fullpath, int *result) |
Checks whether a file has changed. | |
char * | cs__md5tohex (const md5_digest_t md5, char *dest) |
Puts the hex string of md5 into dest, and returns dest. | |
char * | cs__md5tohex_buffered (const md5_digest_t md5) |
Converts an MD5 digest to an ASCII string in a self-managed buffer. | |
int | cs__char2md5 (const char *input, char **eos, md5_digest_t md5) |
Converts an ASCII string to an MD5 digest. | |
int | cs__set_file_committed (struct estat *sts) |
Callback for the checksum layer. | |
int | cs__new_manber_filter (struct estat *sts, svn_stream_t *stream_input, svn_stream_t **filter_stream, apr_pool_t *pool) |
Creates a svn_stream_t pipe, which writes the checksums of the manber hash blocks to the md5s file. | |
int | cs__read_manber_hashes (struct estat *sts, struct cs__manber_hashes *data) |
Reads the md5s file into memory. | |
int | cs__two_ch2bin (char *stg) |
Hex-character pair to ascii. |
CRC, manber function header file.
Definition in file checksum.h.
int cs__char2md5 | ( | const char * | input, | |
char ** | eos, | |||
md5_digest_t | md5 | |||
) |
Converts an ASCII string to an MD5 digest.
Converts an ASCII string to an MD5 digest.
Exactly the right number of characters must be present.
Definition at line 173 of file checksum.c.
References cs__hex2val(), and STOPIF_CODE_ERR.
Referenced by cb___close_file(), cs__read_manber_hashes(), ops__load_1entry(), and up__parse_prop().
int cs__compare_file | ( | struct estat * | sts, | |
char * | fullpath, | |||
int * | result | |||
) |
Checks whether a file has changed.
Checks whether a file has changed.
sts | Which entry to check | |
fullpath | The path to the file (optionally, else NULL ). If the file has been checked already and fullpath is NULL , a debug message can write (null), as then even the name calculation is skipped. | |
result | is set to 0 for identical to old and >0 for changed. As a special case this function returns <0 for don't know if the file is unreadable due to a EACCESS . |
Definition at line 303 of file checksum.c.
References t_manber_data::block_md5, CF_CHANGED, CF_NOTCHANGED, CF_UNKNOWN, estat::change_flag, cs__manber_hashes::count, cs___end_of_block(), cs___finish_manber(), cs___manber_data_init(), cs__md5tohex_buffered(), CS__MIN_FILE_SIZE, cs__read_manber_hashes(), DEBUGP, cs__manber_hashes::end, t_manber_data::fpos, cs__manber_hashes::hash, hlp__lstat(), t_manber_data::last_state, MAPSIZE, cs__manber_hashes::md5, estat::md5, sstat_t::mode, ops__build_path(), ops__link_to_string(), sstat_t::size, estat::st, STOPIF, and STOPIF_CODE_ERR.
Referenced by cm__find_file_source(), and ops__update_single_entry().
char* cs__md5tohex | ( | const md5_digest_t | md5, | |
char * | dest | |||
) |
Puts the hex string of md5 into dest, and returns dest.
Definition at line 207 of file checksum.c.
Referenced by cs__md5tohex_buffered(), and waa__get_waa_directory().
char* cs__md5tohex_buffered | ( | const md5_digest_t | md5 | ) |
Converts an MD5 digest to an ASCII string in a self-managed buffer.
Converts an MD5 digest to an ASCII string in a self-managed buffer.
This function alternates between a few static buffers, to allow for a printf("%s %s\n", cs__md5tohex_buffered(), cs__md5tohex_buffered());
It doesn't use the string caches, because the exact length of the buffers is known ... so the alloc/realloc/strcpy overhead is unnecessary.
Definition at line 250 of file checksum.c.
References cs__md5tohex().
Referenced by ci__nondir(), cm___md5_datum(), cs___end_of_block(), cs___update_manber(), cs__compare_file(), DEBUGP_dump_estat(), hlp___encode_close(), ops__save_1entry(), st__print_entry_info(), up__close_file(), and up__parse_prop().
int cs__new_manber_filter | ( | struct estat * | sts, | |
svn_stream_t * | stream_input, | |||
svn_stream_t ** | filter_stream, | |||
apr_pool_t * | pool | |||
) |
Creates a svn_stream_t
pipe, which writes the checksums of the manber hash blocks to the md5s file.
Creates a svn_stream_t
pipe, which writes the checksums of the manber hash blocks to the md5s file.
On commit and update we run the stream through a filter, to create the manber-hash data (see md5s) on the fly.
mb_f->full_md5
. Definition at line 860 of file checksum.c.
References cs___manber, cs___manber_data_init(), cs___mnbs_close(), cs___mnbs_read(), cs___mnbs_write(), DEBUGP, filename, t_manber_data::input, ops__build_path(), STOPIF, and STOPIF_ENOMEM.
Referenced by ci__nondir(), rev__get_text_to_stream(), and up__apply_textdelta().
int cs__read_manber_hashes | ( | struct estat * | sts, | |
struct cs__manber_hashes * | data | |||
) |
Reads the md5s file into memory.
Reads the md5s file into memory.
sts | The entry whose md5-data to load | |
data | An allocated struct cs__manber_hashes ; its arrays get allocated, and, on error, deallocated. If no error code is returned, freeing of the arrays has to be done by the caller. |
Definition at line 985 of file checksum.c.
References AC_CV_C_UINT32_T, BUG_ON, cs__manber_hashes::count, cs___mb_rd_format, cs__char2md5(), DEBUGP, cs__manber_hashes::end, filename, cs__manber_hashes::hash, hlp__calloc(), hlp__realloc(), IF_FREE, MANBER_LINELEN, cs__manber_hashes::md5, ops__build_path(), STOPIF, STOPIF_CODE_ERR, WAA__FILE_MD5s_EXT, waa__open_byext(), and WAA__READ.
Referenced by cs__compare_file().
int cs__set_file_committed | ( | struct estat * | sts | ) |
Callback for the checksum layer.
Callback for the checksum layer.
If a file has been committed, this is where various checksum-related uninitializations can happen.
Definition at line 500 of file checksum.c.
References estat::flags, sstat_t::mode, estat::repos_rev, RF_CHECK, RF_PUSHPROPS, SET_REVNUM, and estat::st.
Referenced by ci__nondir().
int cs__two_ch2bin | ( | char * | stg | ) | [inline] |
Hex-character pair to ascii.
Hex-character pair to ascii.
Faster than sscanf(). Returns -1 on error.
Definition at line 163 of file checksum.c.
References cs__hex2val().
Referenced by url___dump().