1 |
1275 |
phoenix |
/************************************************************************
|
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 |
|
|
/************************************************************************
|
28 |
|
|
* Generic Flight Recorder Structure *
|
29 |
|
|
************************************************************************/
|
30 |
|
|
struct flightRecorder { /* Structure Defination */
|
31 |
|
|
char Signature[8]; /* Eye Catcher */
|
32 |
|
|
int Size; /* Size of Flight Recorder */
|
33 |
|
|
int Flags; /* Format Flags. */
|
34 |
|
|
char* StartPointer; /* Buffer Starting Address */
|
35 |
|
|
char* EndPointer; /* Buffer Ending Address */
|
36 |
|
|
char* NextPointer; /* Next Entry Address */
|
37 |
|
|
char* WrapPointer; /* Point at which buffer wraps */
|
38 |
|
|
char* Buffer; /* Where the data log is. */
|
39 |
|
|
};
|
40 |
|
|
typedef struct flightRecorder FlightRecorder;
|
41 |
|
|
|
42 |
|
|
/************************************************************************
|
43 |
|
|
* Forware declares
|
44 |
|
|
************************************************************************/
|
45 |
|
|
FlightRecorder* alloc_Flight_Recorder(FlightRecorder* FrPtr, char* Signature, int SizeOfFr);
|
46 |
|
|
void fr_Log_Entry(FlightRecorder* LogFr, const char *fmt, ...);
|
47 |
|
|
int fr_Dump(FlightRecorder* Fr, char *Buffer, int BufferLen);
|
48 |
|
|
|
49 |
|
|
/************************************************************************
|
50 |
|
|
* Sample Macro to make life easier using the flight_recorder.
|
51 |
|
|
* TestFr is a global value.
|
52 |
|
|
* To use them: TESTFR("Test Loop value is &d",Loop");
|
53 |
|
|
************************************************************************/
|
54 |
|
|
#define LOGFR(...) (fr_Log_Entry(__VA_ARGS__))
|
55 |
|
|
|