aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_archiver.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.h')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 9d0f03d5629..2fdc0d341f3 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -253,15 +253,21 @@ struct _archiveHandle
time_t createDate; /* Date archive created */
/*
- * Fields used when discovering header. A format can always get the
- * previous read bytes from here...
+ * Fields used when discovering archive format. For tar format, we load
+ * the first block into the lookahead buffer, and verify that it looks
+ * like a tar header. The tar module must then consume bytes from the
+ * lookahead buffer before reading any more from the file. For custom
+ * format, we load only the "PGDMP" marker into the buffer, and then set
+ * readHeader after confirming it matches. The buffer is vestigial in
+ * this case, as the subsequent code just checks readHeader and doesn't
+ * examine the buffer.
*/
- int readHeader; /* Used if file header has been read already */
+ int readHeader; /* Set if we already read "PGDMP" marker */
char *lookahead; /* Buffer used when reading header to discover
* format */
- size_t lookaheadSize; /* Size of allocated buffer */
- size_t lookaheadLen; /* Length of data in lookahead */
- pgoff_t lookaheadPos; /* Current read position in lookahead buffer */
+ size_t lookaheadSize; /* Allocated size of buffer */
+ size_t lookaheadLen; /* Length of valid data in lookahead */
+ size_t lookaheadPos; /* Current read position in lookahead buffer */
ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */
StartDataPtrType StartDataPtr; /* Called when table data is about to be