XRootD
XrdXrootdPgwFob.cc
Go to the documentation of this file.
1 /******************************************************************************/
2 /* */
3 /* X r d X r o o t d P g w F o b . c c */
4 /* */
5 /* (c) 2021 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* Produced by Andrew Hanushevsky for Stanford University under contract */
7 /* DE-AC02-76-SFO0515 with the Department of Energy */
8 /* */
9 /* This file is part of the XRootD software suite. */
10 /* */
11 /* XRootD is free software: you can redistribute it and/or modify it under */
12 /* the terms of the GNU Lesser General Public License as published by the */
13 /* Free Software Foundation, either version 3 of the License, or (at your */
14 /* option) any later version. */
15 /* */
16 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19 /* License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24 /* */
25 /* The copyright holder's institutional names and contributor's names may not */
26 /* be used to endorse or promote products derived from this software without */
27 /* specific prior written permission of the institution or contributor. */
28 /******************************************************************************/
29 
30 #include <cstdio>
31 
32 #include "XrdOuc/XrdOucString.hh"
33 #include "XrdSys/XrdSysError.hh"
37 
38 /******************************************************************************/
39 /* G l o b a l s */
40 /******************************************************************************/
41 
42 namespace XrdXrootd
43 {
44 extern XrdSysError eLog;
45 }
46 using namespace XrdXrootd;
47 
49 
50 /******************************************************************************/
51 /* D e s t r u c t o r */
52 /******************************************************************************/
53 
54 #define TRACELINK fileP
55 
57 {
58  int len, n = badOffs.size();
59 
60 // Write an error message if this file has any outstanding checksum errors
61 //
62  if (n)
63  {char buff[128];
64  snprintf(buff, sizeof(buff), "Warning! %d checksum error(s) in", n);
65  eLog.Emsg("PgwFob", buff, fileP->FileKey);
66  }
67 
68 // Check if we have anything to do and if we do, dump the list of bad checksums.
69 //
70  if (TRACING(TRACE_PGCS))
71  {const char *TraceID = "FileFob", *fname = fileP->FileKey;
72  if (n)
73  {XrdOucString lolist((1+4+1+13)*n);
74  char item[128];
75  kXR_int64 val;
76 
77  for (std::set<kXR_int64>::iterator it = badOffs.begin();
78  it != badOffs.end(); ++it)
79  {val = *it;
80  len = val & (XrdProto::kXR_pgPageSZ-1);
81  if (!len) len = XrdProto::kXR_pgPageSZ;
82  val = val >> XrdProto::kXR_pgPageBL;
83  snprintf(item, sizeof(item), " %d@%lld", len, val);
84  lolist += item;
85  }
86  TRACEI(PGCS,fname<<" had "<<numErrs<<" cksum errs and "<<numFixd
87  <<" fixes"<<"; areas in error:"<<lolist.c_str());
88  } else if (numErrs)
89  {TRACEI(PGCS,fname<<" had "<<numErrs<<" cksum errs and "
90  <<numFixd<<" fixes.");
91  }
92  }
93 }
long long kXR_int64
Definition: XPtypes.hh:98
#define TRACING(x)
Definition: XrdTrace.hh:70
#define TRACEI(act, x)
Definition: XrdTrace.hh:66
XrdSysTrace XrdXrootdTrace
#define TRACE_PGCS
const char * c_str() const
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
static const int kXR_pgPageSZ
Definition: XProtocol.hh:494
static const int kXR_pgPageBL
Definition: XProtocol.hh:495
XrdSysError eLog