dd.h revision 1556
11556Srgrimes/*- 21556Srgrimes * Copyright (c) 1991, 1993, 1994 31556Srgrimes * The Regents of the University of California. All rights reserved. 41556Srgrimes * 51556Srgrimes * This code is derived from software contributed to Berkeley by 61556Srgrimes * Keith Muller of the University of California, San Diego and Lance 71556Srgrimes * Visser of Convex Computer Corporation. 81556Srgrimes * 91556Srgrimes * Redistribution and use in source and binary forms, with or without 101556Srgrimes * modification, are permitted provided that the following conditions 111556Srgrimes * are met: 121556Srgrimes * 1. Redistributions of source code must retain the above copyright 131556Srgrimes * notice, this list of conditions and the following disclaimer. 141556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 151556Srgrimes * notice, this list of conditions and the following disclaimer in the 161556Srgrimes * documentation and/or other materials provided with the distribution. 171556Srgrimes * 3. All advertising materials mentioning features or use of this software 181556Srgrimes * must display the following acknowledgement: 191556Srgrimes * This product includes software developed by the University of 201556Srgrimes * California, Berkeley and its contributors. 211556Srgrimes * 4. Neither the name of the University nor the names of its contributors 221556Srgrimes * may be used to endorse or promote products derived from this software 231556Srgrimes * without specific prior written permission. 241556Srgrimes * 251556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 261556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 271556Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 281556Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 291556Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 301556Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 311556Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 321556Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 331556Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 341556Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 351556Srgrimes * SUCH DAMAGE. 361556Srgrimes * 371556Srgrimes * @(#)dd.h 8.3 (Berkeley) 4/2/94 381556Srgrimes */ 391556Srgrimes 401556Srgrimes/* Input/output stream state. */ 411556Srgrimestypedef struct { 421556Srgrimes u_char *db; /* buffer address */ 431556Srgrimes u_char *dbp; /* current buffer I/O address */ 441556Srgrimes u_long dbcnt; /* current buffer byte count */ 451556Srgrimes int dbrcnt; /* last read byte count */ 461556Srgrimes u_long dbsz; /* buffer size */ 471556Srgrimes 481556Srgrimes#define ISCHR 0x01 /* character device (warn on short) */ 491556Srgrimes#define ISPIPE 0x02 /* pipe (not truncatable) */ 501556Srgrimes#define ISTAPE 0x04 /* tape (not seekable) */ 511556Srgrimes#define NOREAD 0x08 /* not readable */ 521556Srgrimes u_int flags; 531556Srgrimes 541556Srgrimes char *name; /* name */ 551556Srgrimes int fd; /* file descriptor */ 561556Srgrimes u_long offset; /* # of blocks to skip */ 571556Srgrimes 581556Srgrimes u_long f_stats; /* # of full blocks processed */ 591556Srgrimes u_long p_stats; /* # of partial blocks processed */ 601556Srgrimes u_long s_stats; /* # of odd swab blocks */ 611556Srgrimes u_long t_stats; /* # of truncations */ 621556Srgrimes} IO; 631556Srgrimes 641556Srgrimestypedef struct { 651556Srgrimes u_long in_full; /* # of full input blocks */ 661556Srgrimes u_long in_part; /* # of partial input blocks */ 671556Srgrimes u_long out_full; /* # of full output blocks */ 681556Srgrimes u_long out_part; /* # of partial output blocks */ 691556Srgrimes u_long trunc; /* # of truncated records */ 701556Srgrimes u_long swab; /* # of odd-length swab blocks */ 711556Srgrimes u_long bytes; /* # of bytes written */ 721556Srgrimes time_t start; /* start time of dd */ 731556Srgrimes} STAT; 741556Srgrimes 751556Srgrimes/* Flags (in ddflags). */ 761556Srgrimes#define C_ASCII 0x00001 771556Srgrimes#define C_BLOCK 0x00002 781556Srgrimes#define C_BS 0x00004 791556Srgrimes#define C_CBS 0x00008 801556Srgrimes#define C_COUNT 0x00010 811556Srgrimes#define C_EBCDIC 0x00020 821556Srgrimes#define C_FILES 0x00040 831556Srgrimes#define C_IBS 0x00080 841556Srgrimes#define C_IF 0x00100 851556Srgrimes#define C_LCASE 0x00200 861556Srgrimes#define C_NOERROR 0x00400 871556Srgrimes#define C_NOTRUNC 0x00800 881556Srgrimes#define C_OBS 0x01000 891556Srgrimes#define C_OF 0x02000 901556Srgrimes#define C_SEEK 0x04000 911556Srgrimes#define C_SKIP 0x08000 921556Srgrimes#define C_SWAB 0x10000 931556Srgrimes#define C_SYNC 0x20000 941556Srgrimes#define C_UCASE 0x40000 951556Srgrimes#define C_UNBLOCK 0x80000 961556Srgrimes#define C_OSYNC 0x100000 97