Skip to content

Commit

Permalink
stored tools: callbSdEventSetupRecordTranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Jan 3, 2023
1 parent d6ff026 commit 0fdc73f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
17 changes: 16 additions & 1 deletion core/src/stored/bcopy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2002-2012 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
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
Expand Down Expand Up @@ -200,6 +200,14 @@ int main(int argc, char* argv[])
in_dev = in_jcr->sd_impl->dcr->dev;
if (!in_dev) { exit(1); }

// Let SD plugins setup the record translation
if (GeneratePluginEvent(in_jcr, bSdEventSetupRecordTranslation, in_dcr)
!= bRC_OK) {
Jmsg(in_jcr, M_FATAL, 0,
_("bSdEventSetupRecordTranslation call for input failed!\n"));
}


// Setup output device for writing
Dmsg0(100, "About to setup output jcr\n");

Expand All @@ -211,6 +219,13 @@ int main(int argc, char* argv[])
out_dev = out_jcr->sd_impl->dcr->dev;
if (!out_dev) { exit(1); }

// Let SD plugins setup the record translation
if (GeneratePluginEvent(out_jcr, bSdEventSetupRecordTranslation, out_dcr)
!= bRC_OK) {
Jmsg(in_jcr, M_FATAL, 0,
_("bSdEventSetupRecordTranslation call for output failed!\n"));
}

Dmsg0(100, "About to acquire device for writing\n");

// For we must now acquire the device for writing
Expand Down
8 changes: 7 additions & 1 deletion core/src/stored/bextract.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
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
Expand Down Expand Up @@ -233,6 +233,7 @@ int main(int argc, char* argv[])

LoadSdPlugins(me->plugin_directory, me->plugin_names);


ReadCryptoCache(me->working_directory, "bareos-sd",
GetFirstPortHostOrder(me->SDaddrs));

Expand Down Expand Up @@ -400,6 +401,11 @@ static void DoExtract(char* devname,
if (!dev) { exit(1); }
dcr = jcr->sd_impl->read_dcr;

// Let SD plugins setup the record translation
if (GeneratePluginEvent(jcr, bSdEventSetupRecordTranslation, dcr) != bRC_OK) {
Jmsg(jcr, M_FATAL, 0, _("bSdEventSetupRecordTranslation call failed!\n"));
}

// Make sure where directory exists and that it is a directory
if (stat(where, &statp) < 0) {
BErrNo be;
Expand Down
9 changes: 8 additions & 1 deletion core/src/stored/bscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2001-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
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
Expand Down Expand Up @@ -306,6 +306,13 @@ int main(int argc, char* argv[])
if (!bjcr) { exit(1); }
dev = bjcr->sd_impl->read_dcr->dev;

// Let SD plugins setup the record translation
if (GeneratePluginEvent(bjcr, bSdEventSetupRecordTranslation, dcr)
!= bRC_OK) {
Jmsg(bjcr, M_FATAL, 0, _("bSdEventSetupRecordTranslation call failed!\n"));
}


if (showProgress) {
char ed1[50];
struct stat sb;
Expand Down
7 changes: 6 additions & 1 deletion core/src/stored/btape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2023 Bareos GmbH & Co. KG
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
Expand Down Expand Up @@ -330,6 +330,11 @@ int main(int margc, char* margv[])
exit(1);
}

// Let SD plugins setup the record translation
if (GeneratePluginEvent(jcr, bSdEventSetupRecordTranslation, dcr) != bRC_OK) {
Jmsg(jcr, M_FATAL, 0, _("bSdEventSetupRecordTranslation call failed!\n"));
}

if (!open_the_device()) { exit(1); }

Dmsg0(200, "Do tape commands\n");
Expand Down

0 comments on commit 0fdc73f

Please sign in to comment.