2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
35 * This object can be use to browse the catalog
45 /* Helper for result handler */
53 BVFS_Id = 0, /* Could be PathId or FilenameId */
58 /* Only if File record */
61 /* Only if File Version record */
70 Bvfs(JCR *j, B_DB *mdb);
73 void set_jobid(JobId_t id) {
74 Mmsg(jobids.list, "%lld", (uint64_t)id);
77 void set_jobids(char *ids) {
78 pm_strcpy(jobids.list, ids);
81 void set_limit(uint32_t max) {
85 void set_offset(uint32_t nb) {
89 void set_pattern(char *p) {
90 uint32_t len = strlen(p)*2+1;
91 pattern = check_pool_memory_size(pattern, len);
92 db_escape_string(jcr, db, pattern, p, len);
95 /* Get the root point */
98 /* It's much better to access Path though their PathId, it
99 * avoids mistakes with string encoding
101 void ch_dir(DBId_t pathid) {
107 * Returns true if the directory exists
109 bool ch_dir(const char *path);
111 bool ls_files(); /* Returns true if we have more files to read */
112 bool ls_dirs(); /* Returns true if we have more dir to read */
113 void ls_special_dirs(); /* get . and .. */
114 void get_all_file_versions(DBId_t pathid, DBId_t fnid, const char *client);
118 void set_see_all_version(bool val) {
119 see_all_version = val;
122 void set_see_copies(bool val) {
126 void set_handler(DB_RESULT_HANDLER *h, void *ctx) {
143 void reset_offset() {
151 /* for internal use */
152 int _handle_path(void *, int, char **);
155 Bvfs(const Bvfs &); /* prohibit pass by value */
156 Bvfs & operator = (const Bvfs &); /* prohibit class assignment */
163 uint32_t nb_record; /* number of records of the last query */
165 DBId_t pwd_id; /* Current pathid */
166 DBId_t dir_filenameid; /* special FilenameId where Name='' */
167 POOLMEM *prev_dir; /* ls_dirs query returns all versions, take the 1st one */
168 ATTR *attr; /* Can be use by handler to call decode_stat() */
170 bool see_all_version;
173 DBId_t get_dir_filenameid();
175 DB_RESULT_HANDLER *list_entries;
179 void bvfs_update_path_hierarchy_cache(JCR *jcr, B_DB *mdb, db_list_ctx *jobids);
180 void bvfs_update_cache(JCR *jcr, B_DB *mdb);
181 char *bvfs_parent_dir(char *path);
183 /* Return the basename of the with the trailing / (update the given string)
184 * TODO: see in the rest of bacula if we don't have
185 * this function already
187 char *bvfs_basename_dir(char *path);
190 #endif /* __BVFS_H_ */