Annotation of 43BSDTahoe/etc/restore/restore.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)restore.h   5.2 (Berkeley) 5/13/88
        !             7:  */
        !             8: 
        !             9: #include <stdio.h>
        !            10: #include <sys/param.h>
        !            11: #include <sys/inode.h>
        !            12: #include <sys/fs.h>
        !            13: #include <sys/dir.h>
        !            14: 
        !            15: /*
        !            16:  * Flags
        !            17:  */
        !            18: extern int     cvtflag;        /* convert from old to new tape format */
        !            19: extern int     bflag;          /* set input block size */
        !            20: extern int     dflag;          /* print out debugging info */
        !            21: extern int     hflag;          /* restore heirarchies */
        !            22: extern int     mflag;          /* restore by name instead of inode number */
        !            23: extern int     Nflag;          /* do not write the disk */
        !            24: extern int     vflag;          /* print out actions taken */
        !            25: extern int     yflag;          /* always try to recover from tape errors */
        !            26: /*
        !            27:  * Global variables
        !            28:  */
        !            29: extern char    *dumpmap;       /* map of inodes on this dump tape */
        !            30: extern char    *clrimap;       /* map of inodes to be deleted */
        !            31: extern ino_t   maxino;         /* highest numbered inode in this file system */
        !            32: extern long    dumpnum;        /* location of the dump on this tape */
        !            33: extern long    volno;          /* current volume being read */
        !            34: extern long    ntrec;          /* number of TP_BSIZE records per tape block */
        !            35: extern time_t  dumptime;       /* time that this dump begins */
        !            36: extern time_t  dumpdate;       /* time that this dump was made */
        !            37: extern char    command;        /* opration being performed */
        !            38: extern FILE    *terminal;      /* file descriptor for the terminal input */
        !            39: 
        !            40: /*
        !            41:  * Each file in the file system is described by one of these entries
        !            42:  */
        !            43: struct entry {
        !            44:        char    *e_name;                /* the current name of this entry */
        !            45:        u_char  e_namlen;               /* length of this name */
        !            46:        char    e_type;                 /* type of this entry, see below */
        !            47:        short   e_flags;                /* status flags, see below */
        !            48:        ino_t   e_ino;                  /* inode number in previous file sys */
        !            49:        long    e_index;                /* unique index (for dumpped table) */
        !            50:        struct  entry *e_parent;        /* pointer to parent directory (..) */
        !            51:        struct  entry *e_sibling;       /* next element in this directory (.) */
        !            52:        struct  entry *e_links;         /* hard links to this inode */
        !            53:        struct  entry *e_entries;       /* for directories, their entries */
        !            54:        struct  entry *e_next;          /* hash chain list */
        !            55: };
        !            56: /* types */
        !            57: #define        LEAF 1                  /* non-directory entry */
        !            58: #define NODE 2                 /* directory entry */
        !            59: #define LINK 4                 /* synthesized type, stripped by addentry */
        !            60: /* flags */
        !            61: #define EXTRACT                0x0001  /* entry is to be replaced from the tape */
        !            62: #define NEW            0x0002  /* a new entry to be extracted */
        !            63: #define KEEP           0x0004  /* entry is not to change */
        !            64: #define REMOVED                0x0010  /* entry has been removed */
        !            65: #define TMPNAME                0x0020  /* entry has been given a temporary name */
        !            66: #define EXISTED                0x0040  /* directory already existed during extract */
        !            67: /*
        !            68:  * functions defined on entry structs
        !            69:  */
        !            70: extern struct entry *lookupino();
        !            71: extern struct entry *lookupname();
        !            72: extern struct entry *lookupparent();
        !            73: extern struct entry *addentry();
        !            74: extern char *myname();
        !            75: extern char *savename();
        !            76: extern char *gentempname();
        !            77: extern char *flagvalues();
        !            78: extern ino_t lowerbnd();
        !            79: extern ino_t upperbnd();
        !            80: extern DIR *rst_opendir();
        !            81: extern struct direct *rst_readdir();
        !            82: #define NIL ((struct entry *)(0))
        !            83: /*
        !            84:  * Constants associated with entry structs
        !            85:  */
        !            86: #define HARDLINK       1
        !            87: #define SYMLINK                2
        !            88: #define TMPHDR         "RSTTMP"
        !            89: 
        !            90: /*
        !            91:  * The entry describes the next file available on the tape
        !            92:  */
        !            93: struct context {
        !            94:        char    *name;          /* name of file */
        !            95:        ino_t   ino;            /* inumber of file */
        !            96:        struct  dinode *dip;    /* pointer to inode */
        !            97:        char    action;         /* action being taken on this file */
        !            98: } curfile;
        !            99: /* actions */
        !           100: #define        USING   1       /* extracting from the tape */
        !           101: #define        SKIP    2       /* skipping */
        !           102: #define UNKNOWN 3      /* disposition or starting point is unknown */
        !           103: 
        !           104: /*
        !           105:  * Other exported routines
        !           106:  */
        !           107: extern ino_t psearch();
        !           108: extern ino_t dirlookup();
        !           109: extern long listfile();
        !           110: extern long deletefile();
        !           111: extern long addfile();
        !           112: extern long nodeupdates();
        !           113: extern long verifyfile();
        !           114: extern char *rindex();
        !           115: extern char *index();
        !           116: extern char *strcat();
        !           117: extern char *strncat();
        !           118: extern char *strcpy();
        !           119: extern char *strncpy();
        !           120: extern char *fgets();
        !           121: extern char *mktemp();
        !           122: extern char *malloc();
        !           123: extern char *calloc();
        !           124: extern char *realloc();
        !           125: extern long lseek();
        !           126: 
        !           127: /*
        !           128:  * Useful macros
        !           129:  */
        !           130: #define        MWORD(m,i) (m[(unsigned)(i-1)/NBBY])
        !           131: #define        MBIT(i) (1<<((unsigned)(i-1)%NBBY))
        !           132: #define        BIS(i,w)        (MWORD(w,i) |=  MBIT(i))
        !           133: #define        BIC(i,w)        (MWORD(w,i) &= ~MBIT(i))
        !           134: #define        BIT(i,w)        (MWORD(w,i) & MBIT(i))
        !           135: 
        !           136: #define dprintf                if (dflag) fprintf
        !           137: #define vprintf                if (vflag) fprintf
        !           138: 
        !           139: #define GOOD 1
        !           140: #define FAIL 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.