X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fxheader.c;h=37bcdc1d7c1b9ed84049b324897074a62eb5c373;hb=b6d3432810ce8b001200e88ea4bd0251a063caf6;hp=493a955c49ff0c7e8df62d613243e4dea4cc188d;hpb=3eec6b3f46142145eca8738473e16e42f7d403e4;p=chaz%2Ftar diff --git a/src/xheader.c b/src/xheader.c index 493a955..37bcdc1 100644 --- a/src/xheader.c +++ b/src/xheader.c @@ -1285,6 +1285,60 @@ dumpdir_decoder (struct tar_stat_info *st, char const *arg, memcpy (st->dumpdir, arg, size); } +static void +volume_label_coder (struct tar_stat_info const *st, char const *keyword, + struct xheader *xhdr, void const *data) +{ + code_string (data, keyword, xhdr); +} + +static void +volume_label_decoder (struct tar_stat_info *st, char const *arg, size_t size) +{ + decode_string (&volume_label, arg); +} + +static void +volume_size_coder (struct tar_stat_info const *st, char const *keyword, + struct xheader *xhdr, void const *data) +{ + off_t v = *(off_t*)data; + code_num (v, keyword, xhdr); +} + +static void +volume_size_decoder (struct tar_stat_info *st, char const *arg, size_t size) +{ + uintmax_t u; + if (decode_num (&u, arg, TYPE_MAXIMUM (uintmax_t), "GNU.volume.size")) + continued_file_size = u; +} + +/* FIXME: Merge with volume_size_coder */ +static void +volume_offset_coder (struct tar_stat_info const *st, char const *keyword, + struct xheader *xhdr, void const *data) +{ + off_t v = *(off_t*)data; + code_num (v, keyword, xhdr); +} + +static void +volume_offset_decoder (struct tar_stat_info *st, char const *arg, size_t size) +{ + uintmax_t u; + if (decode_num (&u, arg, TYPE_MAXIMUM (uintmax_t), "GNU.volume.offset")) + continued_file_offset = u; +} + +static void +volume_filename_decoder (struct tar_stat_info *st, char const *arg, + size_t size) +{ + decode_string (&continued_file_name, arg); +} + + struct xhdr_tab const xhdr_tab[] = { { "atime", atime_coder, atime_decoder, false }, { "comment", dummy_coder, dummy_decoder, false }, @@ -1318,11 +1372,9 @@ struct xhdr_tab const xhdr_tab[] = { { "GNU.dumpdir", dumpdir_coder, dumpdir_decoder, true }, -#if 0 /* GNU private keywords (not yet implemented) */ - - /* Keeps the tape/volume header. May be present only in the global headers. + /* Keeps the tape/volume label. May be present only in the global headers. Equivalent to GNUTYPE_VOLHDR. */ - { "GNU.volume.header", volume_header_coder, volume_header_decoder, false }, + { "GNU.volume.label", volume_label_coder, volume_label_decoder, true }, /* These may be present in a first global header of the archive. They provide the same functionality as GNUTYPE_MULTIVOL header. @@ -1330,9 +1382,10 @@ struct xhdr_tab const xhdr_tab[] = { otherwise kept in the size field of a multivolume header. The GNU.volume.offset keeps the offset of the start of this volume, otherwise kept in oldgnu_header.offset. */ - { "GNU.volume.size", volume_size_coder, volume_size_decoder, false }, - { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder, false }, -#endif + { "GNU.volume.filename", volume_label_coder, volume_filename_decoder, + true }, + { "GNU.volume.size", volume_size_coder, volume_size_decoder, true }, + { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder, true }, { NULL, NULL, NULL, false } };