ktrace.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. * Trace buffer entry structure.
  22. */
  23. typedef struct ktrace_entry {
  24. void *val[16];
  25. } ktrace_entry_t;
  26. /*
  27. * Trace buffer header structure.
  28. */
  29. typedef struct ktrace {
  30. int kt_nentries; /* number of entries in trace buf */
  31. atomic_t kt_index; /* current index in entries */
  32. unsigned int kt_index_mask;
  33. int kt_rollover;
  34. ktrace_entry_t *kt_entries; /* buffer of entries */
  35. } ktrace_t;
  36. /*
  37. * Trace buffer snapshot structure.
  38. */
  39. typedef struct ktrace_snap {
  40. int ks_start; /* kt_index at time of snap */
  41. int ks_index; /* current index */
  42. } ktrace_snap_t;
  43. #ifdef CONFIG_XFS_TRACE
  44. extern void ktrace_init(int zentries);
  45. extern void ktrace_uninit(void);
  46. extern ktrace_t *ktrace_alloc(int, unsigned int __nocast);
  47. extern void ktrace_free(ktrace_t *);
  48. extern void ktrace_enter(
  49. ktrace_t *,
  50. void *,
  51. void *,
  52. void *,
  53. void *,
  54. void *,
  55. void *,
  56. void *,
  57. void *,
  58. void *,
  59. void *,
  60. void *,
  61. void *,
  62. void *,
  63. void *,
  64. void *,
  65. void *);
  66. extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *);
  67. extern int ktrace_nentries(ktrace_t *);
  68. extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_t *);
  69. extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
  70. #else
  71. #define ktrace_init(x) do { } while (0)
  72. #define ktrace_uninit() do { } while (0)
  73. #endif /* CONFIG_XFS_TRACE */
  74. #endif /* __XFS_SUPPORT_KTRACE_H__ */