Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*-
0002  * Copyright (c) 1991, 1993, 1994
0003  *  The Regents of the University of California.  All rights reserved.
0004  *
0005  * This code is derived from software contributed to Berkeley by
0006  * Keith Muller of the University of California, San Diego and Lance
0007  * Visser of Convex Computer Corporation.
0008  *
0009  * Redistribution and use in source and binary forms, with or without
0010  * modification, are permitted provided that the following conditions
0011  * are met:
0012  * 1. Redistributions of source code must retain the above copyright
0013  *    notice, this list of conditions and the following disclaimer.
0014  * 2. Redistributions in binary form must reproduce the above copyright
0015  *    notice, this list of conditions and the following disclaimer in the
0016  *    documentation and/or other materials provided with the distribution.
0017  * 4. Neither the name of the University nor the names of its contributors
0018  *    may be used to endorse or promote products derived from this software
0019  *    without specific prior written permission.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
0022  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
0025  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0026  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0027  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0029  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0030  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0031  * SUCH DAMAGE.
0032  *
0033  *  @(#)dd.h    8.3 (Berkeley) 4/2/94
0034  * $FreeBSD: src/bin/dd/dd.h,v 1.22 2004/08/15 19:10:05 rwatson Exp $
0035  */
0036 
0037 #ifndef _DD_H_
0038 #define _DD_H_
0039 
0040 #include <stddef.h>
0041 
0042 #define OFF_MAX LONG_MAX
0043 
0044 /* Input/output stream state. */
0045 typedef struct {
0046     u_char      *db;        /* buffer address */
0047     u_char      *dbp;       /* current buffer I/O address */
0048     /* XXX ssize_t? */
0049     size_t      dbcnt;      /* current buffer byte count */
0050     size_t      dbrcnt;     /* last read byte count */
0051     size_t      dbsz;       /* buffer size */
0052 
0053 #define ISCHR       0x01        /* character device (warn on short) */
0054 #define ISPIPE      0x02        /* pipe-like (see position.c) */
0055 #define ISTAPE      0x04        /* tape */
0056 #define ISSEEK      0x08        /* valid to seek on */
0057 #define NOREAD      0x10        /* not readable */
0058 #define ISTRUNC     0x20        /* valid to ftruncate() */
0059     u_int       flags;
0060 
0061     const char  *name;      /* name */
0062     int     fd;     /* file descriptor */
0063     off_t       offset;     /* # of blocks to skip */
0064 } rtems_shell_dd_IO;
0065 
0066 typedef struct {
0067     uintmax_t   in_full;    /* # of full input blocks */
0068     uintmax_t   in_part;    /* # of partial input blocks */
0069     uintmax_t   out_full;   /* # of full output blocks */
0070     uintmax_t   out_part;   /* # of partial output blocks */
0071     uintmax_t   trunc;      /* # of truncated records */
0072     uintmax_t   swab;       /* # of odd-length swab blocks */
0073     uintmax_t   bytes;      /* # of bytes written */
0074     double      start;      /* start time of dd */
0075 } rtems_shell_dd_STAT;
0076 
0077 /* Flags (in ddflags). */
0078 #define C_ASCII     0x00001
0079 #define C_BLOCK     0x00002
0080 #define C_BS        0x00004
0081 #define C_CBS       0x00008
0082 #define C_COUNT     0x00010
0083 #define C_EBCDIC    0x00020
0084 #define C_FILES     0x00040
0085 #define C_IBS       0x00080
0086 #define C_IF        0x00100
0087 #define C_LCASE     0x00200
0088 #define C_NOERROR   0x00400
0089 #define C_NOTRUNC   0x00800
0090 #define C_OBS       0x01000
0091 #define C_OF        0x02000
0092 #define C_OSYNC     0x04000
0093 #define C_PAREVEN   0x08000
0094 #define C_PARNONE   0x100000
0095 #define C_PARODD    0x200000
0096 #define C_PARSET    0x400000
0097 #define C_SEEK      0x800000
0098 #define C_SKIP      0x1000000
0099 #define C_SPARSE    0x2000000
0100 #define C_SWAB      0x4000000
0101 #define C_SYNC      0x8000000
0102 #define C_UCASE     0x10000000
0103 #define C_UNBLOCK   0x20000000
0104 #define C_FILL      0x40000000
0105 
0106 #define C_PARITY    (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
0107 
0108 #endif