14b88c807SRodney W. Grimes /*- 2*8a16b7a1SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*8a16b7a1SPedro F. Giffuni * 44b88c807SRodney W. Grimes * Copyright (c) 1991, 1993, 1994 54b88c807SRodney W. Grimes * The Regents of the University of California. All rights reserved. 64b88c807SRodney W. Grimes * 74b88c807SRodney W. Grimes * This code is derived from software contributed to Berkeley by 84b88c807SRodney W. Grimes * Keith Muller of the University of California, San Diego and Lance 94b88c807SRodney W. Grimes * Visser of Convex Computer Corporation. 104b88c807SRodney W. Grimes * 114b88c807SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 124b88c807SRodney W. Grimes * modification, are permitted provided that the following conditions 134b88c807SRodney W. Grimes * are met: 144b88c807SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 154b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 164b88c807SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 174b88c807SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 184b88c807SRodney W. Grimes * documentation and/or other materials provided with the distribution. 19fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 204b88c807SRodney W. Grimes * may be used to endorse or promote products derived from this software 214b88c807SRodney W. Grimes * without specific prior written permission. 224b88c807SRodney W. Grimes * 234b88c807SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 244b88c807SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 254b88c807SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 264b88c807SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 274b88c807SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 284b88c807SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 294b88c807SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 304b88c807SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 314b88c807SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 324b88c807SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 334b88c807SRodney W. Grimes * SUCH DAMAGE. 344b88c807SRodney W. Grimes * 354b88c807SRodney W. Grimes * @(#)dd.h 8.3 (Berkeley) 4/2/94 362a456239SPeter Wemm * $FreeBSD$ 374b88c807SRodney W. Grimes */ 384b88c807SRodney W. Grimes 394b88c807SRodney W. Grimes /* Input/output stream state. */ 404b88c807SRodney W. Grimes typedef struct { 414b88c807SRodney W. Grimes u_char *db; /* buffer address */ 424b88c807SRodney W. Grimes u_char *dbp; /* current buffer I/O address */ 4377a798b3SAlan Somers ssize_t dbcnt; /* current buffer byte count */ 4477a798b3SAlan Somers ssize_t dbrcnt; /* last read byte count */ 4577a798b3SAlan Somers ssize_t dbsz; /* block size */ 464b88c807SRodney W. Grimes 474b88c807SRodney W. Grimes #define ISCHR 0x01 /* character device (warn on short) */ 48c15c898eSBrian Feldman #define ISPIPE 0x02 /* pipe-like (see position.c) */ 497599187eSBrian Feldman #define ISTAPE 0x04 /* tape */ 5032952d4bSBrian Feldman #define ISSEEK 0x08 /* valid to seek on */ 51769e5815SBrian Feldman #define NOREAD 0x10 /* not readable */ 52c15c898eSBrian Feldman #define ISTRUNC 0x20 /* valid to ftruncate() */ 534b88c807SRodney W. Grimes u_int flags; 544b88c807SRodney W. Grimes 55c15c898eSBrian Feldman const char *name; /* name */ 564b88c807SRodney W. Grimes int fd; /* file descriptor */ 57767bc8adSBrian Feldman off_t offset; /* # of blocks to skip */ 58cd1832feSThomas Quinot off_t seek_offset; /* offset of last seek past output hole */ 594b88c807SRodney W. Grimes } IO; 604b88c807SRodney W. Grimes 614b88c807SRodney W. Grimes typedef struct { 62f4cfd28bSKurt Jaeger uintmax_t in_full; /* # of full input blocks */ 63f4cfd28bSKurt Jaeger uintmax_t in_part; /* # of partial input blocks */ 64f4cfd28bSKurt Jaeger uintmax_t out_full; /* # of full output blocks */ 65f4cfd28bSKurt Jaeger uintmax_t out_part; /* # of partial output blocks */ 66f4cfd28bSKurt Jaeger uintmax_t trunc; /* # of truncated records */ 67f4cfd28bSKurt Jaeger uintmax_t swab; /* # of odd-length swab blocks */ 68f4cfd28bSKurt Jaeger uintmax_t bytes; /* # of bytes written */ 69540c7825SAlan Somers struct timespec start; /* start time of dd */ 704b88c807SRodney W. Grimes } STAT; 714b88c807SRodney W. Grimes 724b88c807SRodney W. Grimes /* Flags (in ddflags). */ 73413ef2a3SXin LI #define C_ASCII 0x00000001 74413ef2a3SXin LI #define C_BLOCK 0x00000002 75413ef2a3SXin LI #define C_BS 0x00000004 76413ef2a3SXin LI #define C_CBS 0x00000008 77413ef2a3SXin LI #define C_COUNT 0x00000010 78413ef2a3SXin LI #define C_EBCDIC 0x00000020 79413ef2a3SXin LI #define C_FILES 0x00000040 80413ef2a3SXin LI #define C_IBS 0x00000080 81413ef2a3SXin LI #define C_IF 0x00000100 82413ef2a3SXin LI #define C_LCASE 0x00000200 83413ef2a3SXin LI #define C_NOERROR 0x00000400 84413ef2a3SXin LI #define C_NOTRUNC 0x00000800 85413ef2a3SXin LI #define C_OBS 0x00001000 86413ef2a3SXin LI #define C_OF 0x00002000 87413ef2a3SXin LI #define C_OSYNC 0x00004000 88413ef2a3SXin LI #define C_PAREVEN 0x00008000 89413ef2a3SXin LI #define C_PARNONE 0x00010000 90413ef2a3SXin LI #define C_PARODD 0x00020000 91413ef2a3SXin LI #define C_PARSET 0x00040000 92413ef2a3SXin LI #define C_SEEK 0x00080000 93413ef2a3SXin LI #define C_SKIP 0x00100000 94413ef2a3SXin LI #define C_SPARSE 0x00200000 95413ef2a3SXin LI #define C_SWAB 0x00400000 96413ef2a3SXin LI #define C_SYNC 0x00800000 97413ef2a3SXin LI #define C_UCASE 0x01000000 98413ef2a3SXin LI #define C_UNBLOCK 0x02000000 99413ef2a3SXin LI #define C_FILL 0x04000000 100413ef2a3SXin LI #define C_STATUS 0x08000000 101413ef2a3SXin LI #define C_NOXFER 0x10000000 102413ef2a3SXin LI #define C_NOINFO 0x20000000 1036a3d33acSPoul-Henning Kamp 104d493ed0fSBruce Evans #define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET) 105