Annotation of 42BSD/etc/restore/restore.h, revision 1.1

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