summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 71058b1)
raw | patch | inline | side by side (parent: 71058b1)
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Fri, 6 May 2005 20:56:08 +0000 (22:56 +0200) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 6 May 2005 21:42:59 +0000 (14:42 -0700) |
Pass pointer to filecontents to write_header() and pass pointer
to filecontents, its size and some flags to write_exntended_header().
These parameters are not used, yet. They are added in preparation
to symlink support.
to filecontents, its size and some flags to write_exntended_header().
These parameters are not used, yet. They are added in preparation
to symlink support.
tar-tree.c | patch | blob | history |
diff --git a/tar-tree.c b/tar-tree.c
index 277c882acc4f487bfc90dee76b00dc88f99f3da3..e99adc7dd781cf46efbed82221bf62975a4a3996 100644 (file)
--- a/tar-tree.c
+++ b/tar-tree.c
}
static void write_header(const char *, char, const char *, struct path_prefix *,
- const char *, unsigned int, unsigned long);
+ const char *, unsigned int, void *, unsigned long);
/* stores a pax extended header directly in the block buffer */
static void write_extended_header(const char *headerfilename, int is_dir,
- const char *basepath,
+ unsigned int flags, const char *basepath,
struct path_prefix *prefix,
- const char *path, unsigned int namelen)
+ const char *path, unsigned int namelen,
+ void *content, unsigned int contentsize)
{
char *p;
unsigned int pathlen, size;
if (size > RECORDSIZE)
die("tar-tree: extended header too big, wtf?");
write_header(NULL, TYPEFLAG_EXT_HEADER, NULL, NULL, headerfilename,
- 0100600, size);
+ 0100600, NULL, size);
p = get_record();
append_extended_header_prefix(&p, pathlen, "path");
size = extended_header_len("comment", 40);
write_header(NULL, TYPEFLAG_GLOBAL_HEADER, NULL, NULL,
- "pax_global_header", 0100600, size);
+ "pax_global_header", 0100600, NULL, size);
p = get_record();
append_extended_header(&p, "comment", sha1_to_hex(sha1), 40);
/* stores a ustar header directly in the block buffer */
static void write_header(const char *sha1, char typeflag, const char *basepath,
struct path_prefix *prefix, const char *path,
- unsigned int mode, unsigned long size)
+ unsigned int mode, void *buffer, unsigned long size)
{
unsigned int namelen;
char *p, *header = NULL;
char headerfilename[51];
sprintf(headerfilename, "%s.paxheader", sha1_hex);
/* the extended header must be written before the normal one */
- write_extended_header(headerfilename, S_ISDIR(mode), basepath,
- prefix, path, namelen);
+ write_extended_header(headerfilename, S_ISDIR(mode),
+ 0, basepath, prefix, path,
+ namelen, buffer, size);
header = get_record();
sprintf(header, "%s.data", sha1_hex);
if (!eltbuf)
die("cannot read %s", sha1_to_hex(sha1));
write_header(sha1, TYPEFLAG_AUTO, basedir, prefix, path,
- mode, eltsize);
+ mode, eltbuf, eltsize);
if (!strcmp(elttype, "tree")) {
this_prefix.name = path;
traverse_tree(eltbuf, eltsize, &this_prefix);
if (!archive_time)
archive_time = time(NULL);
if (basedir)
- write_header("0", TYPEFLAG_DIR, NULL, NULL, basedir, 040755, 0);
+ write_header("0", TYPEFLAG_DIR, NULL, NULL, basedir, 040755,
+ NULL, 0);
traverse_tree(buffer, size, NULL);
free(buffer);
write_trailer();