static void manifest_process_system_identifier(JsonManifestParseContext *context,
uint64 manifest_system_identifier);
static void manifest_process_file(JsonManifestParseContext *context,
- char *pathname,
+ const char *pathname,
size_t size,
pg_checksum_type checksum_type,
int checksum_length,
*/
static void
manifest_process_file(JsonManifestParseContext *context,
- char *pathname, size_t size,
+ const char *pathname, size_t size,
pg_checksum_type checksum_type,
int checksum_length,
uint8 *checksum_payload)
*/
#define SH_PREFIX manifest_files
#define SH_ELEMENT_TYPE manifest_file
-#define SH_KEY_TYPE char *
+#define SH_KEY_TYPE const char *
#define SH_KEY pathname
#define SH_HASH_KEY(tb, key) hash_string(key)
#define SH_EQUAL(tb, a, b) (strcmp(a, b) == 0)
static void combinebackup_system_identifier_cb(JsonManifestParseContext *context,
uint64 manifest_system_identifier);
static void combinebackup_per_file_cb(JsonManifestParseContext *context,
- char *pathname, size_t size,
+ const char *pathname, size_t size,
pg_checksum_type checksum_type,
int checksum_length,
uint8 *checksum_payload);
*/
static void
combinebackup_per_file_cb(JsonManifestParseContext *context,
- char *pathname, size_t size,
+ const char *pathname, size_t size,
pg_checksum_type checksum_type,
int checksum_length, uint8 *checksum_payload)
{
typedef struct manifest_file
{
uint32 status; /* hash status */
- char *pathname;
+ const char *pathname;
size_t size;
pg_checksum_type checksum_type;
int checksum_length;
#define SH_PREFIX manifest_files
#define SH_ELEMENT_TYPE manifest_file
-#define SH_KEY_TYPE char *
+#define SH_KEY_TYPE const char *
#define SH_SCOPE extern
#define SH_RAW_ALLOCATOR pg_malloc0
#define SH_DECLARE
typedef struct manifest_file
{
uint32 status; /* hash status */
- char *pathname;
+ const char *pathname;
size_t size;
pg_checksum_type checksum_type;
int checksum_length;
*/
#define SH_PREFIX manifest_files
#define SH_ELEMENT_TYPE manifest_file
-#define SH_KEY_TYPE char *
+#define SH_KEY_TYPE const char *
#define SH_KEY pathname
#define SH_HASH_KEY(tb, key) hash_string(key)
#define SH_EQUAL(tb, a, b) (strcmp(a, b) == 0)
static void verifybackup_system_identifier(JsonManifestParseContext *context,
uint64 manifest_system_identifier);
static void verifybackup_per_file_cb(JsonManifestParseContext *context,
- char *pathname, size_t size,
+ const char *pathname, size_t size,
pg_checksum_type checksum_type,
int checksum_length,
uint8 *checksum_payload);
pg_attribute_printf(2, 3);
static void report_fatal_error(const char *pg_restrict fmt,...)
pg_attribute_printf(1, 2) pg_attribute_noreturn();
-static bool should_ignore_relpath(verifier_context *context, char *relpath);
+static bool should_ignore_relpath(verifier_context *context, const char *relpath);
static void progress_report(bool finished);
static void usage(void);
*/
static void
verifybackup_per_file_cb(JsonManifestParseContext *context,
- char *pathname, size_t size,
+ const char *pathname, size_t size,
pg_checksum_type checksum_type,
int checksum_length, uint8 *checksum_payload)
{
char *fullpath, uint8 *buffer)
{
pg_checksum_context checksum_ctx;
- char *relpath = m->pathname;
+ const char *relpath = m->pathname;
int fd;
int rc;
size_t bytes_read = 0;
* "aa/bb" is not a prefix of "aa/bbb", but it is a prefix of "aa/bb/cc".
*/
static bool
-should_ignore_relpath(verifier_context *context, char *relpath)
+should_ignore_relpath(verifier_context *context, const char *relpath)
{
SimpleStringListCell *cell;
for (cell = context->ignore_list.head; cell != NULL; cell = cell->next)
{
- char *r = relpath;
+ const char *r = relpath;
char *v = cell->val;
while (*v != '\0' && *r == *v)
static void json_manifest_finalize_file(JsonManifestParseState *parse);
static void json_manifest_finalize_wal_range(JsonManifestParseState *parse);
static void verify_manifest_checksum(JsonManifestParseState *parse,
- char *buffer, size_t size,
+ const char *buffer, size_t size,
pg_cryptohash_ctx *incr_ctx);
static void json_manifest_parse_failure(JsonManifestParseContext *context,
char *msg);
void
json_parse_manifest_incremental_chunk(
- JsonManifestParseIncrementalState *incstate, char *chunk, size_t size,
+ JsonManifestParseIncrementalState *incstate, const char *chunk, size_t size,
bool is_last)
{
JsonParseErrorType res,
if (!is_last)
{
if (pg_cryptohash_update(incstate->manifest_ctx,
- (uint8 *) chunk, size) < 0)
+ (const uint8 *) chunk, size) < 0)
context->error_cb(context, "could not update checksum of manifest");
}
else
* invoked and is expected not to return.
*/
void
-json_parse_manifest(JsonManifestParseContext *context, char *buffer,
+json_parse_manifest(JsonManifestParseContext *context, const char *buffer,
size_t size)
{
JsonLexContext *lex;
* parse incr_ctx will be NULL.
*/
static void
-verify_manifest_checksum(JsonManifestParseState *parse, char *buffer,
+verify_manifest_checksum(JsonManifestParseState *parse, const char *buffer,
size_t size, pg_cryptohash_ctx *incr_ctx)
{
JsonManifestParseContext *context = parse->context;
{
manifest_ctx = incr_ctx;
}
- if (pg_cryptohash_update(manifest_ctx, (uint8 *) buffer, penultimate_newline + 1) < 0)
+ if (pg_cryptohash_update(manifest_ctx, (const uint8 *) buffer, penultimate_newline + 1) < 0)
context->error_cb(context, "could not update checksum of manifest");
if (pg_cryptohash_final(manifest_ctx, manifest_checksum_actual,
sizeof(manifest_checksum_actual)) < 0)
typedef void (*json_manifest_system_identifier_callback) (JsonManifestParseContext *,
uint64 manifest_system_identifier);
typedef void (*json_manifest_per_file_callback) (JsonManifestParseContext *,
- char *pathname,
+ const char *pathname,
size_t size, pg_checksum_type checksum_type,
int checksum_length, uint8 *checksum_payload);
typedef void (*json_manifest_per_wal_range_callback) (JsonManifestParseContext *,
};
extern void json_parse_manifest(JsonManifestParseContext *context,
- char *buffer, size_t size);
+ const char *buffer, size_t size);
extern JsonManifestParseIncrementalState *json_parse_manifest_incremental_init(JsonManifestParseContext *context);
extern void json_parse_manifest_incremental_chunk(
- JsonManifestParseIncrementalState *incstate, char *chunk, size_t size,
+ JsonManifestParseIncrementalState *incstate, const char *chunk, size_t size,
bool is_last);
extern void json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate);