X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fparse_bsr.c;h=83b0ff41422a67f3d68b153cd9ec432388fc3724;hb=562570f93a8dc0f9a2ebed286e8eed9ffd23a058;hp=c6eec08a18447a56cb80050d6c0290ad75dad6ec;hpb=3439b3daa04d857b0216248a9389057d694e3f31;p=bacula%2Fbacula diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c old mode 100755 new mode 100644 index c6eec08a18..83b0ff4142 --- a/bacula/src/stored/parse_bsr.c +++ b/bacula/src/stored/parse_bsr.c @@ -5,21 +5,33 @@ * * Version $Id$ */ - /* - Copyright (C) 2002-2006 Kern Sibbald + Bacula® - The Network Backup Solution - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 2 as amended with additional clauses defined in the - file LICENSE in the main source directory. + Copyright (C) 2002-2006 Free Software Foundation Europe e.V. - 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 - the file LICENSE for additional details. + 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 two of the GNU General Public + License as published by the Free Software Foundation and included + in the file LICENSE. - */ + 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 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. + + 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. +*/ #include "bacula.h" @@ -29,7 +41,7 @@ typedef BSR * (ITEM_HANDLER)(LEX *lc, BSR *bsr); static BSR *store_vol(LEX *lc, BSR *bsr); static BSR *store_mediatype(LEX *lc, BSR *bsr); -static BSR *store_storage(LEX *lc, BSR *bsr); +static BSR *store_device(LEX *lc, BSR *bsr); static BSR *store_client(LEX *lc, BSR *bsr); static BSR *store_job(LEX *lc, BSR *bsr); static BSR *store_jobid(LEX *lc, BSR *bsr); @@ -72,9 +84,9 @@ struct kw_items items[] = { {"exclude", store_exclude}, {"volfile", store_volfile}, {"volblock", store_volblock}, - {"stream", store_stream}, - {"slot", store_slot}, - {"storage", store_storage}, + {"stream", store_stream}, + {"slot", store_slot}, + {"device", store_device}, {NULL, NULL} }; @@ -126,28 +138,28 @@ BSR *parse_bsr(JCR *jcr, char *fname) BSR *root_bsr = new_bsr(); BSR *bsr = root_bsr; - Dmsg1(200, "Enter parse_bsf %s\n", fname); + Dmsg1(300, "Enter parse_bsf %s\n", fname); if ((lc = lex_open_file(lc, fname, s_err)) == NULL) { berrno be; Emsg2(M_ERROR_TERM, 0, _("Cannot open bootstrap file %s: %s\n"), - fname, be.strerror()); + fname, be.bstrerror()); } lc->caller_ctx = (void *)jcr; while ((token=lex_get_token(lc, T_ALL)) != T_EOF) { - Dmsg1(200, "parse got token=%s\n", lex_tok_to_str(token)); + Dmsg1(300, "parse got token=%s\n", lex_tok_to_str(token)); if (token == T_EOL) { continue; } for (i=0; items[i].name; i++) { if (strcasecmp(items[i].name, lc->str) == 0) { token = lex_get_token(lc, T_ALL); - Dmsg1 (200, "in T_IDENT got token=%s\n", lex_tok_to_str(token)); + Dmsg1 (300, "in T_IDENT got token=%s\n", lex_tok_to_str(token)); if (token != T_EQUALS) { scan_err1(lc, "expected an equals, got: %s", lc->str); bsr = NULL; break; } - Dmsg1(200, "calling handler for %s\n", items[i].name); + Dmsg1(300, "calling handler for %s\n", items[i].name); /* Call item handler */ bsr = items[i].handler(lc, bsr); i = -1; @@ -155,7 +167,7 @@ BSR *parse_bsr(JCR *jcr, char *fname) } } if (i >= 0) { - Dmsg1(200, "Keyword = %s\n", lc->str); + Dmsg1(300, "Keyword = %s\n", lc->str); scan_err1(lc, "Keyword %s not found", lc->str); bsr = NULL; break; @@ -165,7 +177,7 @@ BSR *parse_bsr(JCR *jcr, char *fname) } } lc = lex_close_file(lc); - Dmsg0(200, "Leave parse_bsf()\n"); + Dmsg0(300, "Leave parse_bsf()\n"); if (!bsr) { free_bsr(root_bsr); root_bsr = NULL; @@ -270,8 +282,8 @@ static BSR *store_mediatype(LEX *lc, BSR *bsr) return bsr; } -/* Shove the Storage name in each Volume in the current bsr */ -static BSR *store_storage(LEX *lc, BSR *bsr) +/* Shove the Device name in each Volume in the current bsr */ +static BSR *store_device(LEX *lc, BSR *bsr) { int token; @@ -280,13 +292,13 @@ static BSR *store_storage(LEX *lc, BSR *bsr) return NULL; } if (!bsr->volume) { - Emsg1(M_ERROR,0, _("Storage %s in bsr at inappropriate place.\n"), + Emsg1(M_ERROR,0, _("Device \"%s\" in bsr at inappropriate place.\n"), lc->str); return bsr; } BSR_VOLUME *bv; for (bv=bsr->volume; bv; bv=bv->next) { - bstrncpy(bv->storage, lc->str, sizeof(bv->storage)); + bstrncpy(bv->device, lc->str, sizeof(bv->device)); } return bsr; } @@ -707,7 +719,7 @@ void dump_volume(BSR_VOLUME *volume) if (volume) { Pmsg1(-1, _("VolumeName : %s\n"), volume->VolumeName); Pmsg1(-1, _(" MediaType : %s\n"), volume->MediaType); - Pmsg1(-1, _(" Storage : %s\n"), volume->storage); + Pmsg1(-1, _(" Device : %s\n"), volume->device); Pmsg1(-1, _(" Slot : %d\n"), volume->Slot); dump_volume(volume->next); } @@ -739,9 +751,6 @@ void dump_sesstime(BSR_SESSTIME *sesstime) } - - - void dump_bsr(BSR *bsr, bool recurse) { int save_debug = debug_level; @@ -881,8 +890,8 @@ void create_restore_volume_list(JCR *jcr) /* * Build a list of volumes to be processed */ - jcr->NumVolumes = 0; - jcr->CurVolume = 0; + jcr->NumReadVolumes = 0; + jcr->CurReadVolume = 0; if (jcr->bsr) { BSR *bsr = jcr->bsr; if (!bsr->volume || !bsr->volume->VolumeName) { @@ -904,11 +913,11 @@ void create_restore_volume_list(JCR *jcr) vol = new_restore_volume(); bstrncpy(vol->VolumeName, bsrvol->VolumeName, sizeof(vol->VolumeName)); bstrncpy(vol->MediaType, bsrvol->MediaType, sizeof(vol->MediaType)); - bstrncpy(vol->storage, bsrvol->storage, sizeof(vol->storage)); + bstrncpy(vol->device, bsrvol->device, sizeof(vol->device)); vol->Slot = bsrvol->Slot; vol->start_file = sfile; if (add_restore_volume(jcr, vol)) { - jcr->NumVolumes++; + jcr->NumReadVolumes++; Dmsg2(400, "Added volume=%s mediatype=%s\n", vol->VolumeName, vol->MediaType); } else { @@ -929,7 +938,7 @@ void create_restore_volume_list(JCR *jcr) bstrncpy(vol->VolumeName, p, sizeof(vol->VolumeName)); bstrncpy(vol->MediaType, jcr->dcr->media_type, sizeof(vol->MediaType)); if (add_restore_volume(jcr, vol)) { - jcr->NumVolumes++; + jcr->NumReadVolumes++; } else { free((char *)vol); }