root/drivers/char/ftape/tracing.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. trace_call
  2. trace_exit
  3. trace_log

   1 
   2 /*
   3  *      Copyright (C) 1993-1995 Bas Laarhoven.
   4 
   5  This program is free software; you can redistribute it and/or modify
   6  it under the terms of the GNU General Public License as published by
   7  the Free Software Foundation; either version 2, or (at your option)
   8  any later version.
   9 
  10  This program is distributed in the hope that it will be useful,
  11  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  GNU General Public License for more details.
  14 
  15  You should have received a copy of the GNU General Public License
  16  along with this program; see the file COPYING.  If not, write to
  17  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18 
  19  *
  20  *      This file contains the reading code
  21  *      for the QIC-117 floppy-tape driver for Linux.
  22  */
  23 
  24 #include <linux/ftape.h>
  25 
  26 #include "tracing.h"
  27 
  28 /*      Global vars.
  29  */
  30 /*      tracing
  31  *      set it to:     to get:
  32  *       0              bugs
  33  *       1              + errors
  34  *       2              + warnings
  35  *       3              + information
  36  *       4              + more information
  37  *       5              + program flow
  38  *       6              + fdc/dma info
  39  *       7              + data flow
  40  *       8              + everything else
  41  */
  42 int tracing = 3;                /* Default level: report only errors */
  43 
  44 #ifndef NO_TRACE_AT_ALL
  45 
  46 byte trace_id = 0;
  47 int function_nest_level = 0;
  48 
  49 /*      Local vars.
  50  */
  51 static char spacing[] = "*                              ";
  52 
  53 int trace_call(int level, char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  54 {
  55         char *indent;
  56 
  57         if (tracing >= level && level <= TOP_LEVEL) {
  58                 /*    Since printk seems not to work with "%*s" format
  59                  *    we'll use this work-around.
  60                  */
  61                 if (function_nest_level < sizeof(spacing)) {
  62                         indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  63                 } else {
  64                         indent = spacing;
  65                 }
  66                 printk(KERN_INFO "[%03d]%s+%s (%s)\n", (int) trace_id++, indent, file, name);
  67         }
  68         return function_nest_level++;
  69 }
  70 
  71 void trace_exit(int level, char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         char *indent;
  74 
  75         if (tracing >= level && level <= TOP_LEVEL) {
  76                 /*    Since printk seems not to work with "%*s" format
  77                  *    we'll use this work-around.
  78                  */
  79                 if (function_nest_level < sizeof(spacing)) {
  80                         indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  81                 } else {
  82                         indent = spacing;
  83                 }
  84                 printk(KERN_INFO "[%03d]%s-%s (%s)\n", (int) trace_id++, indent, file, name);
  85         }
  86 }
  87 
  88 void trace_log(char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  89 {
  90         char *indent;
  91 
  92         /*    Since printk seems not to work with "%*s" format
  93          *    we'll use this work-around.
  94          */
  95         if (function_nest_level < sizeof(spacing)) {
  96                 indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  97         } else {
  98                 indent = spacing;
  99         }
 100         printk(KERN_INFO "[%03d]%s%s (%s) - ", (int) trace_id++, indent, file, name);
 101 }
 102 
 103 #endif                          /* NO_TRACE_AT_ALL */

/* [previous][next][first][last][top][bottom][index][help] */