]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/label.c
Make cd accept wildcards
[bacula/bacula] / bacula / src / stored / label.c
index cfb43128f0f036114f250fdadf76f5e54dac8e9d..9fd0c3df83a5b5e0e2eddb2e4f6825beed11782f 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2010 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 two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    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
+   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.
@@ -31,8 +31,6 @@
  *
  *   Kern Sibbald, MM
  *
- *
- *   Version $Id$
  */
 
 #include "bacula.h"                   /* pull in global headers */
@@ -321,8 +319,8 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
    }
 
    /* Set the new filename for open, ... */
-   bstrncpy(dev->VolCatInfo.VolCatName, VolName, sizeof(dev->VolCatInfo.VolCatName));
-   bstrncpy(dcr->VolCatInfo.VolCatName, VolName, sizeof(dcr->VolCatInfo.VolCatName));
+   dev->setVolCatName(VolName);
+   dcr->setVolCatName(VolName);
    Dmsg1(150, "New VolName=%s\n", VolName);
    if (dev->open(dcr, OPEN_READ_WRITE) < 0) {
       /* If device is not tape, attempt to create it */
@@ -362,6 +360,7 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
 
    create_volume_label_record(dcr, dcr->rec);
    dcr->rec->Stream = 0;
+   dcr->rec->maskedStream = 0;
 
    if (!write_record_to_block(dcr->block, dcr->rec)) {
       Dmsg2(130, "Bad Label write on %s: ERR=%s\n", dev->print_name(), dev->print_errmsg());
@@ -440,6 +439,7 @@ bool rewrite_volume_label(DCR *dcr, bool recycle)
    }
    Dmsg1(150, "wrote vol label to block. Vol=%s\n", dcr->VolumeName);
 
+   dev->setVolCatInfo(false);
    dev->VolCatInfo.VolCatBytes = 0;        /* reset byte count */
 
    /*
@@ -512,8 +512,9 @@ bool rewrite_volume_label(DCR *dcr, bool recycle)
       dev->VolCatInfo.VolCatReads = 1;
    }
    Dmsg1(150, "dir_update_vol_info. Set Append vol=%s\n", dcr->VolumeName);
+   dev->VolCatInfo.VolFirstWritten = time(NULL);
    bstrncpy(dev->VolCatInfo.VolCatStatus, "Append", sizeof(dev->VolCatInfo.VolCatStatus));
-   bstrncpy(dev->VolCatInfo.VolCatName, dcr->VolumeName, sizeof(dev->VolCatInfo.VolCatName));
+   dev->setVolCatName(dcr->VolumeName);
    if (!dir_update_volume_info(dcr, true, true)) {  /* indicate doing relabel */
       return false;
    }
@@ -590,6 +591,7 @@ static void create_volume_label_record(DCR *dcr, DEV_RECORD *rec)
    rec->VolSessionId = jcr->VolSessionId;
    rec->VolSessionTime = jcr->VolSessionTime;
    rec->Stream = jcr->NumWriteVolumes;
+   rec->maskedStream = jcr->NumWriteVolumes;
    Dmsg2(150, "Created Vol label rec: FI=%s len=%d\n", FI_to_ascii(buf, rec->FileIndex),
       rec->data_len);
 }
@@ -651,6 +653,7 @@ void create_session_label(DCR *dcr, DEV_RECORD *rec, int label)
    rec->VolSessionId   = jcr->VolSessionId;
    rec->VolSessionTime = jcr->VolSessionTime;
    rec->Stream         = jcr->JobId;
+   rec->maskedStream   = jcr->JobId;
 
    rec->data = check_pool_memory_size(rec->data, SER_LENGTH_Session_Label);
    ser_begin(rec->data, SER_LENGTH_Session_Label);
@@ -671,8 +674,8 @@ void create_session_label(DCR *dcr, DEV_RECORD *rec, int label)
    /* Added in VerNum 10 */
    ser_string(jcr->Job);              /* Unique name of this Job */
    ser_string(jcr->fileset_name);
-   ser_uint32(jcr->get_JobType());
-   ser_uint32(jcr->get_JobLevel());
+   ser_uint32(jcr->getJobType());
+   ser_uint32(jcr->getJobLevel());
    /* Added in VerNum 11 */
    ser_string(jcr->fileset_md5);