1 /* @(#)props.h 1.24 10/08/27 Copyright 1994-2010 J. Schilling */ 2 /* 3 * Properties definitions to handle different 4 * archive types 5 * 6 * Copyright (c) 1994-2010 J. Schilling 7 */ 8 /* 9 * The contents of this file are subject to the terms of the 10 * Common Development and Distribution License, Version 1.0 only 11 * (the "License"). You may not use this file except in compliance 12 * with the License. 13 * 14 * See the file CDDL.Schily.txt in this distribution for details. 15 * A copy of the CDDL is also available via the Internet at 16 * http://www.opensource.org/licenses/cddl1.txt 17 * 18 * When distributing Covered Code, include this CDDL HEADER in each 19 * file and include the License file CDDL.Schily.txt from this distribution. 20 */ 21 22 #include <schily/utypes.h> 23 24 /* 25 * Properties to describe the different archive formats. 26 * 27 * if pr_maxnamelen id == pr_maxsname, we cannot have long names 28 * besides file name splitting. 29 * 30 * NOTE that part of the information in struct propertiesis available more 31 * than once. This is needed as different parts of the source need the 32 * information in different ways. Partly for performance reasons, partly 33 * because one method of storing the information is inappropriate for all 34 * places in the source. 35 * 36 * If you add new features or information related to the fields 37 * pr_flags/pr_nflags or the fields pr_xftypetab[]/pr_typeflagtab[] 38 * take care of possible problems due to this fact. 39 * 40 */ 41 struct properties { 42 Ullong pr_maxsize; /* max file size */ 43 int pr_hdrsize; /* header size */ 44 int pr_flags; /* gerneral flags */ 45 int pr_xhdflags; /* default extended header flags */ 46 int pr_xhmask; /* supported extended header tags */ 47 char pr_fillc; /* fill prefix for numbers in TCB */ 48 char pr_xc; /* typeflag used for extended headers */ 49 char pr_pad; /* cpio filename/data size padding */ 50 long pr_diffmask; /* diffopts not supported */ 51 int pr_nflags; /* name related flags */ 52 int pr_maxnamelen; /* max length for filename */ 53 int pr_maxlnamelen; /* max length for linkname */ 54 int pr_maxsname; /* max length for short filename */ 55 int pr_maxslname; /* max length for short linkname */ 56 int pr_maxprefix; /* max length of prefix if splitting */ 57 int pr_sparse_in_hdr; /* # of sparse entries in header */ 58 char pr_xftypetab[32]; /* (*1) list of supported file types */ 59 char pr_typeflagtab[256]; /* (*2) list of supported TCB typeflg */ 60 }; 61 62 /* 63 * 1) pr_xftypetab is used when creating archives only. 64 * 2) pr_typeflagtab is used when extracting archives only. 65 */ 66 67 /* 68 * general flags (pr_flags) 69 */ 70 #define PR_POSIX_OCTAL 0x0001 /* left fill octal number with '0' */ 71 #define PR_LOCAL_STAR 0x0002 /* can handle local star filetypes */ 72 #define PR_LOCAL_GNU 0x0004 /* can handle local gnu filetypes */ 73 #define PR_CPIO 0x0008 /* Unblocked CPIO archive */ 74 #define PR_SPARSE 0x0010 /* can handle sparse files */ 75 #define PR_GNU_SPARSE_BUG 0x0020 /* size does not contain ext. headr */ 76 #define PR_VOLHDR 0x0100 /* can handle volume headers */ 77 #define PR_XHDR 0x0200 /* POSIX.1-2001 extended headers */ 78 #define PR_VU_XHDR 0x0400 /* emit vendor unique P-2001 xhdrs */ 79 #define PR_BASE256 0x0800 /* can handle base 256 for numbers */ 80 #define PR_MULTIVOL 0x1000 /* can handle reliable multi vol ar */ 81 #define PR_SV_CPIO_LINKS 0x2000 /* hard link handling for SVr4 cpio */ 82 #define PR_LINK_DATA 0x4000 /* may include data for hard links */ 83 84 /* 85 * name related flags (pr_nflags) 86 */ 87 #define PR_POSIX_SPLIT 0x01 /* can do posix filename splitting */ 88 #define PR_PREFIX_REUSED 0x02 /* prefix space used by other option */ 89 #define PR_LONG_NAMES 0x04 /* can handle very long names */ 90 #define PR_DUMB_EOF 0x10 /* handle t_name[0] == '\0' as EOF */ 91 92 /* 93 * Macro to make pr_xftypetab easier to use. See also table.h/table.c. 94 */ 95 #define pr_unsuptype(i) (props.pr_xftypetab[(i)->f_xftype] == 0) 96 97 /* 98 * typeflagtab related flags 99 */ 100 #define TF_VALIDTYPE 0x01 /* A valid typeflag for extraction */ 101 #define TF_XHEADERS 0x02 /* This is a valid extended header */ 102 103 #define _pr_typeflags(c) (props.pr_typeflagtab[(Uchar)(c)]) 104 #define pr_validtype(c) ((_pr_typeflags(c) & TF_VALIDTYPE) != 0) 105 #define pr_isxheader(c) ((_pr_typeflags(c) & TF_XHEADERS) != 0) 106 107 extern struct properties props; 108