MCPcopy Create free account
hub / github.com/F-Stack/f-stack / textdump_mkustar

Function textdump_mkustar

freebsd/ddb/db_textdump.c:208–231  ·  view source on GitHub ↗

* Each file in the tarball has a block-sized header with its name and other, * largely hard-coded, properties. */

Source from the content-addressed store, hash-verified

206 * largely hard-coded, properties.
207 */
208void
209textdump_mkustar(char *block_buffer, const char *filename, u_int size)
210{
211 struct ustar_header *uhp;
212
213#ifdef TEXTDUMP_VERBOSE
214 if (textdump_error == 0)
215 printf("textdump: creating '%s'.\n", filename);
216#endif
217 uhp = (struct ustar_header *)block_buffer;
218 bzero(uhp, sizeof(*uhp));
219 strlcpy(uhp->uh_filename, filename, sizeof(uhp->uh_filename));
220 strlcpy(uhp->uh_mode, TAR_MODE, sizeof(uhp->uh_mode));
221 snprintf(uhp->uh_size, sizeof(uhp->uh_size), "%o", size);
222 strlcpy(uhp->uh_tar_owner, TAR_UID, sizeof(uhp->uh_tar_owner));
223 strlcpy(uhp->uh_tar_group, TAR_GID, sizeof(uhp->uh_tar_group));
224 strlcpy(uhp->uh_owner, TAR_USER, sizeof(uhp->uh_owner));
225 strlcpy(uhp->uh_group, TAR_GROUP, sizeof(uhp->uh_group));
226 snprintf(uhp->uh_mtime, sizeof(uhp->uh_mtime), "%lo",
227 (unsigned long)time_second);
228 uhp->uh_type = 0;
229 strlcpy(uhp->uh_ustar, TAR_USTAR, sizeof(uhp->uh_ustar));
230 ustar_checksum(uhp);
231}
232
233/*
234 * textdump_writeblock() writes TEXTDUMP_BLOCKSIZE-sized blocks of data to

Callers 5

db_capture_dumpFunction · 0.85
textdump_dump_configFunction · 0.85
textdump_dump_msgbufFunction · 0.85
textdump_dump_panicFunction · 0.85
textdump_dump_versionFunction · 0.85

Calls 5

bzeroFunction · 0.85
snprintfFunction · 0.85
ustar_checksumFunction · 0.85
printfFunction · 0.50
strlcpyFunction · 0.50

Tested by

no test coverage detected