From a9490ccb9fdf7ef146a7886526f1b1cf6bf2c714 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 28 Jan 2020 19:43:01 -0500 Subject: abi/api: added tpax_specs.h, definitions for struct tpax_{ustar|cpio}_header. --- include/tpax/tpax_specs.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++ project/headers.mk | 1 + 2 files changed, 67 insertions(+) create mode 100644 include/tpax/tpax_specs.h diff --git a/include/tpax/tpax_specs.h b/include/tpax/tpax_specs.h new file mode 100644 index 0000000..d0ac5a4 --- /dev/null +++ b/include/tpax/tpax_specs.h @@ -0,0 +1,66 @@ +#ifndef TPAX_SPECS_H +#define TPAX_SPECS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define TPAX_USTAR_MAGIC {'u','s','t','a','r',0} +#define TPAX_USTAR_VERSION {'0','0'} + +#define TPAX_USTAR_TYPEFLAG_AREGFILE '\0' +#define TPAX_USTAR_TYPEFLAG_REGFILE '0' +#define TPAX_USTAR_TYPEFLAG_HARDLINK '1' +#define TPAX_USTAR_TYPEFLAG_SYMLINK '2' +#define TPAX_USTAR_TYPEFLAG_CHARDEV '3' +#define TPAX_USTAR_TYPEFLAG_BLKDEV '4' +#define TPAX_USTAR_TYPEFLAG_DIRFILE '5' +#define TPAX_USTAR_TYPEFLAG_FIFODEV '6' +#define TPAX_USTAR_TYPEFLAG_CONTAINER '7' + +#define TPAX_USTAR_MODE_MASK \ + ( S_ISUID | S_ISGID \ + | S_IRUSR | S_IWUSR | S_IXUSR \ + | S_IRGRP | S_IWGRP | S_IXGRP \ + | S_IROTH | S_IWOTH | S_IXOTH ) + +struct tpax_ustar_header { + char u_name [100]; + char u_mode [8]; + char u_uid [8]; + char u_gid [8]; + char u_size [12]; + char u_mtime [12]; + char u_chksum [8]; + char u_typeflag [1]; + char u_linkname [100]; + char u_magic [6]; + char u_version [2]; + char u_uname [32]; + char u_gname [32]; + char u_devmajor [8]; + char u_devminor [8]; + char u_prefix [155]; + char u_pad [12]; +}; + +struct tpax_cpio_header { + char c_magic [6]; + char c_dev [6]; + char c_ino [6]; + char c_mode [6]; + char c_uid [6]; + char c_gid [6]; + char c_nlink [6]; + char c_rdev [6]; + char c_mtime [11]; + char c_namesize [6]; + char c_filesize [11]; + char c_namedata []; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/project/headers.mk b/project/headers.mk index 2427d74..6346c7e 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -1,6 +1,7 @@ API_HEADERS = \ $(SOURCE_DIR)/include/$(PACKAGE)/tpax.h \ $(SOURCE_DIR)/include/$(PACKAGE)/tpax_api.h \ + $(SOURCE_DIR)/include/$(PACKAGE)/tpax_specs.h \ INTERNAL_HEADERS = \ $(SOURCE_DIR)/src/internal/argv/argv.h \ -- cgit v1.2.3