56 while (
buf->cursor <
buf->len)
58 char *s = &
buf->data[
buf->cursor];
60 char *
e = &
buf->data[eo];
68 if (
c >=
e || *
c !=
' ')
69 pg_fatal(
"%s: improper terminator for %s",
76 pg_fatal(
"%s: could not parse TLI for %s",
87 if (
c >=
e || *
c !=
'\n')
88 pg_fatal(
"%s: improper terminator for %s",
97 if (*previous_tli == 0)
105 if ((found & 1) == 0)
107 if ((found & 2) == 0)
109 if ((found & 4) != 0 && (found & 8) == 0)
111 "INCREMENTAL FROM LSN",
"INCREMENTAL FROM TLI");
112 if ((found & 8) != 0 && (found & 4) == 0)
114 "INCREMENTAL FROM TLI",
"INCREMENTAL FROM LSN");
145 while (
buf->cursor <
buf->len)
147 char *s = &
buf->data[
buf->cursor];
149 char *
e = &
buf->data[eo];
156 wb =
write(output_fd, s,
e - s);
162 pg_fatal(
"could not write file \"%s\": wrote %d of %d",
166 pg_fatal(
"could not update checksum of file \"%s\"",
173 if (
close(output_fd) != 0)
190 checksum_length, checksum_payload);
203 int eo =
buf->cursor;
205 while (eo < buf->
len)
207 if (
buf->data[eo] ==
'\n')
226 while (s <
e && *match !=
'\0' && *s == *match)
229 if (*match ==
'\0' && sout != NULL)
232 return (*match ==
'\0');
250 success = (sscanf(s,
"%X/%X%n", &hi, &lo, &nchars) == 2);
276 success = (sscanf(s,
"%u%n", tli, &nchars) == 1);
279 if (
success && s[nchars] !=
'\n')
static int get_eol_offset(StringInfo buf)
void parse_backup_label(char *filename, StringInfo buf, TimeLineID *start_tli, XLogRecPtr *start_lsn, TimeLineID *previous_tli, XLogRecPtr *previous_lsn)
static bool parse_lsn(char *s, char *e, XLogRecPtr *lsn, char **c)
static bool line_starts_with(char *s, char *e, char *match, char **sout)
void write_backup_label(char *output_directory, StringInfo buf, pg_checksum_type checksum_type, manifest_writer *mwriter)
static bool parse_tli(char *s, char *e, TimeLineID *tli)
int pg_checksum_final(pg_checksum_context *context, uint8 *output)
int pg_checksum_update(pg_checksum_context *context, const uint8 *input, size_t len)
int pg_checksum_init(pg_checksum_context *context, pg_checksum_type type)
#define PG_CHECKSUM_MAX_LENGTH
void add_file_to_manifest(manifest_writer *mwriter, const char *manifest_path, uint64 size, time_t mtime, pg_checksum_type checksum_type, int checksum_length, uint8 *checksum_payload)
#define InvalidXLogRecPtr