]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/getmsg.c
Update technotes and version
[bacula/bacula] / bacula / src / dird / getmsg.c
index 06c9d62b753c4f2439c51e62df8dbef9ccbf6244..4a7b758c939865f8208f6cd6da40d6e921aed48e 100644 (file)
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 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 as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   Copyright (C) 2000-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
+   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 plus additions
+   that are listed 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., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   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 John Walker.
+   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"
 #include "dird.h"
@@ -54,7 +62,9 @@ static char Device_update[]   = "DevUpd Job=%127s "
    "open=%d labeled=%d offline=%d "
    "reserved=%d max_writers=%d "
    "autoselect=%d autochanger=%d "
-   "changer_name=%127s media_type=%127s volume_name=%127s\n";
+   "changer_name=%127s media_type=%127s volume_name=%127s "
+   "DevReadTime=%d DevWriteTime=%d DevReadBytes=%d "
+   "DevWriteBytes=%d\n";
 #endif
 
 
@@ -198,14 +208,14 @@ int bget_dirmsg(BSOCK *bs)
        */
       if (bs->msg[0] == 'C') {        /* Catalog request */
          Dmsg2(900, "Catalog req jcr 0x%x: %s", jcr, bs->msg);
-         catalog_request(jcr, bs, msg);
+         catalog_request(jcr, bs);
          Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
          free_jcr(jcr);
          continue;
       }
       if (bs->msg[0] == 'U') {        /* Catalog update */
          Dmsg2(900, "Catalog upd jcr 0x%x: %s", jcr, bs->msg);
-         catalog_update(jcr, bs, msg);
+         catalog_update(jcr, bs);
          Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
          free_jcr(jcr);
          continue;
@@ -235,6 +245,7 @@ int bget_dirmsg(BSOCK *bs)
          int dev_open, dev_append, dev_read, dev_labeled;
          int dev_offline, dev_autochanger, dev_autoselect;
          int dev_num_writers, dev_max_writers, dev_reserved;
+         uint64_t dev_read_time, dev_write_time, dev_write_bytes, dev_read_bytes;
          uint64_t dev_PoolId;
          Dmsg1(100, "<stored: %s", bs->msg);
          if (sscanf(bs->msg, Device_update,
@@ -245,7 +256,9 @@ int bget_dirmsg(BSOCK *bs)
              &dev_max_writers, &dev_autoselect, 
              &dev_autochanger, 
              changer_name.c_str(), media_type.c_str(),
-             volume_name.c_str()) != 15) {
+             volume_name.c_str(),
+             &dev_read_time, &dev_write_time, &dev_read_bytes,
+             &dev_write_bytes) != 19) {
             Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
          } else {
             unbash_spaces(dev_name);
@@ -275,6 +288,10 @@ int bget_dirmsg(BSOCK *bs)
             dev->max_writers = dev_max_writers;
             dev->reserved = dev_reserved;
             dev->found = true;
+            dev->DevReadTime = dev_read_time; /* TODO : have to update database */
+            dev->DevWriteTime = dev_write_time;
+            dev->DevReadBytes = dev_read_bytes;
+            dev->DevWriteBytes = dev_write_bytes;
          }
          continue;
       }
@@ -309,13 +326,11 @@ bool response(JCR *jcr, BSOCK *bs, char *resp, const char *cmd, e_prtmsg prtmsg)
       return false;
    }
    if ((n = bget_dirmsg(bs)) >= 0) {
-      Dmsg0(900, bs->msg);
       if (strcmp(bs->msg, resp) == 0) {
          return true;
       }
-      Dmsg1(900, "Bad response: ERR=%s", bs->msg);
       if (prtmsg == DISPLAY_ERROR) {
-         Jmsg(jcr, M_FATAL, 0, _("Bad response to %s command: wanted %s got: %s\n"),
+         Jmsg(jcr, M_FATAL, 0, _("Bad response to %s command: wanted %s, got %s\n"),
             cmd, resp, bs->msg);
       }
       return false;