2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
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.
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.
23 * Authors: the Amanda Development Team. Its members are listed in a
24 * file named AUTHORS, in the root directory of this distribution.
27 * $Id: holding.h,v 1.23 2006/05/25 01:47:20 johnfranks Exp $
31 * Holding disk: a top-level directory given in amanda.conf
32 * Holding directory: a subdirectory of a holding disk, named by datestamp
33 * Holding file: one or more os-level files in a holding directory, together
34 * representing a single dump
35 * Holding file chunks: the individual os-level files (continuations) of
40 * /data/holding <-- holding disk
41 * /data/holding/200703061234 <-- holding dir
42 * /data/holding/200703061234/videoserver._video_a <-- holding file,
44 * /data/holding/200703061234/videoserver._video_a.1 <-- holding file chunk
53 #include "fileheader.h"
60 /* Set verbose flag for holding-disk functions
62 * @param verbose: if true, log verbosely to stdout
63 * @returns: old verbosity
66 holding_set_verbosity(int verbose);
71 * Use getconf_holdingdisks() to access the list of holding disks.
78 /* Get a list of holding directories, optionally limited to a single
79 * holding disk. Can return a list either of full pathnames or of
80 * bare directory names (datestamps).
82 * @param hdisk: holding disk to enumerate, or NULL for all
83 * @param date_list: Limit to thes timestamps.
84 * @param fullpaths: if true, return full pathnames
85 * @returns: newly allocated sl_t of matching directories
88 holding_get_directories(char *hdisk,
96 /* Get a list of holding files, optionally limited to a single holding
97 * directory. Can return a list either of full pathnames or of
100 * @param hdir: holding directory to enumerate, or NULL for all
101 * @param date_list: Limit to thes timestamps.
102 * @param fullpaths: if true, return full pathnames
103 * @returns: newly allocated sl_t of matching files
106 holding_get_files(char *hdir,
110 /* Get a list of holding files that should be flushed, optionally
111 * matching only certain datestamps. This function filters out
112 * files for host/disks that are no longer in the disklist.
114 * @param dateargs: sl_t of datestamps to dump, or NULL for all
115 * @param interactive: if true, be interactive
116 * @returns: a newly allocated sl_t listing all matching holding
120 holding_get_files_for_flush(sl_t *dateargs,
123 /* Get the total size of a holding file, including all holding
124 * file chunks, in kilobytes.
126 * @param holding_file: full pathname of holding file
127 * @param strip_headers: if true, don't count the headers in the
129 * @returns: total size of the holding file, or -1 in an error
132 holding_file_size(char *holding_file,
135 /* Unlink a holding file, including all holding file chunks.
137 * @param holding_file: full pathname of holding file
138 * @returns: 1 on success, else 0
141 holding_file_unlink(char *holding_file);
143 /* Given a pathname of a holding file, extract the hostname, diskname,
144 * level, and filetype from the header.
146 * Caller is responsible for freeing memory for hostname and diskname.
147 * None of the result parameters can be NULL.
149 * @param fname: full pathname of holding file
150 * @param hostname: (result) hostname
151 * @param diskname: (result) diskname
152 * @param level: (result) level
153 * @param datestamp: (result) datestamp of the dump
154 * @returns: filetype (see common-src/fileheader.h)
157 holding_file_read_header(char *fname,
163 /* Given a pathname of a holding file, read the file header.
164 * the result parameter may be altered even if an error is
167 * @param fname: full pathname of holding file
168 * @param file: (result) dumpfile_t structure
169 * @returns: 1 on success, else 0
172 holding_file_get_dumpfile(char *fname,
176 * Holding file chunks
179 /* Get a list of holding files chunks in the given holding
180 * file. Always returns full paths.
182 * @param hfile: holding file to enumerate
183 * @returns: newly allocated sl_t of matching holding file chunks
186 holding_get_file_chunks(char *hfile);
189 * application-specific support
192 /* Allow the user to select a set of datestamps from those in
195 * @param verbose: verbose logging to stdout
196 * @returns: a new sl_t listing all matching datestamps
199 pick_datestamp(int verbose);
201 /* Similar to pick_datestamp, but always select all available
202 * datestamps. Non-interactive, but outputs progress to stdout.
204 * @param verbose: verbose logging to stdout
205 * @returns: a new sl_t listing all matching datestamps
208 pick_all_datestamp(int verbose);
210 /* Rename holding files from the temporary names used during
213 * @param holding_file: full pathname of holding file,
215 * @param complete: if 0, set 'is_partial' to 1 in each file
216 * @returns: 1 on success, else 0
219 rename_tmp_holding(char *holding_file,
222 /* Remove any empty datestamp directories.
224 * @param diskdir: holding directory to clean
225 * @param verbose: verbose logging to stdout
228 cleanup_holdingdisk(char *diskdir,
231 /* Set up a holding directory and do basic permission
234 * @param diskdir: holding directory to set up
235 * @returns: 1 on success, else 0
238 mkholdingdir(char *diskdir);
240 #endif /* HOLDING_H */