2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2018 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Written by James Harper, October 2008
23 #include "exchange-fd.h"
25 root_node_t::root_node_t(char *name) : node_t(name, NODE_TYPE_ROOT)
30 root_node_t::~root_node_t()
35 root_node_t::startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp)
40 _DebugMessage(100, "startBackupNode_ROOT state = %d\n", state);
44 if (strcmp(PLUGIN_PATH_PREFIX_BASE, name) != 0)
46 _JobMessage(M_FATAL, "Invalid backup path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
50 // check that service_node == NULL
51 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
55 context->current_node = service_node;
59 sp->fname = full_path;
61 sp->statp.st_mode = 0700 | S_IFDIR;
62 sp->statp.st_ctime = now;
63 sp->statp.st_mtime = now;
64 sp->statp.st_atime = now;
65 sp->statp.st_size = 0;
71 _JobMessage(M_FATAL, "startBackupFile: invalid internal state %d", state);
78 root_node_t::endBackupFile(exchange_fd_context_t *context)
82 _DebugMessage(100, "endBackupNode_ROOT state = %d\n", state);
88 // free service_node here?
96 _JobMessage(M_FATAL, "endBackupFile: invalid internal state %d", state);
104 root_node_t::createFile(exchange_fd_context_t *context, struct restore_pkt *rp)
106 _DebugMessage(100, "createFile_ROOT state = %d\n", state);
109 if (strcmp(name, PLUGIN_PATH_PREFIX_BASE) != 0) {
110 _JobMessage(M_FATAL, "Invalid restore path specified, must start with '/" PLUGIN_PATH_PREFIX_BASE "/'\n");
114 service_node = new service_node_t(bstrdup(context->path_bits[level + 1]), this);
115 context->current_node = service_node;
118 rp->create_status = CF_CREATED;
123 rp->create_status = CF_SKIP;
129 _JobMessage(M_FATAL, "createFile: invalid internal state %d", state);
136 root_node_t::endRestoreFile(exchange_fd_context_t *context)
138 _DebugMessage(100, "endRestoreFile_ROOT state = %d\n", state);
149 _JobMessage(M_FATAL, "endRestore: invalid internal state %d", state);