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, usually named by
33 * datestamp. These are not accessible through this API.
34 * Holding file: one or more os-level files in a holding directory, together
35 * representing a single dump
36 * Holding file chunks: the individual os-level files (continuations) of
41 * /data/holding <-- holding disk
42 * /data/holding/200703061234 <-- holding dir
43 * /data/holding/200703061234/videoserver._video_a <-- holding file,
45 * /data/holding/200703061234/videoserver._video_a.1 <-- holding file chunk
54 #include "fileheader.h"
56 /* Get a list of holding disks. This is equivalent to
57 * getconf_holdingdisks() with holdingdisk_get_diskdir().
59 * @returns: newly allocated GSList of matching disks
62 holding_get_disks(void);
64 /* Get a list of holding files, optionally limited to a single holding
65 * directory. Can return a list either of full pathnames or of
68 * @param hdir: holding directory to enumerate, or NULL for all
69 * @param fullpaths: if true, return full pathnames
70 * @returns: newly allocated GSList of matching files
73 holding_get_files(char *hdir,
76 /* Get a list of holding files chunks in the given holding
77 * file. Always returns full paths.
79 * @param hfile: holding file to enumerate
80 * @returns: newly allocated GSList of matching holding file chunks
83 holding_get_file_chunks(char *hfile);
85 /* Get a list of holding files that should be flushed, optionally
86 * matching only certain datestamps. This function filters out
87 * files for host/disks that are no longer in the disklist.
89 * @param dateargs: GSList of datestamps expressions to dump, or NULL
91 * @returns: a newly allocated GSList listing all matching holding
95 holding_get_files_for_flush(GSList *dateargs);
97 /* Get a list of all datestamps for which dumps are in the holding
98 * disk. This scans all dumps and takes the union of their
99 * datestamps (some/all of which may actually be timestamps,
100 * depending on the setting of config option usetimestamps)
102 * @returns: a newly allocated GSList listing all datestamps
105 holding_get_all_datestamps(void);
107 /* Get the total size of a holding file, including all holding
108 * file chunks, in kilobytes.
110 * @param holding_file: full pathname of holding file
111 * @param strip_headers: if true, don't count the headers in the
113 * @returns: total size of the holding file, or -1 in an error
116 holding_file_size(char *holding_file,
119 /* Unlink a holding file, including all holding file chunks.
121 * @param holding_file: full pathname of holding file
122 * @returns: 1 on success, else 0
125 holding_file_unlink(char *holding_file);
127 /* Given a pathname of a holding file, read the file header.
128 * the result parameter may be altered even if an error is
131 * @param fname: full pathname of holding file
132 * @param file: (result) dumpfile_t structure
133 * @returns: 1 on success, else 0
136 holding_file_get_dumpfile(char *fname,
143 /* Clean up all holding disks, restoring from a possible crash or
144 * other errors. This function is intentionally opaque, as the
145 * details of holding disk are hidden from other applications.
147 * All error and warning messages go to the debug log.
149 * @param corrupt_dle: function that is called for any DLEs for
150 * which corrupt dumps are found.
151 * @param verbose_output: if non-NULL, send progress messages to
154 typedef void (*corrupt_dle_fn)(char *hostname, char *disk);
156 holding_cleanup(corrupt_dle_fn corrupt_dle,
157 FILE *verbose_output);
160 * application-specific support
163 /* Rename holding files from the temporary names used during
166 * This is currently called by driver.c, but will disappear when
167 * holding is fully converted to the device API
169 * @param holding_file: full pathname of holding file,
171 * @param complete: if 0, set 'is_partial' to 1 in each file
172 * @returns: 1 on success, else 0
175 rename_tmp_holding(char *holding_file,
178 /* Set up a holding directory and do basic permission
181 * @param diskdir: holding directory to set up
182 * @returns: 1 on success, else 0
185 mkholdingdir(char *diskdir);
187 #endif /* HOLDING_H */