Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-2.6-block.git] / fs / xfs / support / ktrace.h
1 /*
2  * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 #ifndef __XFS_SUPPORT_KTRACE_H__
19 #define __XFS_SUPPORT_KTRACE_H__
20
21 /*
22  * Trace buffer entry structure.
23  */
24 typedef struct ktrace_entry {
25         void    *val[16];
26 } ktrace_entry_t;
27
28 /*
29  * Trace buffer header structure.
30  */
31 typedef struct ktrace {
32         int             kt_nentries;    /* number of entries in trace buf */
33         int             kt_index;       /* current index in entries */
34         int             kt_rollover;
35         ktrace_entry_t  *kt_entries;    /* buffer of entries */
36 } ktrace_t;
37
38 /*
39  * Trace buffer snapshot structure.
40  */
41 typedef struct ktrace_snap {
42         int             ks_start;       /* kt_index at time of snap */
43         int             ks_index;       /* current index */
44 } ktrace_snap_t;
45
46
47 #ifdef CONFIG_XFS_TRACE
48
49 extern void ktrace_init(int zentries);
50 extern void ktrace_uninit(void);
51
52 extern ktrace_t *ktrace_alloc(int, unsigned int __nocast);
53 extern void ktrace_free(ktrace_t *);
54
55 extern void ktrace_enter(
56         ktrace_t        *,
57         void            *,
58         void            *,
59         void            *,
60         void            *,
61         void            *,
62         void            *,
63         void            *,
64         void            *,
65         void            *,
66         void            *,
67         void            *,
68         void            *,
69         void            *,
70         void            *,
71         void            *,
72         void            *);
73
74 extern ktrace_entry_t   *ktrace_first(ktrace_t *, ktrace_snap_t *);
75 extern int              ktrace_nentries(ktrace_t *);
76 extern ktrace_entry_t   *ktrace_next(ktrace_t *, ktrace_snap_t *);
77 extern ktrace_entry_t   *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
78
79 #else
80 #define ktrace_init(x)  do { } while (0)
81 #define ktrace_uninit() do { } while (0)
82 #endif  /* CONFIG_XFS_TRACE */
83
84 #endif  /* __XFS_SUPPORT_KTRACE_H__ */