17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*b0ee9efaSGary Mills * Copyright (c) 2012 Gary Mills 23*b0ee9efaSGary Mills * 245fbb8099SNobutomo Nakano * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 28da6c28aaSamw /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 29da6c28aaSamw /* All Rights Reserved */ 30da6c28aaSamw 317c478bd9Sstevel@tonic-gate #ifndef _CPIO_H 327c478bd9Sstevel@tonic-gate #define _CPIO_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 385fbb8099SNobutomo Nakano #include <stdio.h> 395fbb8099SNobutomo Nakano #include <archives.h> 405fbb8099SNobutomo Nakano 417c478bd9Sstevel@tonic-gate /* Option Character keys (OC#), where '#' is the option character specified. */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #define OCa 0x1 447c478bd9Sstevel@tonic-gate #define OCb 0x2 457c478bd9Sstevel@tonic-gate #define OCc 0x4 467c478bd9Sstevel@tonic-gate #define OCd 0x8 477c478bd9Sstevel@tonic-gate #define OCf 0x10 487c478bd9Sstevel@tonic-gate #define OCi 0x20 497c478bd9Sstevel@tonic-gate #define OCk 0x40 507c478bd9Sstevel@tonic-gate #define OCl 0x80 517c478bd9Sstevel@tonic-gate #define OCm 0x100 527c478bd9Sstevel@tonic-gate #define OCo 0x200 537c478bd9Sstevel@tonic-gate #define OCp 0x400 547c478bd9Sstevel@tonic-gate #define OCr 0x800 557c478bd9Sstevel@tonic-gate #define OCs 0x1000 567c478bd9Sstevel@tonic-gate #define OCt 0x2000 577c478bd9Sstevel@tonic-gate #define OCu 0x4000 587c478bd9Sstevel@tonic-gate #define OCv 0x8000 597c478bd9Sstevel@tonic-gate #define OCA 0x10000 607c478bd9Sstevel@tonic-gate #define OCB 0x20000 617c478bd9Sstevel@tonic-gate #define OCC 0x40000 627c478bd9Sstevel@tonic-gate #define OCE 0x80000 637c478bd9Sstevel@tonic-gate #define OCH 0x100000 647c478bd9Sstevel@tonic-gate #define OCI 0x200000 657c478bd9Sstevel@tonic-gate #define OCL 0x400000 667c478bd9Sstevel@tonic-gate #define OCM 0x800000 677c478bd9Sstevel@tonic-gate #define OCO 0x1000000 687c478bd9Sstevel@tonic-gate #define OCR 0x2000000 697c478bd9Sstevel@tonic-gate #define OCS 0x4000000 707c478bd9Sstevel@tonic-gate #define OCV 0x8000000 717c478bd9Sstevel@tonic-gate #define OC6 0x10000000 727c478bd9Sstevel@tonic-gate #define BSM 0x20000000 737c478bd9Sstevel@tonic-gate #define OCP 0x40000000 74*b0ee9efaSGary Mills #define OCq 0x80000000 757c478bd9Sstevel@tonic-gate 765fbb8099SNobutomo Nakano /* Sparse file support */ 775fbb8099SNobutomo Nakano #define C_ISSPARSE 0200000 785fbb8099SNobutomo Nakano #define S_IFSPARSE 0x10000 795fbb8099SNobutomo Nakano #define HIGH_ORD_MASK 0x30000 805fbb8099SNobutomo Nakano #define S_ISSPARSE(mode) \ 815fbb8099SNobutomo Nakano (S_ISREG(mode) && (mode & HIGH_ORD_MASK) == S_IFSPARSE) 825fbb8099SNobutomo Nakano 837c478bd9Sstevel@tonic-gate /* Invalid option masks for each action option (-i, -o or -p). */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate #define INV_MSK4i (OCo | OCp | OCA | OCL | OCO) 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define INV_MSK4o (OCi | OCp | OCE | OCI | OCR) 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #define INV_MSK4p (OCf | OCi | OCo | OCr | OCt | OCA \ 907c478bd9Sstevel@tonic-gate | OCE | OCH | OCI | OCO) 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* Header types */ 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #define NONE 0 /* No header value verified */ 957c478bd9Sstevel@tonic-gate #define BIN 1 /* Binary */ 967c478bd9Sstevel@tonic-gate #define CHR 2 /* ASCII character (-c) */ 977c478bd9Sstevel@tonic-gate #define ASC 3 /* ASCII with expanded maj/min numbers */ 987c478bd9Sstevel@tonic-gate #define CRC 4 /* CRC with expanded maj/min numbers */ 997c478bd9Sstevel@tonic-gate #define TARTYP 5 /* Tar or USTAR */ 1007c478bd9Sstevel@tonic-gate #define SECURE 6 /* Secure system */ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* Differentiate between TAR and USTAR */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #define TAR 7 /* Regular tar */ 1057c478bd9Sstevel@tonic-gate #define USTAR 8 /* IEEE data interchange standard */ 1067c478bd9Sstevel@tonic-gate 1075fbb8099SNobutomo Nakano #define ULL_MAX_SIZE 20 1085fbb8099SNobutomo Nakano #define UL_MAX_SIZE 10 1095fbb8099SNobutomo Nakano 1107c478bd9Sstevel@tonic-gate /* constants for bar, used for extracting bar archives */ 1117c478bd9Sstevel@tonic-gate #define BAR 9 1127c478bd9Sstevel@tonic-gate #define BAR_VOLUME_MAGIC 'V' 1137c478bd9Sstevel@tonic-gate #define BARTYP 7 1147c478bd9Sstevel@tonic-gate #define BARSZ 512 1157c478bd9Sstevel@tonic-gate #define BAR_TAPE_SIZE (126*BARSZ) 1167c478bd9Sstevel@tonic-gate #define BAR_FLOPPY_SIZE (18*BARSZ) 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* the pathname lengths for the USTAR header */ 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #define MAXNAM 256 /* The maximum pathname length */ 1217c478bd9Sstevel@tonic-gate #define NAMSIZ 100 /* The maximum length of the name field */ 1227c478bd9Sstevel@tonic-gate #define PRESIZ 155 /* The maximum length of the prefix */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* HDRSZ: header size minus filename field length */ 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #define HDRSZ (Hdr.h_name - (char *)&Hdr) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate /* 1297c478bd9Sstevel@tonic-gate * IDENT: Determine if two stat() structures represent identical files. 1307c478bd9Sstevel@tonic-gate * Assumes that if the device and inode are the same the files are 1317c478bd9Sstevel@tonic-gate * identical (prevents the archive file from appearing in the archive). 1327c478bd9Sstevel@tonic-gate */ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #define IDENT(a, b) ((a.st_ino == b.st_ino && a.st_dev == b.st_dev) ? 1 : 0) 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * FLUSH: Determine if enough space remains in the buffer to hold 1387c478bd9Sstevel@tonic-gate * cnt bytes, if not, call bflush() to flush the buffer to the archive. 1397c478bd9Sstevel@tonic-gate */ 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #define FLUSH(cnt) if ((Buffr.b_end_p - Buffr.b_in_p) < cnt) bflush() 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* 1447c478bd9Sstevel@tonic-gate * FILL: Determine if enough bytes remain in the buffer to meet current needs, 1457c478bd9Sstevel@tonic-gate * if not, call rstbuf() to reset and refill the buffer from the archive. 1467c478bd9Sstevel@tonic-gate */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #define FILL(cnt) while (Buffr.b_cnt < cnt) rstbuf() 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate /* 1517c478bd9Sstevel@tonic-gate * VERBOSE: If x is non-zero, call verbose(). 1527c478bd9Sstevel@tonic-gate */ 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #define VERBOSE(x, name) if (x) verbose(name) 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate /* 1577c478bd9Sstevel@tonic-gate * FORMAT: Date time formats 1587c478bd9Sstevel@tonic-gate * b - abbreviated month name 1597c478bd9Sstevel@tonic-gate * e - day of month (1 - 31) 1607c478bd9Sstevel@tonic-gate * H - hour (00 - 23) 1617c478bd9Sstevel@tonic-gate * M - minute (00 - 59) 1627c478bd9Sstevel@tonic-gate * Y - year as ccyy 1637c478bd9Sstevel@tonic-gate */ 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate #define FORMAT "%b %e %H:%M %Y" 1667c478bd9Sstevel@tonic-gate 167da6c28aaSamw /* Extended system attributes */ 168da6c28aaSamw #ifndef VIEW_READONLY 169da6c28aaSamw #define VIEW_READONLY "SUNWattr_ro" 170da6c28aaSamw #endif 171da6c28aaSamw 172da6c28aaSamw #ifndef VIEW_READWRITE 173da6c28aaSamw #define VIEW_READWRITE "SUNWattr_rw" 174da6c28aaSamw #endif 175da6c28aaSamw 176ced83f9bSceastha #define min(a, b) ((a) < (b) ? (a) : (b)) 177ced83f9bSceastha 1787c478bd9Sstevel@tonic-gate /* Values used in typeflag field */ 1797c478bd9Sstevel@tonic-gate #define REGTYPE '0' /* Regular File */ 1807c478bd9Sstevel@tonic-gate #define LNKTYPE '1' /* Link */ 1817c478bd9Sstevel@tonic-gate #define SYMTYPE '2' /* Reserved */ 1827c478bd9Sstevel@tonic-gate #define CHRTYPE '3' /* Character Special File */ 1837c478bd9Sstevel@tonic-gate #define BLKTYPE '4' /* Block Special File */ 1847c478bd9Sstevel@tonic-gate #define DIRTYPE '5' /* Directory */ 1857c478bd9Sstevel@tonic-gate #define FIFOTYPE '6' /* FIFO */ 1867c478bd9Sstevel@tonic-gate #define CONTTYPE '7' /* Reserved */ 1877c478bd9Sstevel@tonic-gate #define XHDRTYPE 'X' /* Extended header */ 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate #define INPUT 0 /* -i mode (used for chgreel() */ 1907c478bd9Sstevel@tonic-gate #define OUTPUT 1 /* -o mode (used for chgreel() */ 1917c478bd9Sstevel@tonic-gate #define APATH 1024 /* maximum ASC or CRC header path length */ 1927c478bd9Sstevel@tonic-gate #define CPATH 256 /* maximum -c and binary path length */ 1937c478bd9Sstevel@tonic-gate #define BUFSZ 512 /* default buffer size for archive I/O */ 1947c478bd9Sstevel@tonic-gate #define CPIOBSZ 8192 /* buffer size for file system I/O */ 1957c478bd9Sstevel@tonic-gate #define LNK_INC 500 /* link allocation increment */ 1967c478bd9Sstevel@tonic-gate #define MX_BUFS 10 /* max. number of buffers to allocate */ 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate #define F_SKIP 0 /* an object did not match the patterns */ 1997c478bd9Sstevel@tonic-gate #define F_LINK 1 /* linked file */ 2007c478bd9Sstevel@tonic-gate #define F_EXTR 2 /* extract non-linked object that matched patterns */ 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #define MX_SEEKS 10 /* max. number of lseek attempts after error */ 2037c478bd9Sstevel@tonic-gate #define SEEK_ABS 0 /* lseek absolute */ 2047c478bd9Sstevel@tonic-gate #define SEEK_REL 1 /* lseek relative */ 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate /* 2077c478bd9Sstevel@tonic-gate * xxx_CNT represents the number of sscanf items that will be matched 2087c478bd9Sstevel@tonic-gate * if the sscanf to read a header is successful. If sscanf returns a number 2097c478bd9Sstevel@tonic-gate * that is not equal to this, an error occured (which indicates that this 2107c478bd9Sstevel@tonic-gate * is not a valid header of the type assumed. 2117c478bd9Sstevel@tonic-gate */ 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate #define ASC_CNT 14 /* ASC and CRC headers */ 2147c478bd9Sstevel@tonic-gate #define CHR_CNT 11 /* CHR header */ 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* These defines determine the severity of the message sent to the user. */ 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate #define ERR 1 /* Error message (warning) - not fatal */ 2197c478bd9Sstevel@tonic-gate #define EXT 2 /* Error message - fatal, causes exit */ 2207c478bd9Sstevel@tonic-gate #define ERRN 3 /* Error message with errno (warning) - not fatal */ 2217c478bd9Sstevel@tonic-gate #define EXTN 4 /* Error message with errno - fatal, causes exit */ 2227c478bd9Sstevel@tonic-gate #define POST 5 /* Information message, not an error */ 2237c478bd9Sstevel@tonic-gate #define EPOST 6 /* Information message to stderr */ 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gate #define SIXTH 060000 /* UNIX 6th edition files */ 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #define P_SKIP 0 /* File should be skipped */ 2287c478bd9Sstevel@tonic-gate #define P_PROC 1 /* File should be processed */ 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate #define U_KEEP 0 /* Keep the existing version of a file (-u) */ 2317c478bd9Sstevel@tonic-gate #define U_OVER 1 /* Overwrite the existing version of a file (-u) */ 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate /* 2347c478bd9Sstevel@tonic-gate * _20K: Allocate the maximum of (20K or (MX_BUFS * Bufsize)) bytes 2357c478bd9Sstevel@tonic-gate * for the main I/O buffer. Therefore if a user specifies a small buffer 2367c478bd9Sstevel@tonic-gate * size, they still get decent performance due to the buffering strategy. 2377c478bd9Sstevel@tonic-gate */ 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #define _20K 20480 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate #define HALFWD 1 /* Pad headers/data to halfword boundaries */ 2427c478bd9Sstevel@tonic-gate #define FULLWD 3 /* Pad headers/data to word boundaries */ 2437c478bd9Sstevel@tonic-gate #define FULLBK 511 /* Pad headers/data to 512 byte boundaries */ 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* bar structure */ 2467c478bd9Sstevel@tonic-gate union b_block { 2477c478bd9Sstevel@tonic-gate char dummy[TBLOCK]; 2487c478bd9Sstevel@tonic-gate struct bar_header { 2497c478bd9Sstevel@tonic-gate char mode[8]; 2507c478bd9Sstevel@tonic-gate char uid[8]; 2517c478bd9Sstevel@tonic-gate char gid[8]; 2527c478bd9Sstevel@tonic-gate char size[12]; 2537c478bd9Sstevel@tonic-gate char mtime[12]; 2547c478bd9Sstevel@tonic-gate char chksum[8]; 2557c478bd9Sstevel@tonic-gate char rdev[8]; 2567c478bd9Sstevel@tonic-gate char linkflag; 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate /* 2597c478bd9Sstevel@tonic-gate * The following fields are specific to the volume 2607c478bd9Sstevel@tonic-gate * header. They are set to zero in all file headers 2617c478bd9Sstevel@tonic-gate * in the archive. 2627c478bd9Sstevel@tonic-gate */ 2637c478bd9Sstevel@tonic-gate char bar_magic[2]; /* magic number */ 2647c478bd9Sstevel@tonic-gate char volume_num[4]; /* volume number */ 2657c478bd9Sstevel@tonic-gate char compressed; /* files compressed = 1 */ 2667c478bd9Sstevel@tonic-gate char date[12]; /* date of archive mmddhhmm */ 2677c478bd9Sstevel@tonic-gate char start_of_name; /* start of the filename */ 2687c478bd9Sstevel@tonic-gate } dbuf; 2697c478bd9Sstevel@tonic-gate }; 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate /* svr32 stat structure -- for -Hodc headers */ 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate typedef struct cpioinfo { 2747c478bd9Sstevel@tonic-gate o_dev_t st_dev; 2757c478bd9Sstevel@tonic-gate o_ino_t st_ino; 2767c478bd9Sstevel@tonic-gate o_mode_t st_mode; 2777c478bd9Sstevel@tonic-gate o_nlink_t st_nlink; 2787c478bd9Sstevel@tonic-gate uid_t st_uid; /* actual uid */ 2797c478bd9Sstevel@tonic-gate gid_t st_gid; /* actual gid */ 2807c478bd9Sstevel@tonic-gate o_dev_t st_rdev; 2817c478bd9Sstevel@tonic-gate off_t st_size; 2827c478bd9Sstevel@tonic-gate time_t st_modtime; 2837c478bd9Sstevel@tonic-gate } cpioinfo_t; 2847c478bd9Sstevel@tonic-gate 2855fbb8099SNobutomo Nakano extern void msg(int severity, const char *fmt, ...); 2865fbb8099SNobutomo Nakano extern void stat_to_svr32_stat(cpioinfo_t *TmpSt, struct stat *FromStat); 2875fbb8099SNobutomo Nakano 2885fbb8099SNobutomo Nakano /* 2895fbb8099SNobutomo Nakano * Allocation wrappers and their flags 2905fbb8099SNobutomo Nakano */ 2915fbb8099SNobutomo Nakano #define E_NORMAL 0x0 /* Return NULL if allocation fails */ 2925fbb8099SNobutomo Nakano #define E_EXIT 0x1 /* Exit if allocation fails */ 2935fbb8099SNobutomo Nakano 2945fbb8099SNobutomo Nakano extern void *e_realloc(int flag, void *old, size_t newsize); 2955fbb8099SNobutomo Nakano extern char *e_strdup(int flag, const char *arg); 2965fbb8099SNobutomo Nakano extern void *e_valloc(int flag, size_t size); 2975fbb8099SNobutomo Nakano extern void *e_zalloc(int flag, size_t size); 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate /* 3007c478bd9Sstevel@tonic-gate * If compiling on a system that doesn't 3017c478bd9Sstevel@tonic-gate * support extended attributes, then 3027c478bd9Sstevel@tonic-gate * define a couple of things so we can compile. 3037c478bd9Sstevel@tonic-gate */ 3047c478bd9Sstevel@tonic-gate #if !defined(O_XATTR) 3057c478bd9Sstevel@tonic-gate #define AT_SYMLINK_NOFOLLOW 0x1000 3067c478bd9Sstevel@tonic-gate #define AT_REMOVEDIR 0x0001 3077c478bd9Sstevel@tonic-gate #define _XATTR_CPIO_MODE 0xB000 3087c478bd9Sstevel@tonic-gate #define _XATTR_HDRTYPE 'E' 3097c478bd9Sstevel@tonic-gate #endif /* O_XATTR */ 3107c478bd9Sstevel@tonic-gate 3115fbb8099SNobutomo Nakano /* 3125fbb8099SNobutomo Nakano * Sparse file support 3135fbb8099SNobutomo Nakano */ 3145fbb8099SNobutomo Nakano #define MIN_HOLES_HDRSIZE (UL_MAX_SIZE + 1 + ULL_MAX_SIZE + 1) 3155fbb8099SNobutomo Nakano 3165fbb8099SNobutomo Nakano typedef struct holes_list { 3175fbb8099SNobutomo Nakano off_t hl_data; 3185fbb8099SNobutomo Nakano off_t hl_hole; 3195fbb8099SNobutomo Nakano struct holes_list *hl_next; 3205fbb8099SNobutomo Nakano } holes_list_t; 3215fbb8099SNobutomo Nakano 3225fbb8099SNobutomo Nakano typedef struct holes_info { 3235fbb8099SNobutomo Nakano holes_list_t *holes_list; /* linked list of holes_list */ 3245fbb8099SNobutomo Nakano off_t orig_size; /* original file size */ 3255fbb8099SNobutomo Nakano off_t data_size; /* compressed file size */ 3265fbb8099SNobutomo Nakano char *holesdata; /* holesdata string */ 3275fbb8099SNobutomo Nakano size_t holesdata_sz; /* string size */ 3285fbb8099SNobutomo Nakano } holes_info_t; 3295fbb8099SNobutomo Nakano 3305fbb8099SNobutomo Nakano extern holes_info_t *get_holes_info(int, off_t, boolean_t); 3315fbb8099SNobutomo Nakano extern holes_info_t *read_holes_header(const char *, off_t); 3325fbb8099SNobutomo Nakano extern int parse_holesdata(holes_info_t *, const char *); 3335fbb8099SNobutomo Nakano extern void free_holes_info(holes_info_t *); 3345fbb8099SNobutomo Nakano 3355fbb8099SNobutomo Nakano extern void str_fprintf(FILE *, const char *, ...); 3365fbb8099SNobutomo Nakano 3377c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3387c478bd9Sstevel@tonic-gate } 3397c478bd9Sstevel@tonic-gate #endif 3407c478bd9Sstevel@tonic-gate 3417c478bd9Sstevel@tonic-gate #endif /* _CPIO_H */ 342