14b88c807SRodney W. Grimes /*- 24b88c807SRodney W. Grimes * Copyright (c) 1991, 1993, 1994 34b88c807SRodney W. Grimes * The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes * 54b88c807SRodney W. Grimes * This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes * Keith Muller of the University of California, San Diego and Lance 74b88c807SRodney W. Grimes * Visser of Convex Computer Corporation. 84b88c807SRodney W. Grimes * 94b88c807SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 104b88c807SRodney W. Grimes * modification, are permitted provided that the following conditions 114b88c807SRodney W. Grimes * are met: 124b88c807SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 134b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 144b88c807SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 154b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 164b88c807SRodney W. Grimes * documentation and/or other materials provided with the distribution. 174b88c807SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 184b88c807SRodney W. Grimes * must display the following acknowledgement: 194b88c807SRodney W. Grimes * This product includes software developed by the University of 204b88c807SRodney W. Grimes * California, Berkeley and its contributors. 214b88c807SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 224b88c807SRodney W. Grimes * may be used to endorse or promote products derived from this software 234b88c807SRodney W. Grimes * without specific prior written permission. 244b88c807SRodney W. Grimes * 254b88c807SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 264b88c807SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 274b88c807SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 284b88c807SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 294b88c807SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 304b88c807SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 314b88c807SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 324b88c807SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 334b88c807SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 344b88c807SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 354b88c807SRodney W. Grimes * SUCH DAMAGE. 364b88c807SRodney W. Grimes * 374b88c807SRodney W. Grimes * @(#)dd.h 8.3 (Berkeley) 4/2/94 382a456239SPeter Wemm * $FreeBSD$ 394b88c807SRodney W. Grimes */ 404b88c807SRodney W. Grimes 414b88c807SRodney W. Grimes /* Input/output stream state. */ 424b88c807SRodney W. Grimes typedef struct { 434b88c807SRodney W. Grimes u_char *db; /* buffer address */ 444b88c807SRodney W. Grimes u_char *dbp; /* current buffer I/O address */ 457599187eSBrian Feldman /* XXX ssize_t? */ 4658687472SBrian Feldman size_t dbcnt; /* current buffer byte count */ 4758687472SBrian Feldman size_t dbrcnt; /* last read byte count */ 4858687472SBrian Feldman size_t dbsz; /* buffer size */ 494b88c807SRodney W. Grimes 504b88c807SRodney W. Grimes #define ISCHR 0x01 /* character device (warn on short) */ 51c15c898eSBrian Feldman #define ISPIPE 0x02 /* pipe-like (see position.c) */ 527599187eSBrian Feldman #define ISTAPE 0x04 /* tape */ 5332952d4bSBrian Feldman #define ISSEEK 0x08 /* valid to seek on */ 54769e5815SBrian Feldman #define NOREAD 0x10 /* not readable */ 55c15c898eSBrian Feldman #define ISTRUNC 0x20 /* valid to ftruncate() */ 564b88c807SRodney W. Grimes u_int flags; 574b88c807SRodney W. Grimes 58c15c898eSBrian Feldman const char *name; /* name */ 594b88c807SRodney W. Grimes int fd; /* file descriptor */ 60767bc8adSBrian Feldman off_t offset; /* # of blocks to skip */ 614b88c807SRodney W. Grimes 624b88c807SRodney W. Grimes } IO; 634b88c807SRodney W. Grimes 644b88c807SRodney W. Grimes typedef struct { 657503d74fSMark Murray uintmax_t in_full; /* # of full input blocks */ 667503d74fSMark Murray uintmax_t in_part; /* # of partial input blocks */ 677503d74fSMark Murray uintmax_t out_full; /* # of full output blocks */ 687503d74fSMark Murray uintmax_t out_part; /* # of partial output blocks */ 697503d74fSMark Murray uintmax_t trunc; /* # of truncated records */ 707503d74fSMark Murray uintmax_t swab; /* # of odd-length swab blocks */ 717503d74fSMark Murray uintmax_t bytes; /* # of bytes written */ 72ad66f7eeSPoul-Henning Kamp double start; /* start time of dd */ 734b88c807SRodney W. Grimes } STAT; 744b88c807SRodney W. Grimes 754b88c807SRodney W. Grimes /* Flags (in ddflags). */ 764b88c807SRodney W. Grimes #define C_ASCII 0x00001 774b88c807SRodney W. Grimes #define C_BLOCK 0x00002 784b88c807SRodney W. Grimes #define C_BS 0x00004 794b88c807SRodney W. Grimes #define C_CBS 0x00008 804b88c807SRodney W. Grimes #define C_COUNT 0x00010 814b88c807SRodney W. Grimes #define C_EBCDIC 0x00020 824b88c807SRodney W. Grimes #define C_FILES 0x00040 834b88c807SRodney W. Grimes #define C_IBS 0x00080 844b88c807SRodney W. Grimes #define C_IF 0x00100 854b88c807SRodney W. Grimes #define C_LCASE 0x00200 864b88c807SRodney W. Grimes #define C_NOERROR 0x00400 874b88c807SRodney W. Grimes #define C_NOTRUNC 0x00800 884b88c807SRodney W. Grimes #define C_OBS 0x01000 894b88c807SRodney W. Grimes #define C_OF 0x02000 904b88c807SRodney W. Grimes #define C_SEEK 0x04000 914b88c807SRodney W. Grimes #define C_SKIP 0x08000 924b88c807SRodney W. Grimes #define C_SWAB 0x10000 934b88c807SRodney W. Grimes #define C_SYNC 0x20000 944b88c807SRodney W. Grimes #define C_UCASE 0x40000 954b88c807SRodney W. Grimes #define C_UNBLOCK 0x80000 964b88c807SRodney W. Grimes #define C_OSYNC 0x100000 974ddfeabdSJoerg Wunsch #define C_SPARSE 0x200000 986a3d33acSPoul-Henning Kamp #define C_PAREVEN 0x400000 996a3d33acSPoul-Henning Kamp #define C_PARODD 0x800000 1006a3d33acSPoul-Henning Kamp #define C_PARSET 0x1000000 1016a3d33acSPoul-Henning Kamp #define C_PARNONE 0x2000000 1026a3d33acSPoul-Henning Kamp 1036a3d33acSPoul-Henning Kamp #define C_PARITY (C_PAREVEN|C_PARODD|C_PARSET|C_PARNONE) 104