xref: /original-bsd/bin/dd/dd.h (revision 7e5c8007)
1 /*-
2  * Copyright (c) 1991, 1993, 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Keith Muller of the University of California, San Diego and Lance
7  * Visser of Convex Computer Corporation.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)dd.h	8.3 (Berkeley) 04/02/94
12  */
13 
14 /* Input/output stream state. */
15 typedef struct {
16 	u_char	*db;			/* buffer address */
17 	u_char	*dbp;			/* current buffer I/O address */
18 	u_long	dbcnt;			/* current buffer byte count */
19 	int	dbrcnt;			/* last read byte count */
20 	u_long	dbsz;			/* buffer size */
21 
22 #define	ISCHR		0x01		/* character device (warn on short) */
23 #define	ISPIPE		0x02		/* pipe (not truncatable) */
24 #define	ISTAPE		0x04		/* tape (not seekable) */
25 #define	NOREAD		0x08		/* not readable */
26 	u_int	flags;
27 
28 	char 	*name;			/* name */
29 	int	fd;			/* file descriptor */
30 	u_long	offset;			/* # of blocks to skip */
31 
32 	u_long	f_stats;		/* # of full blocks processed */
33 	u_long	p_stats;		/* # of partial blocks processed */
34 	u_long	s_stats;		/* # of odd swab blocks */
35 	u_long	t_stats;		/* # of truncations */
36 } IO;
37 
38 typedef struct {
39 	u_long	in_full;		/* # of full input blocks */
40 	u_long	in_part;		/* # of partial input blocks */
41 	u_long	out_full;		/* # of full output blocks */
42 	u_long	out_part;		/* # of partial output blocks */
43 	u_long	trunc;			/* # of truncated records */
44 	u_long	swab;			/* # of odd-length swab blocks */
45 	u_long	bytes;			/* # of bytes written */
46 	time_t	start;			/* start time of dd */
47 } STAT;
48 
49 /* Flags (in ddflags). */
50 #define	C_ASCII		0x00001
51 #define	C_BLOCK		0x00002
52 #define	C_BS		0x00004
53 #define	C_CBS		0x00008
54 #define	C_COUNT		0x00010
55 #define	C_EBCDIC	0x00020
56 #define	C_FILES		0x00040
57 #define	C_IBS		0x00080
58 #define	C_IF		0x00100
59 #define	C_LCASE		0x00200
60 #define	C_NOERROR	0x00400
61 #define	C_NOTRUNC	0x00800
62 #define	C_OBS		0x01000
63 #define	C_OF		0x02000
64 #define	C_SEEK		0x04000
65 #define	C_SKIP		0x08000
66 #define	C_SWAB		0x10000
67 #define	C_SYNC		0x20000
68 #define	C_UCASE		0x40000
69 #define	C_UNBLOCK	0x80000
70 #define	C_OSYNC		0x100000
71