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/module.h>
  25 #include <linux/ftape.h>
  26 
  27 #include "tracing.h"
  28 
  29 /*      Global vars.
  30  */
  31 /*      tracing
  32  *      set it to:     to get:
  33  *       0              bugs
  34  *       1              + errors
  35  *       2              + warnings
  36  *       3              + information
  37  *       4              + more information
  38  *       5              + program flow
  39  *       6              + fdc/dma info
  40  *       7              + data flow
  41  *       8              + everything else
  42  */
  43 int tracing = 3;                /* Default level: report only errors */
  44 
  45 #ifndef NO_TRACE_AT_ALL
  46 
  47 byte trace_id = 0;
  48 int function_nest_level = 0;
  49 
  50 /*      Local vars.
  51  */
  52 static char spacing[] = "*                              ";
  53 
  54 int trace_call(int level, char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  55 {
  56         char *indent;
  57 
  58         if (tracing >= level && level <= TOP_LEVEL) {
  59                 /*    Since printk seems not to work with "%*s" format
  60                  *    we'll use this work-around.
  61                  */
  62                 if (function_nest_level < sizeof(spacing)) {
  63                         indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  64                 } else {
  65                         indent = spacing;
  66                 }
  67                 printk(KERN_INFO "[%03d]%s+%s (%s)\n", (int) trace_id++, indent, file, name);
  68         }
  69         return function_nest_level++;
  70 }
  71 
  72 void trace_exit(int level, char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  73 {
  74         char *indent;
  75 
  76         if (tracing >= level && level <= TOP_LEVEL) {
  77                 /*    Since printk seems not to work with "%*s" format
  78                  *    we'll use this work-around.
  79                  */
  80                 if (function_nest_level < sizeof(spacing)) {
  81                         indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  82                 } else {
  83                         indent = spacing;
  84                 }
  85                 printk(KERN_INFO "[%03d]%s-%s (%s)\n", (int) trace_id++, indent, file, name);
  86         }
  87 }
  88 
  89 void trace_log(char *file, char *name)
     /* [previous][next][first][last][top][bottom][index][help] */
  90 {
  91         char *indent;
  92 
  93         /*    Since printk seems not to work with "%*s" format
  94          *    we'll use this work-around.
  95          */
  96         if (function_nest_level < sizeof(spacing)) {
  97                 indent = spacing + sizeof(spacing) - 1 - function_nest_level;
  98         } else {
  99                 indent = spacing;
 100         }
 101         printk(KERN_INFO "[%03d]%s%s (%s) - ", (int) trace_id++, indent, file, name);
 102 }
 103 
 104 #endif                          /* NO_TRACE_AT_ALL */

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