flight_recorder.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /************************************************************************
  2.  * flight_recorder.h                                                    *
  3.  ************************************************************************
  4.  * This code supports the a generic flight recorder.                    *
  5.  * Copyright (C) 20yy  <Allan H Trautman> <IBM Corp>                    * 
  6.  *                                                                      *
  7.  * This program is free software; you can redistribute it and/or modify *
  8.  * it under the terms of the GNU General Public License as published by *
  9.  * the Free Software Foundation; either version 2 of the License, or    *
  10.  * (at your option) any later version.                                  *
  11.  *                                                                      *
  12.  * This program is distributed in the hope that it will be useful,      * 
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
  15.  * GNU General Public License for more details.                         *
  16.  *                                                                      *
  17.  * You should have received a copy of the GNU General Public License    * 
  18.  * along with this program; if not, write to the:                       *
  19.  * Free Software Foundation, Inc.,                                      * 
  20.  * 59 Temple Place, Suite 330,                                          * 
  21.  * Boston, MA  02111-1307  USA                                          *
  22.  ************************************************************************
  23.  * See the fight_recorder.c file for useage deails.                     *
  24.  ************************************************************************/
  25. #include <linux/kernel.h>
  26. /************************************************************************
  27.  * Generic Flight Recorder Structure                                    *
  28.  ************************************************************************/
  29. struct flightRecorder {                 /* Structure Defination         */
  30. char  Signature[8];                /* Eye Catcher                  */
  31. int   Size;             /* Size of Flight Recorder      */
  32. int   Flags;                       /* Format Flags.                */
  33. char* StartPointer;                /* Buffer Starting Address      */
  34. char* EndPointer;                  /* Buffer Ending Address        */
  35. char* NextPointer;                 /* Next Entry Address           */
  36. char* WrapPointer;                 /* Point at which buffer wraps  */
  37. char* Buffer;                      /* Where the data log is.       */
  38. };
  39. typedef struct flightRecorder FlightRecorder;
  40. /************************************************************************
  41.  * Forware declares
  42.  ************************************************************************/
  43. FlightRecorder* alloc_Flight_Recorder(FlightRecorder* FrPtr, char* Signature, int SizeOfFr);
  44. void            fr_Log_Entry(FlightRecorder* LogFr, const char *fmt, ...);
  45. int             fr_Dump(FlightRecorder* Fr, char *Buffer, int BufferLen);
  46. /************************************************************************
  47.  * Sample Macro to make life easier using the flight_recorder. 
  48.  * TestFr is a global value.
  49.  * To use them: TESTFR("Test Loop value is &d",Loop");
  50.  ************************************************************************/
  51. #define LOGFR(...) (fr_Log_Entry(__VA_ARGS__))