Lines Matching refs:header

36 #define TAR_SUMASK	((1L<<(sizeof(tar->header.chksum)-1)*3)-1)
42 Tarheader_t header;
48 * output extended header keyword assignment record
90 * compute tar->header checksum
106 p = (unsigned char*)tar->header.chksum;
116 p = (unsigned char*)&tar->header;
145 p = (unsigned char*)tar->header.chksum;
178 * check if tar file name may be split to fit in header
180 * <0 extension header required with error message for non-extension formats
234 * <0 extension header required with error message for non-extension formats
261 * generate extended header path name from fmt
291 * synthesize an extended tar header
322 * output an extended tar header
323 * some keys may already be in the header buffer for type
350 fmt = state.header.extended;
356 fmt = state.header.global;
408 s = state.header.comment;
546 if (paxread(pax, ap, &tar->header, (off_t)0, (off_t)TAR_HEADER, 0) <= 0)
548 if (!*tar->header.name)
554 if (tar_getoctal("mode", tar->header.mode, 7, sizeof(f->st->st_mode), &f->st->st_mode))
556 if (tar_getoctal("uid", tar->header.uid, 7, sizeof(f->st->st_uid), &f->st->st_uid))
558 if (tar_getoctal("gid", tar->header.gid, 7, sizeof(f->st->st_gid), &f->st->st_gid))
560 if (tar_getoctal("mtime", tar->header.mtime, 11, sizeof(f->st->st_mtime), &f->st->st_mtime))
562 if (tar_getoctal("chksum", tar->header.chksum, 7, sizeof(num), &num))
573 memcpy(tmp, tar->header.chksum, TARSIZEOF(chksum));
575 if (!tar_getoctal("chksum", tar->header.chksum, 7, sizeof(num), &num) && tar_checksum(ap, 1, num))
578 paxunread(pax, ap, &tar->header, TAR_HEADER);
585 if (tar_getoctal("size", tar->header.size, 11, sizeof(f->st->st_size), &f->st->st_size))
589 if (!streq(tar->header.magic, TMAGIC))
591 if (streq(tar->header.magic, TMAGIC " "))
597 else if (!strneq(tar->header.version, TVERSION, TARSIZEOF(version)))
600 error(1, "%s: %s format version %-.*s incompatible with implementation version %-.*s -- assuming %s", ap->name, ap->format->name, TARSIZEOF(version), tar->header.version, TARSIZEOF(version), TVERSION, tp->name);
604 *((char*)tar->header.name + TARSIZEOF(name)) = 0;
605 if (ap->format->variant != OLD && *tar->header.prefix)
608 sfsprintf(f->name, TARSIZEOF(prefix) + TARSIZEOF(name) + 2, "%-.*s/%-.*s", TARSIZEOF(prefix), tar->header.prefix, TARSIZEOF(name), tar->header.name);
611 f->name = tar->header.name;
612 *((char*)tar->header.linkname + TARSIZEOF(name)) = 0;
616 switch (tar->header.typeflag)
624 f->linkpath = paxstash(pax, &ap->stash.link, tar->header.linkname, 0);
629 f->linkpath = paxstash(pax, &ap->stash.link, tar->header.linkname, 0);
634 if (tar_getoctal("devmajor", tar->header.devmajor, 7, sizeof(i), &i))
636 if (tar_getoctal("devminor", tar->header.devminor, 7, sizeof(m), &m))
661 error(3, "invalid %s format '%c' extended header", ap->format->name, tar->header.typeflag);
663 setoptions(s, f->st->st_size, NiL, state.usage, ap, tar->header.typeflag);
666 f->extended = tar->header.typeflag;
679 error(2, "%s: invalid %s format long path header", ap->name, ap->format->name);
682 op = &options[tar->header.typeflag == LLNKTYPE ? OPT_linkpath : OPT_path];
695 error(1, "%s: %s: unknown %s format file type `%c' -- regular file assumed", ap->name, f->name, ap->format->name, tar->header.typeflag);
708 if (*tar->header.uname && (strtoll(tar->header.uname, &t, 0), *t))
709 f->uidname = tar->header.uname;
710 if (*tar->header.gname && (strtoll(tar->header.gname, &t, 0), *t))
711 f->gidname = tar->header.gname;
715 tar->last[tar->lastindex] = tar->header;
718 paxunread(pax, ap, &tar->header, TAR_HEADER);
806 memzero(&tar->header, TAR_HEADER);
813 memcpy(tar->header.prefix, f->name, i);
818 sfsprintf(tar->header.name, TARSIZEOF(name) + 1, "%s%s", s, f->type == X_IFDIR ? "/" : "");
821 tar->header.typeflag = f->extended;
826 tar->header.typeflag = LNKTYPE;
828 sfsprintf(tar->header.linkname, TARSIZEOF(linkname) + 1, "%s", f->longlink ? headname(ap, f, "@PaxLinkFile.%(sequence)s") : f->linkpath);
831 tar->header.typeflag = SYMTYPE;
837 tar->header.typeflag = CHRTYPE;
841 tar->header.typeflag = BLKTYPE;
845 tar->header.typeflag = DIRTYPE;
848 tar->header.typeflag = FIFOTYPE;
852 tar->header.typeflag = SOKTYPE;
861 tar->header.typeflag = REGTYPE;
866 sfsprintf(tar->header.devmajor, TARSIZEOF(devmajor), "%0*o ", TARSIZEOF(devmajor) - 1, i ? major(idevice(f->st)) : 0);
867 sfsprintf(tar->header.devminor, TARSIZEOF(devminor), "%0*o ", TARSIZEOF(devminor) - 1, i ? minor(idevice(f->st)) : 0);
868 sfsprintf(tar->header.mode, TARSIZEOF(mode), "%0*o ", TARSIZEOF(mode) - 1, f->st->st_mode & X_IPERM);
869 sfsprintf(tar->header.uid, TARSIZEOF(uid), "%0*lo ", TARSIZEOF(uid) - 1, f->st->st_uid & (unsigned long)07777777);
870 sfsprintf(tar->header.gid, TARSIZEOF(gid), "%0*lo ", TARSIZEOF(gid) - 1, f->st->st_gid & (unsigned long)07777777);
873 tar->header.size[0] = TAR_LARGENUM;
877 tar->header.size[i] = n & 0377;
882 sfsprintf(tar->header.size, TARSIZEOF(size), "%0*lo ", TARSIZEOF(size) - 1, (long)f->st->st_size);
883 sfsprintf(tar->header.mtime, TARSIZEOF(mtime), "%0*lo ", TARSIZEOF(mtime) - 1, f->st->st_mtime & (unsigned long)037777777777);
886 strncpy(tar->header.magic, TMAGIC, TARSIZEOF(magic));
887 strncpy(tar->header.version, TVERSION, TARSIZEOF(version));
889 strcpy(tar->header.uname, f->uidname);
890 strcpy(tar->header.gname, f->gidname);
892 sfsprintf(tar->header.chksum, TARSIZEOF(chksum), "%0*lo ", TARSIZEOF(chksum) - 1, tar_checksum(ap, 0, 0));
893 paxwrite(pax, ap, &tar->header, TAR_HEADER);
902 memzero(&tar->header, TAR_HEADER);
903 paxwrite(pax, ap, &tar->header, TAR_HEADER);
904 paxwrite(pax, ap, &tar->header, TAR_HEADER);
916 *s = tar->header.chksum;
919 *s = tar->header.magic;
922 *n = tar->header.typeflag;
925 *s = tar->header.version;