2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2010 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 three of the GNU Affero General Public
10 License as published by the Free Software Foundation, which is
11 listed in the file LICENSE.
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 Affero 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.
29 * Written by James Harper, October 2008
32 #include "exchange-fd.h"
34 root_node_t::root_node_t(char *name) : node_t(name, NODE_TYPE_ROOT)
39 root_node_t::~root_node_t()
44 root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp)
49 _DebugMessage(100, "startBackupNode_ROOT state = %d\n", state);
53 if (strcmp(PLUGIN_PATH_PREFIX_BASE, name) != 0)
55 _JobMessage(M_FATAL, "Invalid backup path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
59 // check that service_node == NULL
60 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
64 context->current_node = service_node;
68 sp->fname = full_path;
70 sp->statp.st_mode = 0700 | S_IFDIR;
71 sp->statp.st_ctime = now;
72 sp->statp.st_mtime = now;
73 sp->statp.st_atime = now;
74 sp->statp.st_size = 0;
80 _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state);
87 root_node_t::endBackupFile(exchange_fd_context_t *context)
91 _DebugMessage(100, "endBackupNode_ROOT state = %d\n", state);
97 // free service_node here?
105 _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state);
113 root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp)
115 _DebugMessage(100, "createFile_ROOT state = %d\n", state);
118 if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) {
119 _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
123 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
124 context->current_node = service_node;
127 rp->create_status = CF_CREATED;
132 rp->create_status = CF_SKIP;
138 _JobMessage(M_FATAL, "createFile: invalid internal state %d", state);
145 root_node_t::endRestoreFile(exchange_fd_context_t *context)
147 _DebugMessage(100, "endRestoreFile_ROOT state = %d\n", state);
158 _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state);