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*5fbb8099SNobutomo Nakano * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 26da6c28aaSamw /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 27da6c28aaSamw /* All Rights Reserved */ 28da6c28aaSamw 297c478bd9Sstevel@tonic-gate #ifndef _CPIO_H 307c478bd9Sstevel@tonic-gate #define _CPIO_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 36*5fbb8099SNobutomo Nakano #include <stdio.h> 37*5fbb8099SNobutomo Nakano #include <archives.h> 38*5fbb8099SNobutomo Nakano 397c478bd9Sstevel@tonic-gate /* Option Character keys (OC#), where '#' is the option character specified. */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define OCa 0x1 427c478bd9Sstevel@tonic-gate #define OCb 0x2 437c478bd9Sstevel@tonic-gate #define OCc 0x4 447c478bd9Sstevel@tonic-gate #define OCd 0x8 457c478bd9Sstevel@tonic-gate #define OCf 0x10 467c478bd9Sstevel@tonic-gate #define OCi 0x20 477c478bd9Sstevel@tonic-gate #define OCk 0x40 487c478bd9Sstevel@tonic-gate #define OCl 0x80 497c478bd9Sstevel@tonic-gate #define OCm 0x100 507c478bd9Sstevel@tonic-gate #define OCo 0x200 517c478bd9Sstevel@tonic-gate #define OCp 0x400 527c478bd9Sstevel@tonic-gate #define OCr 0x800 537c478bd9Sstevel@tonic-gate #define OCs 0x1000 547c478bd9Sstevel@tonic-gate #define OCt 0x2000 557c478bd9Sstevel@tonic-gate #define OCu 0x4000 567c478bd9Sstevel@tonic-gate #define OCv 0x8000 577c478bd9Sstevel@tonic-gate #define OCA 0x10000 587c478bd9Sstevel@tonic-gate #define OCB 0x20000 597c478bd9Sstevel@tonic-gate #define OCC 0x40000 607c478bd9Sstevel@tonic-gate #define OCE 0x80000 617c478bd9Sstevel@tonic-gate #define OCH 0x100000 627c478bd9Sstevel@tonic-gate #define OCI 0x200000 637c478bd9Sstevel@tonic-gate #define OCL 0x400000 647c478bd9Sstevel@tonic-gate #define OCM 0x800000 657c478bd9Sstevel@tonic-gate #define OCO 0x1000000 667c478bd9Sstevel@tonic-gate #define OCR 0x2000000 677c478bd9Sstevel@tonic-gate #define OCS 0x4000000 687c478bd9Sstevel@tonic-gate #define OCV 0x8000000 697c478bd9Sstevel@tonic-gate #define OC6 0x10000000 707c478bd9Sstevel@tonic-gate #define BSM 0x20000000 717c478bd9Sstevel@tonic-gate #define OCP 0x40000000 727c478bd9Sstevel@tonic-gate 73*5fbb8099SNobutomo Nakano /* Sparse file support */ 74*5fbb8099SNobutomo Nakano #define C_ISSPARSE 0200000 75*5fbb8099SNobutomo Nakano #define S_IFSPARSE 0x10000 76*5fbb8099SNobutomo Nakano #define HIGH_ORD_MASK 0x30000 77*5fbb8099SNobutomo Nakano #define S_ISSPARSE(mode) \ 78*5fbb8099SNobutomo Nakano (S_ISREG(mode) && (mode & HIGH_ORD_MASK) == S_IFSPARSE) 79*5fbb8099SNobutomo Nakano 807c478bd9Sstevel@tonic-gate /* Invalid option masks for each action option (-i, -o or -p). */ 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define INV_MSK4i (OCo | OCp | OCA | OCL | OCO) 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate #define INV_MSK4o (OCi | OCp | OCE | OCI | OCR) 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define INV_MSK4p (OCf | OCi | OCo | OCr | OCt | OCA \ 877c478bd9Sstevel@tonic-gate | OCE | OCH | OCI | OCO) 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate /* Header types */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #define NONE 0 /* No header value verified */ 927c478bd9Sstevel@tonic-gate #define BIN 1 /* Binary */ 937c478bd9Sstevel@tonic-gate #define CHR 2 /* ASCII character (-c) */ 947c478bd9Sstevel@tonic-gate #define ASC 3 /* ASCII with expanded maj/min numbers */ 957c478bd9Sstevel@tonic-gate #define CRC 4 /* CRC with expanded maj/min numbers */ 967c478bd9Sstevel@tonic-gate #define TARTYP 5 /* Tar or USTAR */ 977c478bd9Sstevel@tonic-gate #define SECURE 6 /* Secure system */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* Differentiate between TAR and USTAR */ 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #define TAR 7 /* Regular tar */ 1027c478bd9Sstevel@tonic-gate #define USTAR 8 /* IEEE data interchange standard */ 1037c478bd9Sstevel@tonic-gate 104*5fbb8099SNobutomo Nakano #define ULL_MAX_SIZE 20 105*5fbb8099SNobutomo Nakano #define UL_MAX_SIZE 10 106*5fbb8099SNobutomo Nakano 1077c478bd9Sstevel@tonic-gate /* constants for bar, used for extracting bar archives */ 1087c478bd9Sstevel@tonic-gate #define BAR 9 1097c478bd9Sstevel@tonic-gate #define BAR_VOLUME_MAGIC 'V' 1107c478bd9Sstevel@tonic-gate #define BARTYP 7 1117c478bd9Sstevel@tonic-gate #define BARSZ 512 1127c478bd9Sstevel@tonic-gate #define BAR_TAPE_SIZE (126*BARSZ) 1137c478bd9Sstevel@tonic-gate #define BAR_FLOPPY_SIZE (18*BARSZ) 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* the pathname lengths for the USTAR header */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define MAXNAM 256 /* The maximum pathname length */ 1187c478bd9Sstevel@tonic-gate #define NAMSIZ 100 /* The maximum length of the name field */ 1197c478bd9Sstevel@tonic-gate #define PRESIZ 155 /* The maximum length of the prefix */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* HDRSZ: header size minus filename field length */ 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate #define HDRSZ (Hdr.h_name - (char *)&Hdr) 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* 1267c478bd9Sstevel@tonic-gate * IDENT: Determine if two stat() structures represent identical files. 1277c478bd9Sstevel@tonic-gate * Assumes that if the device and inode are the same the files are 1287c478bd9Sstevel@tonic-gate * identical (prevents the archive file from appearing in the archive). 1297c478bd9Sstevel@tonic-gate */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate #define IDENT(a, b) ((a.st_ino == b.st_ino && a.st_dev == b.st_dev) ? 1 : 0) 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate /* 1347c478bd9Sstevel@tonic-gate * FLUSH: Determine if enough space remains in the buffer to hold 1357c478bd9Sstevel@tonic-gate * cnt bytes, if not, call bflush() to flush the buffer to the archive. 1367c478bd9Sstevel@tonic-gate */ 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #define FLUSH(cnt) if ((Buffr.b_end_p - Buffr.b_in_p) < cnt) bflush() 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate /* 1417c478bd9Sstevel@tonic-gate * FILL: Determine if enough bytes remain in the buffer to meet current needs, 1427c478bd9Sstevel@tonic-gate * if not, call rstbuf() to reset and refill the buffer from the archive. 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate #define FILL(cnt) while (Buffr.b_cnt < cnt) rstbuf() 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate /* 1487c478bd9Sstevel@tonic-gate * VERBOSE: If x is non-zero, call verbose(). 1497c478bd9Sstevel@tonic-gate */ 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #define VERBOSE(x, name) if (x) verbose(name) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate /* 1547c478bd9Sstevel@tonic-gate * FORMAT: Date time formats 1557c478bd9Sstevel@tonic-gate * b - abbreviated month name 1567c478bd9Sstevel@tonic-gate * e - day of month (1 - 31) 1577c478bd9Sstevel@tonic-gate * H - hour (00 - 23) 1587c478bd9Sstevel@tonic-gate * M - minute (00 - 59) 1597c478bd9Sstevel@tonic-gate * Y - year as ccyy 1607c478bd9Sstevel@tonic-gate */ 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate #define FORMAT "%b %e %H:%M %Y" 1637c478bd9Sstevel@tonic-gate 164da6c28aaSamw /* Extended system attributes */ 165da6c28aaSamw #ifndef VIEW_READONLY 166da6c28aaSamw #define VIEW_READONLY "SUNWattr_ro" 167da6c28aaSamw #endif 168da6c28aaSamw 169da6c28aaSamw #ifndef VIEW_READWRITE 170da6c28aaSamw #define VIEW_READWRITE "SUNWattr_rw" 171da6c28aaSamw #endif 172da6c28aaSamw 173ced83f9bSceastha #define min(a, b) ((a) < (b) ? (a) : (b)) 174ced83f9bSceastha 1757c478bd9Sstevel@tonic-gate /* Values used in typeflag field */ 1767c478bd9Sstevel@tonic-gate #define REGTYPE '0' /* Regular File */ 1777c478bd9Sstevel@tonic-gate #define LNKTYPE '1' /* Link */ 1787c478bd9Sstevel@tonic-gate #define SYMTYPE '2' /* Reserved */ 1797c478bd9Sstevel@tonic-gate #define CHRTYPE '3' /* Character Special File */ 1807c478bd9Sstevel@tonic-gate #define BLKTYPE '4' /* Block Special File */ 1817c478bd9Sstevel@tonic-gate #define DIRTYPE '5' /* Directory */ 1827c478bd9Sstevel@tonic-gate #define FIFOTYPE '6' /* FIFO */ 1837c478bd9Sstevel@tonic-gate #define CONTTYPE '7' /* Reserved */ 1847c478bd9Sstevel@tonic-gate #define XHDRTYPE 'X' /* Extended header */ 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate #define INPUT 0 /* -i mode (used for chgreel() */ 1877c478bd9Sstevel@tonic-gate #define OUTPUT 1 /* -o mode (used for chgreel() */ 1887c478bd9Sstevel@tonic-gate #define APATH 1024 /* maximum ASC or CRC header path length */ 1897c478bd9Sstevel@tonic-gate #define CPATH 256 /* maximum -c and binary path length */ 1907c478bd9Sstevel@tonic-gate #define BUFSZ 512 /* default buffer size for archive I/O */ 1917c478bd9Sstevel@tonic-gate #define CPIOBSZ 8192 /* buffer size for file system I/O */ 1927c478bd9Sstevel@tonic-gate #define LNK_INC 500 /* link allocation increment */ 1937c478bd9Sstevel@tonic-gate #define MX_BUFS 10 /* max. number of buffers to allocate */ 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate #define F_SKIP 0 /* an object did not match the patterns */ 1967c478bd9Sstevel@tonic-gate #define F_LINK 1 /* linked file */ 1977c478bd9Sstevel@tonic-gate #define F_EXTR 2 /* extract non-linked object that matched patterns */ 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate #define MX_SEEKS 10 /* max. number of lseek attempts after error */ 2007c478bd9Sstevel@tonic-gate #define SEEK_ABS 0 /* lseek absolute */ 2017c478bd9Sstevel@tonic-gate #define SEEK_REL 1 /* lseek relative */ 2027c478bd9Sstevel@tonic-gate 2037c478bd9Sstevel@tonic-gate /* 2047c478bd9Sstevel@tonic-gate * xxx_CNT represents the number of sscanf items that will be matched 2057c478bd9Sstevel@tonic-gate * if the sscanf to read a header is successful. If sscanf returns a number 2067c478bd9Sstevel@tonic-gate * that is not equal to this, an error occured (which indicates that this 2077c478bd9Sstevel@tonic-gate * is not a valid header of the type assumed. 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate #define ASC_CNT 14 /* ASC and CRC headers */ 2117c478bd9Sstevel@tonic-gate #define CHR_CNT 11 /* CHR header */ 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate /* These defines determine the severity of the message sent to the user. */ 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate #define ERR 1 /* Error message (warning) - not fatal */ 2167c478bd9Sstevel@tonic-gate #define EXT 2 /* Error message - fatal, causes exit */ 2177c478bd9Sstevel@tonic-gate #define ERRN 3 /* Error message with errno (warning) - not fatal */ 2187c478bd9Sstevel@tonic-gate #define EXTN 4 /* Error message with errno - fatal, causes exit */ 2197c478bd9Sstevel@tonic-gate #define POST 5 /* Information message, not an error */ 2207c478bd9Sstevel@tonic-gate #define EPOST 6 /* Information message to stderr */ 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #define SIXTH 060000 /* UNIX 6th edition files */ 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate #define P_SKIP 0 /* File should be skipped */ 2257c478bd9Sstevel@tonic-gate #define P_PROC 1 /* File should be processed */ 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate #define U_KEEP 0 /* Keep the existing version of a file (-u) */ 2287c478bd9Sstevel@tonic-gate #define U_OVER 1 /* Overwrite the existing version of a file (-u) */ 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* 2317c478bd9Sstevel@tonic-gate * _20K: Allocate the maximum of (20K or (MX_BUFS * Bufsize)) bytes 2327c478bd9Sstevel@tonic-gate * for the main I/O buffer. Therefore if a user specifies a small buffer 2337c478bd9Sstevel@tonic-gate * size, they still get decent performance due to the buffering strategy. 2347c478bd9Sstevel@tonic-gate */ 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate #define _20K 20480 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate #define HALFWD 1 /* Pad headers/data to halfword boundaries */ 2397c478bd9Sstevel@tonic-gate #define FULLWD 3 /* Pad headers/data to word boundaries */ 2407c478bd9Sstevel@tonic-gate #define FULLBK 511 /* Pad headers/data to 512 byte boundaries */ 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate /* bar structure */ 2437c478bd9Sstevel@tonic-gate union b_block { 2447c478bd9Sstevel@tonic-gate char dummy[TBLOCK]; 2457c478bd9Sstevel@tonic-gate struct bar_header { 2467c478bd9Sstevel@tonic-gate char mode[8]; 2477c478bd9Sstevel@tonic-gate char uid[8]; 2487c478bd9Sstevel@tonic-gate char gid[8]; 2497c478bd9Sstevel@tonic-gate char size[12]; 2507c478bd9Sstevel@tonic-gate char mtime[12]; 2517c478bd9Sstevel@tonic-gate char chksum[8]; 2527c478bd9Sstevel@tonic-gate char rdev[8]; 2537c478bd9Sstevel@tonic-gate char linkflag; 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate /* 2567c478bd9Sstevel@tonic-gate * The following fields are specific to the volume 2577c478bd9Sstevel@tonic-gate * header. They are set to zero in all file headers 2587c478bd9Sstevel@tonic-gate * in the archive. 2597c478bd9Sstevel@tonic-gate */ 2607c478bd9Sstevel@tonic-gate char bar_magic[2]; /* magic number */ 2617c478bd9Sstevel@tonic-gate char volume_num[4]; /* volume number */ 2627c478bd9Sstevel@tonic-gate char compressed; /* files compressed = 1 */ 2637c478bd9Sstevel@tonic-gate char date[12]; /* date of archive mmddhhmm */ 2647c478bd9Sstevel@tonic-gate char start_of_name; /* start of the filename */ 2657c478bd9Sstevel@tonic-gate } dbuf; 2667c478bd9Sstevel@tonic-gate }; 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* svr32 stat structure -- for -Hodc headers */ 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate typedef struct cpioinfo { 2717c478bd9Sstevel@tonic-gate o_dev_t st_dev; 2727c478bd9Sstevel@tonic-gate o_ino_t st_ino; 2737c478bd9Sstevel@tonic-gate o_mode_t st_mode; 2747c478bd9Sstevel@tonic-gate o_nlink_t st_nlink; 2757c478bd9Sstevel@tonic-gate uid_t st_uid; /* actual uid */ 2767c478bd9Sstevel@tonic-gate gid_t st_gid; /* actual gid */ 2777c478bd9Sstevel@tonic-gate o_dev_t st_rdev; 2787c478bd9Sstevel@tonic-gate off_t st_size; 2797c478bd9Sstevel@tonic-gate time_t st_modtime; 2807c478bd9Sstevel@tonic-gate } cpioinfo_t; 2817c478bd9Sstevel@tonic-gate 282*5fbb8099SNobutomo Nakano extern void msg(int severity, const char *fmt, ...); 283*5fbb8099SNobutomo Nakano extern void stat_to_svr32_stat(cpioinfo_t *TmpSt, struct stat *FromStat); 284*5fbb8099SNobutomo Nakano 285*5fbb8099SNobutomo Nakano /* 286*5fbb8099SNobutomo Nakano * Allocation wrappers and their flags 287*5fbb8099SNobutomo Nakano */ 288*5fbb8099SNobutomo Nakano #define E_NORMAL 0x0 /* Return NULL if allocation fails */ 289*5fbb8099SNobutomo Nakano #define E_EXIT 0x1 /* Exit if allocation fails */ 290*5fbb8099SNobutomo Nakano 291*5fbb8099SNobutomo Nakano extern void *e_realloc(int flag, void *old, size_t newsize); 292*5fbb8099SNobutomo Nakano extern char *e_strdup(int flag, const char *arg); 293*5fbb8099SNobutomo Nakano extern void *e_valloc(int flag, size_t size); 294*5fbb8099SNobutomo Nakano extern void *e_zalloc(int flag, size_t size); 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate /* 2977c478bd9Sstevel@tonic-gate * If compiling on a system that doesn't 2987c478bd9Sstevel@tonic-gate * support extended attributes, then 2997c478bd9Sstevel@tonic-gate * define a couple of things so we can compile. 3007c478bd9Sstevel@tonic-gate */ 3017c478bd9Sstevel@tonic-gate #if !defined(O_XATTR) 3027c478bd9Sstevel@tonic-gate #define AT_SYMLINK_NOFOLLOW 0x1000 3037c478bd9Sstevel@tonic-gate #define AT_REMOVEDIR 0x0001 3047c478bd9Sstevel@tonic-gate #define _XATTR_CPIO_MODE 0xB000 3057c478bd9Sstevel@tonic-gate #define _XATTR_HDRTYPE 'E' 3067c478bd9Sstevel@tonic-gate #endif /* O_XATTR */ 3077c478bd9Sstevel@tonic-gate 308*5fbb8099SNobutomo Nakano /* 309*5fbb8099SNobutomo Nakano * Sparse file support 310*5fbb8099SNobutomo Nakano */ 311*5fbb8099SNobutomo Nakano #define MIN_HOLES_HDRSIZE (UL_MAX_SIZE + 1 + ULL_MAX_SIZE + 1) 312*5fbb8099SNobutomo Nakano 313*5fbb8099SNobutomo Nakano typedef struct holes_list { 314*5fbb8099SNobutomo Nakano off_t hl_data; 315*5fbb8099SNobutomo Nakano off_t hl_hole; 316*5fbb8099SNobutomo Nakano struct holes_list *hl_next; 317*5fbb8099SNobutomo Nakano } holes_list_t; 318*5fbb8099SNobutomo Nakano 319*5fbb8099SNobutomo Nakano typedef struct holes_info { 320*5fbb8099SNobutomo Nakano holes_list_t *holes_list; /* linked list of holes_list */ 321*5fbb8099SNobutomo Nakano off_t orig_size; /* original file size */ 322*5fbb8099SNobutomo Nakano off_t data_size; /* compressed file size */ 323*5fbb8099SNobutomo Nakano char *holesdata; /* holesdata string */ 324*5fbb8099SNobutomo Nakano size_t holesdata_sz; /* string size */ 325*5fbb8099SNobutomo Nakano } holes_info_t; 326*5fbb8099SNobutomo Nakano 327*5fbb8099SNobutomo Nakano extern holes_info_t *get_holes_info(int, off_t, boolean_t); 328*5fbb8099SNobutomo Nakano extern holes_info_t *read_holes_header(const char *, off_t); 329*5fbb8099SNobutomo Nakano extern int parse_holesdata(holes_info_t *, const char *); 330*5fbb8099SNobutomo Nakano extern void free_holes_info(holes_info_t *); 331*5fbb8099SNobutomo Nakano 332*5fbb8099SNobutomo Nakano extern void str_fprintf(FILE *, const char *, ...); 333*5fbb8099SNobutomo Nakano 3347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3357c478bd9Sstevel@tonic-gate } 3367c478bd9Sstevel@tonic-gate #endif 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate #endif /* _CPIO_H */ 339