MCPcopy Create free account
hub / github.com/apache/cloudberry / _tarWriteHeader

Function _tarWriteHeader

src/backend/replication/basebackup.c:2031–2068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2029
2030
2031static int64
2032_tarWriteHeader(const char *filename, const char *linktarget,
2033 struct stat *statbuf, bool sizeonly)
2034{
2035 char h[TAR_BLOCK_SIZE];
2036 enum tarError rc;
2037
2038 if (!sizeonly)
2039 {
2040 rc = tarCreateHeader(h, filename, linktarget, statbuf->st_size,
2041 statbuf->st_mode, statbuf->st_uid, statbuf->st_gid,
2042 statbuf->st_mtime);
2043
2044 switch (rc)
2045 {
2046 case TAR_OK:
2047 break;
2048 case TAR_NAME_TOO_LONG:
2049 ereport(ERROR,
2050 (errmsg("file name too long for tar format: \"%s\"",
2051 filename)));
2052 break;
2053 case TAR_SYMLINK_TOO_LONG:
2054 ereport(ERROR,
2055 (errmsg("symbolic link target too long for tar format: "
2056 "file name \"%s\", target \"%s\"",
2057 filename, linktarget)));
2058 break;
2059 default:
2060 elog(ERROR, "unrecognized tar error: %d", rc);
2061 }
2062
2063 pq_putmessage('d', h, sizeof(h));
2064 update_basebackup_progress(sizeof(h));
2065 }
2066
2067 return sizeof(h);
2068}
2069
2070/*
2071 * Write tar header for a directory. If the entry in statbuf is a link then

Callers 7

perform_base_backupFunction · 0.70
sendFileWithContentFunction · 0.70
sendTablespaceFunction · 0.70
sendDirFunction · 0.70
ifFunction · 0.70
sendFileFunction · 0.70
_tarWriteDirFunction · 0.70

Calls 3

tarCreateHeaderFunction · 0.85
errmsgFunction · 0.50

Tested by

no test coverage detected