xref: /csrg-svn/bin/dd/dd.h (revision 66634)
150565Sbostic /*-
2*66634Spendry  * Copyright (c) 1991, 1993, 1994
360660Sbostic  *	The Regents of the University of California.  All rights reserved.
450565Sbostic  *
550565Sbostic  * This code is derived from software contributed to Berkeley by
650588Sbostic  * Keith Muller of the University of California, San Diego and Lance
750588Sbostic  * Visser of Convex Computer Corporation.
850565Sbostic  *
950565Sbostic  * %sccs.include.redist.c%
1050565Sbostic  *
11*66634Spendry  *	@(#)dd.h	8.3 (Berkeley) 04/02/94
1250565Sbostic  */
1350565Sbostic 
1450565Sbostic /* Input/output stream state. */
1550644Sbostic typedef struct {
1650565Sbostic 	u_char	*db;			/* buffer address */
1750565Sbostic 	u_char	*dbp;			/* current buffer I/O address */
1850565Sbostic 	u_long	dbcnt;			/* current buffer byte count */
1950565Sbostic 	int	dbrcnt;			/* last read byte count */
2050565Sbostic 	u_long	dbsz;			/* buffer size */
2150565Sbostic 
2250565Sbostic #define	ISCHR		0x01		/* character device (warn on short) */
2350565Sbostic #define	ISPIPE		0x02		/* pipe (not truncatable) */
2450565Sbostic #define	ISTAPE		0x04		/* tape (not seekable) */
2550565Sbostic #define	NOREAD		0x08		/* not readable */
2650565Sbostic 	u_int	flags;
2750565Sbostic 
2850565Sbostic 	char 	*name;			/* name */
2950565Sbostic 	int	fd;			/* file descriptor */
3050565Sbostic 	u_long	offset;			/* # of blocks to skip */
3150565Sbostic 
3250565Sbostic 	u_long	f_stats;		/* # of full blocks processed */
3350565Sbostic 	u_long	p_stats;		/* # of partial blocks processed */
3450644Sbostic 	u_long	s_stats;		/* # of odd swab blocks */
3550565Sbostic 	u_long	t_stats;		/* # of truncations */
3650644Sbostic } IO;
3750565Sbostic 
3850644Sbostic typedef struct {
3950644Sbostic 	u_long	in_full;		/* # of full input blocks */
4050644Sbostic 	u_long	in_part;		/* # of partial input blocks */
4150644Sbostic 	u_long	out_full;		/* # of full output blocks */
4250644Sbostic 	u_long	out_part;		/* # of partial output blocks */
4350644Sbostic 	u_long	trunc;			/* # of truncated records */
4450644Sbostic 	u_long	swab;			/* # of odd-length swab blocks */
4553813Smarc 	u_long	bytes;			/* # of bytes written */
4653813Smarc 	time_t	start;			/* start time of dd */
4750644Sbostic } STAT;
4850644Sbostic 
4950565Sbostic /* Flags (in ddflags). */
5050644Sbostic #define	C_ASCII		0x00001
5150644Sbostic #define	C_BLOCK		0x00002
5250644Sbostic #define	C_BS		0x00004
5350644Sbostic #define	C_CBS		0x00008
5450644Sbostic #define	C_COUNT		0x00010
5550644Sbostic #define	C_EBCDIC	0x00020
5650644Sbostic #define	C_FILES		0x00040
5750644Sbostic #define	C_IBS		0x00080
5850644Sbostic #define	C_IF		0x00100
5950644Sbostic #define	C_LCASE		0x00200
6050644Sbostic #define	C_NOERROR	0x00400
6150644Sbostic #define	C_NOTRUNC	0x00800
6250644Sbostic #define	C_OBS		0x01000
6350644Sbostic #define	C_OF		0x02000
6450644Sbostic #define	C_SEEK		0x04000
6550644Sbostic #define	C_SKIP		0x08000
6650644Sbostic #define	C_SWAB		0x10000
6750644Sbostic #define	C_SYNC		0x20000
6850644Sbostic #define	C_UCASE		0x40000
6950644Sbostic #define	C_UNBLOCK	0x80000
7065724Sbostic #define	C_OSYNC		0x100000
71