Print this page
NEX-2911 NDMP logging should use syslog and is too chatty

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ndmpd/tlm/tlm_info.c
          +++ new/usr/src/cmd/ndmpd/tlm/tlm_info.c
↓ open down ↓ 28 lines elided ↑ open up ↑
  29   29   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  30   30   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  31   31   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  32   32   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  33   33   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  34   34   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  35   35   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  36   36   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37   37   * POSSIBILITY OF SUCH DAMAGE.
  38   38   */
       39 +#include <syslog.h>
  39   40  #include <stdlib.h>
  40   41  #include "tlm.h"
  41   42  #include "tlm_proto.h"
  42   43  #include <sys/errno.h>
  43   44  
  44   45  
  45   46  extern  tlm_chain_link_t *tlm_un_ref(tlm_chain_link_t *old_top,
  46   47      tlm_chain_link_t *link);
  47   48  
  48   49  static  tlm_info_t tlm_info;
↓ open down ↓ 147 lines elided ↑ open up ↑
 196  197                  tlm_job_stats_t *job_stats;
 197  198                  job_stats = (tlm_job_stats_t *)link->tc_data;
 198  199  
 199  200                  if (strcmp(job_stats->js_job_name, name) == 0) {
 200  201                          link->tc_ref_count++;
 201  202                          (void) mutex_unlock(&jstat_mtx);
 202  203                          return (job_stats);
 203  204                  }
 204  205                  link = link->tc_next;
 205  206          } while (link != tlm_info.ti_job_stats);
 206      -        NDMP_LOG(LOG_DEBUG,
      207 +        syslog(LOG_DEBUG,
 207  208              "TAPE BACKUP> Ref for job [%s] was not found", name);
 208  209          (void) mutex_unlock(&jstat_mtx);
 209  210  
 210  211          return (&fake_job_stats);
 211  212  }
 212  213  
 213  214  /*
 214  215   * remove a link to the INFO chain
 215  216   */
 216  217  void
 217  218  tlm_un_ref_job_stats(char *name)
 218  219  {
 219  220          tlm_chain_link_t *link;
 220  221  
 221  222          (void) mutex_lock(&jstat_mtx);
 222  223          link = tlm_info.ti_job_stats;
 223  224          if (link == 0) {
 224      -                NDMP_LOG(LOG_DEBUG, "TAPE BACKUP>"
      225 +                syslog(LOG_DEBUG, "TAPE BACKUP>"
 225  226                      " Internal error for job [%s], could not delete", name);
 226  227                  return;
 227  228          }
 228  229          do {
 229  230                  tlm_job_stats_t *job_stats;
 230  231                  job_stats = (tlm_job_stats_t *)link->tc_data;
 231  232  
 232  233                  if (strcmp(job_stats->js_job_name, name) == 0) {
 233  234                          tlm_info.ti_job_stats =
 234  235                              tlm_un_ref(tlm_info.ti_job_stats, link);
 235  236                          (void) mutex_unlock(&jstat_mtx);
 236  237                          return;
 237  238                  }
 238  239                  link = link->tc_next;
 239  240          } while (link != tlm_info.ti_job_stats);
 240  241          (void) mutex_unlock(&jstat_mtx);
 241      -        NDMP_LOG(LOG_DEBUG,
      242 +        syslog(LOG_DEBUG,
 242  243              "TAPE BACKUP> Delete for job [%s] was not found", name);
 243  244  }
 244  245  
 245  246  /*
 246  247   * one party does not care about this blob, can we let it go?
 247  248   */
 248  249  tlm_chain_link_t *
 249  250  tlm_un_ref(tlm_chain_link_t *old_top, tlm_chain_link_t *link)
 250  251  {
 251  252          tlm_chain_link_t *chain_link = old_top;
↓ open down ↓ 46 lines elided ↑ open up ↑
 298  299                          next = link->tc_next;
 299  300                          prev = link->tc_prev;
 300  301                          prev->tc_next = next;
 301  302                          next->tc_prev = prev;
 302  303                          free(link->tc_data);
 303  304                          free(link);
 304  305                          return (new_top);
 305  306                  }
 306  307                  chain_link = chain_link->tc_next;
 307  308          } while (chain_link != old_top);
 308      -        NDMP_LOG(LOG_DEBUG, "TAPE BACKUP> un_ref target not found.");
      309 +        syslog(LOG_DEBUG, "TAPE BACKUP> un_ref target not found.");
 309  310          return (old_top);
 310  311  }
 311  312  
 312  313  /*
 313  314   * the following section is global, but not really part of the
 314  315   * public interface.  Use of this outside of the tlm_*.c files
 315  316   * is for special cases only.
 316  317   */
 317  318  
 318  319  /*
↓ open down ↓ 65 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX