Imported Upstream version 2.6.1p2
[debian/amanda] / restore-src / restore.h
1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 1991-1998 University of Maryland at College Park
4  * All Rights Reserved.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of U.M. not be used in advertising or
11  * publicity pertaining to distribution of the software without specific,
12  * written prior permission.  U.M. makes no representations about the
13  * suitability of this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  *
16  * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  * Authors: the Amanda Development Team.  Its members are listed in a
24  * file named AUTHORS, in the root directory of this distribution.
25  */
26 /*
27  * $Id: restore.h,v 1.8 2006/06/22 17:16:39 martinea Exp $
28  *
29  * 
30  */
31
32 #ifndef RESTORE_H
33 #define RESTORE_H
34
35 #include "fileheader.h"
36 #include "tapelist.h"
37 #include "amfeatures.h"
38 #include "device.h"
39
40 #define CREAT_MODE  0640
41
42 typedef struct rst_flags_s {
43     unsigned int inline_assemble:1;
44     unsigned int delay_assemble:1;
45     unsigned int compress:1;
46     unsigned int leave_comp:1;
47     unsigned int raw:1;
48     unsigned int headers:1;
49     unsigned int isafile:1;
50     unsigned int wait_tape_prompt:1; /* for interactive console use */
51     unsigned int amidxtaped:1; /* for client-daemon use */
52     unsigned int check_labels:1;
53     unsigned int mask_splits:1;
54     off_t fsf;
55     ssize_t blocksize;
56     int pipe_to_fd;
57     char *restore_dir;
58     char *comp_type;
59     char *alt_tapedev;
60     char *inventory_log;
61 } rst_flags_t;
62
63 typedef struct {
64     enum { HOLDING_MODE, DEVICE_MODE} restore_mode;
65     dumpfile_t * header;
66     union {
67         int holding_fd;
68         Device * device;
69     } u;
70 } RestoreSource;
71
72 typedef struct seentapes_s seentapes_t;
73
74 char *make_filename(dumpfile_t *file);
75 ssize_t read_file_header(dumpfile_t *file, int tapefd, int isafile,
76                          rst_flags_t *flags);
77 void restore(RestoreSource * source, rst_flags_t * flags);
78 gboolean restore_holding_disk(FILE * prompt_out,
79                               rst_flags_t * flags,
80                               am_feature_t * features,
81                               tapelist_t * file,
82                               seentapes_t ** seen,
83                               GSList * dumpspecs,
84                               dumpfile_t * this_header,
85                               dumpfile_t * last_header);
86
87 gboolean search_a_tape(Device * device, FILE *prompt_out, rst_flags_t  *flags,
88                        am_feature_t *their_features, 
89                        tapelist_t   *desired_tape, GSList *dumpspecs,
90                        seentapes_t **tape_seen,
91                        dumpfile_t * first_restored_file, int tape_count,
92                        FILE * logstream);
93
94 void flush_open_outputs(int reassemble, dumpfile_t *only_file);
95 void search_tapes(FILE *prompt_out, FILE *prompt_in, int use_changer,
96                   tapelist_t *tapelist, GSList *dumpspecs,
97                   rst_flags_t *flags, am_feature_t *their_features);
98 int have_all_parts(dumpfile_t *file, int upto);
99 rst_flags_t *new_rst_flags(void);
100 int check_rst_flags(rst_flags_t *flags);
101 void free_rst_flags(rst_flags_t *flags);
102 int lock_logfile(void);
103 void send_message(FILE *prompt_out, rst_flags_t *flags,
104                   am_feature_t *their_features,
105                   char * format, ...) G_GNUC_PRINTF(4,5);
106 gboolean set_restore_device_read_buffer_size(Device *device, rst_flags_t *flags);
107
108 #endif /* RESTORE_H */
109