xref: /freebsd/usr.bin/mkuzip/mkuz_cloop.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
18f8cb840SMaxim Sobolev /*
28f8cb840SMaxim Sobolev  * Copyright (c) 2004-2016 Maxim Sobolev <sobomax@FreeBSD.org>
38f8cb840SMaxim Sobolev  * All rights reserved.
48f8cb840SMaxim Sobolev  *
58f8cb840SMaxim Sobolev  * Redistribution and use in source and binary forms, with or without
68f8cb840SMaxim Sobolev  * modification, are permitted provided that the following conditions
78f8cb840SMaxim Sobolev  * are met:
88f8cb840SMaxim Sobolev  * 1. Redistributions of source code must retain the above copyright
98f8cb840SMaxim Sobolev  *    notice, this list of conditions and the following disclaimer.
108f8cb840SMaxim Sobolev  * 2. Redistributions in binary form must reproduce the above copyright
118f8cb840SMaxim Sobolev  *    notice, this list of conditions and the following disclaimer in the
128f8cb840SMaxim Sobolev  *    documentation and/or other materials provided with the distribution.
138f8cb840SMaxim Sobolev  *
148f8cb840SMaxim Sobolev  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
158f8cb840SMaxim Sobolev  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
168f8cb840SMaxim Sobolev  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
178f8cb840SMaxim Sobolev  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
188f8cb840SMaxim Sobolev  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
198f8cb840SMaxim Sobolev  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
208f8cb840SMaxim Sobolev  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
218f8cb840SMaxim Sobolev  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
228f8cb840SMaxim Sobolev  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
238f8cb840SMaxim Sobolev  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
248f8cb840SMaxim Sobolev  * SUCH DAMAGE.
258f8cb840SMaxim Sobolev  */
268f8cb840SMaxim Sobolev 
278f8cb840SMaxim Sobolev /* CLOOP format and related constants */
288f8cb840SMaxim Sobolev 
298f8cb840SMaxim Sobolev /*
308f8cb840SMaxim Sobolev  * Integer values (block size, number of blocks, offsets)
318f8cb840SMaxim Sobolev  * are stored in big-endian (network) order on disk.
328f8cb840SMaxim Sobolev  */
338f8cb840SMaxim Sobolev 
348f8cb840SMaxim Sobolev #define CLOOP_MAGIC_LEN 128
358f8cb840SMaxim Sobolev #define CLOOP_OFS_COMPR 0x0b
368f8cb840SMaxim Sobolev #define CLOOP_OFS_VERSN (CLOOP_OFS_COMPR + 1)
378f8cb840SMaxim Sobolev 
388f8cb840SMaxim Sobolev #define CLOOP_MAJVER_2	'2'
398f8cb840SMaxim Sobolev #define CLOOP_MAJVER_3	'3'
40*eefd8f96SConrad Meyer #define CLOOP_MAJVER_4	'4'
418f8cb840SMaxim Sobolev 
428f8cb840SMaxim Sobolev #define CLOOP_COMP_LIBZ	'V'
438f8cb840SMaxim Sobolev #define	CLOOP_COMP_LZMA	'L'
44*eefd8f96SConrad Meyer #define	CLOOP_COMP_ZSTD	'Z'
458f8cb840SMaxim Sobolev 
468f8cb840SMaxim Sobolev struct cloop_header {
478f8cb840SMaxim Sobolev         char magic[CLOOP_MAGIC_LEN];    /* cloop magic */
488f8cb840SMaxim Sobolev         uint32_t blksz;                 /* block size */
498f8cb840SMaxim Sobolev         uint32_t nblocks;               /* number of blocks */
508f8cb840SMaxim Sobolev };
51