summaryrefslogtreecommitdiff
path: root/tar.h
diff options
context:
space:
mode:
authorRene Scharfe <rene.scharfe@lsrfire.ath.cx>2006-03-25 22:21:03 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-26 00:35:43 (GMT)
commitae64bbc18c80bdad36c53336ba4f724ce128efca (patch)
treec0d9bffe292efeca06b5229b70d289c075cd5f5d /tar.h
parent2c6df2d5d1894d8951895334d80735868c6ac253 (diff)
downloadgit-ae64bbc18c80bdad36c53336ba4f724ce128efca.zip
git-ae64bbc18c80bdad36c53336ba4f724ce128efca.tar.gz
git-ae64bbc18c80bdad36c53336ba4f724ce128efca.tar.bz2
tar-tree: Introduce write_entry()
... and use it initially to write global extended header records. Improvements compared to the old write_header(): - Uses a struct ustar_header instead of hardcoded offsets. - Takes one struct strbuf as path argument instead of a (basedir, prefix, name) tuple. - Not only writes the tar header, but also the contents of the file, if any. - Does not write directly into the ring buffer. This allows the code to be layed out more naturally, because there is no more ordering constraint. Before we had to first finish writing the extended header, now we can construct the extended and normal headers in parallel. - The typeflag parameter has been replaced by (reasonable) magic values. path == NULL indicates an extended header, additionally sha1 == NULL means it is a global extended header. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'tar.h')
-rw-r--r--tar.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/tar.h b/tar.h
new file mode 100644
index 0000000..3467705
--- /dev/null
+++ b/tar.h
@@ -0,0 +1,25 @@
+#define TYPEFLAG_AUTO '\0'
+#define TYPEFLAG_REG '0'
+#define TYPEFLAG_LNK '2'
+#define TYPEFLAG_DIR '5'
+#define TYPEFLAG_GLOBAL_HEADER 'g'
+#define TYPEFLAG_EXT_HEADER 'x'
+
+struct ustar_header {
+ char name[100]; /* 0 */
+ char mode[8]; /* 100 */
+ char uid[8]; /* 108 */
+ char gid[8]; /* 116 */
+ char size[12]; /* 124 */
+ char mtime[12]; /* 136 */
+ char chksum[8]; /* 148 */
+ char typeflag[1]; /* 156 */
+ char linkname[100]; /* 157 */
+ char magic[6]; /* 257 */
+ char version[2]; /* 263 */
+ char uname[32]; /* 265 */
+ char gname[32]; /* 297 */
+ char devmajor[8]; /* 329 */
+ char devminor[8]; /* 337 */
+ char prefix[155]; /* 345 */
+};