diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-02-04 17:04:17 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-02-04 17:16:20 +0100 |
commit | b621d4ed5e07cdc17fee79011c21c62cd995ae2b (patch) | |
tree | d4221240dc55eb9b672b37df6d822086cb30792c /include | |
parent | 89b367941e12b1163afa517eeddca1b5ecd2a054 (diff) |
libtar: simplfy parsing of old GNU sparse format
There was some code duplication for extracting the sparse entry
fields from the start record and the subsequent extended record.
This commit introduces a data structure for both and unifies
the parsing code paths.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/tar/format.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/include/tar/format.h b/include/tar/format.h index c3e372d..9f60ef3 100644 --- a/include/tar/format.h +++ b/include/tar/format.h @@ -10,6 +10,17 @@ #include "sqfs/predef.h" typedef struct { + char offset[12]; + char numbytes[12]; +} gnu_old_sparse_t; + +typedef struct { + gnu_old_sparse_t sparse[21]; + char isextended; + char padding[7]; +} gnu_old_sparse_record_t; + +typedef struct { char name[100]; char mode[8]; char uid[8]; @@ -37,10 +48,7 @@ typedef struct { char offset[12]; char deprecated[4]; char unused; - struct { - char offset[12]; - char numbytes[12]; - } sparse[4]; + gnu_old_sparse_t sparse[4]; char isextended; char realsize[12]; char padding[17]; @@ -48,15 +56,6 @@ typedef struct { } tail; } tar_header_t; -typedef struct { - struct { - char offset[12]; - char numbytes[12]; - } sparse[21]; - char isextended; - char padding[7]; -} gnu_sparse_t; - #define TAR_TYPE_FILE '0' #define TAR_TYPE_LINK '1' #define TAR_TYPE_SLINK '2' |