/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
- The main author of Bacula is Kern Sibbald, with contributions from
- many others, a complete list can be found in the file AUTHORS.
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version three of the GNU Affero General Public
- License as published by the Free Software Foundation, which is
- listed in the file LICENSE.
+ The main author of Bacula is Kern Sibbald, with contributions from many
+ others, a complete list can be found in the file AUTHORS.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
Bacula® is a registered trademark of Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
*/
/*
* A simple delta plugin for the Bacula File Daemon
bool done;
int level;
- delta_test(bpContext *bpc) {
+ delta_test(bpContext *bpc) {
fd = NULL;
ctx = bpc;
done = false;
}
/*
- * External entry point to unload the plugin
+ * External entry point to unload the plugin
*/
-bRC unloadPlugin()
+bRC unloadPlugin()
{
// Dmsg(NULL, dbglvl, "delta-test-fd: Unloaded\n");
return bRC_OK;
}
/*
- * The following entry points are accessed through the function
+ * The following entry points are accessed through the function
* pointers we supplied to Bacula. Each plugin type (dir, fd, sd)
* has its own set of entry points that the plugin must define.
*/
/*
* Return some plugin value (none defined)
*/
-static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
{
return bRC_OK;
}
/*
* Set a plugin value (none defined)
*/
-static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
{
return bRC_OK;
}
*/
switch (event->eventType) {
case bEventPluginCommand:
-// Dmsg(ctx, dbglvl,
+// Dmsg(ctx, dbglvl,
// "delta-test-fd: PluginCommand=%s\n", (char *)value);
break;
case bEventJobStart:
if (self->level == 'I' || self->level == 'D') {
bfuncs->getBaculaValue(ctx, bVarAccurate, (void *)&accurate);
if (!accurate) { /* can be changed to FATAL */
- Jmsg(ctx, M_FATAL,
+ Jmsg(ctx, M_FATAL,
"Accurate mode should be turned on when using the "
"delta-test plugin\n");
return bRC_Error;
};
static int nb_files = 4;
-/*
+/*
* Start the backup of a specific file
*/
static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
self->delta = sp->delta_seq + 1;
}
pm_strcpy(self->fname, files[self->delta % nb_files]);
- Dmsg(ctx, dbglvl, "delta-test-fd: delta_seq=%i delta=%i fname=%s\n",
+ Dmsg(ctx, dbglvl, "delta-test-fd: delta_seq=%i delta=%i fname=%s\n",
sp->delta_seq, self->delta, self->fname);
// Dmsg(ctx, dbglvl, "delta-test-fd: startBackupFile\n");
return bRC_OK;
if (!self) {
return bRC_Error;
}
-
+
io->status = 0;
io->io_errno = 0;
switch(io->func) {
}
if (!self->fd) {
io->io_errno = errno;
- Jmsg(ctx, M_FATAL,
+ Jmsg(ctx, M_FATAL,
"Open failed: ERR=%s\n", strerror(errno));
return bRC_Error;
}
self->fd = fopen(self->fname, "r");
if (!self->fd) {
io->io_errno = errno;
- Jmsg(ctx, M_FATAL,
+ Jmsg(ctx, M_FATAL,
"Open failed: ERR=%s\n", strerror(errno));
return bRC_Error;
}
} else {
/* first time, read 300, then replace 50-250 by other data */
if (self->delta == 0) {
- io->status = fread(io->buf, 1, 400, self->fd);
+ io->status = fread(io->buf, 1, 400, self->fd);
} else {
io->offset = self->delta * 100 / 2; /* chunks are melted */
io->status = fread(io->buf, 1, 100, self->fd);
self->done = true;
}
if (io->status == 0 && ferror(self->fd)) {
- Jmsg(ctx, M_FATAL,
+ Jmsg(ctx, M_FATAL,
"Pipe read error: ERR=%s\n", strerror(errno));
- Dmsg(ctx, dbglvl,
+ Dmsg(ctx, dbglvl,
"Pipe read error: ERR=%s\n", strerror(errno));
return bRC_Error;
}
Dmsg(ctx, dbglvl, "delta-test-fd: WRITE count=%lld\n", (int64_t)io->count);
io->status = fwrite(io->buf, 1, io->count, self->fd);
if (io->status == 0 && ferror(self->fd)) {
- Jmsg(ctx, M_FATAL,
+ Jmsg(ctx, M_FATAL,
"Pipe write error\n");
- Dmsg(ctx, dbglvl,
+ Dmsg(ctx, dbglvl,
"Pipe read error: ERR=%s\n", strerror(errno));
return bRC_Error;
}
/*
* This is called during restore to create the file (if necessary)
* We must return in rp->create_status:
- *
+ *
* CF_ERROR -- error
* CF_SKIP -- skip processing this file
* CF_EXTRACT -- extract the file (i.e.call i/o routines)