This file is indexed.

/usr/include/eztrace_hook.h is in libeztrace-dev 1.0.6-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* -*- c-file-style: "GNU" -*- */
/*
 * Copyright (C) CNRS, INRIA, Universite Bordeaux 1, Telecom SudParis
 * See COPYING in top-level directory.
 */

#ifndef EZTRACE_HOOK_H
#define EZTRACE_HOOK_H

#include <stdint.h>
#include "eztrace.h"
#include "eztrace_list.h"

/* 
 * This file defines a hook mechanism that allow different modules
 * (ie. eztrace_convert_mpi, eztrace_convert_gomp, etc.) to add
 * information in EZTrace internal structures. This allows to add
 * specialized information (such as the current parallel section in
 * case OpenMP is being used) to any general purpose structure.
 */

struct ezt_hook_list_t;

typedef uint8_t ezt_hook_id_t;

struct ezt_hook_t {
  ezt_hook_id_t hook_id;
  void* data;
  struct ezt_hook_list_t* p_hook_list;
  struct ezt_list_token_t list_token;
};

struct ezt_hook_list_t {
  struct ezt_list_t hook_list;
};

/* initialize a hook list */
static inline void ezt_hook_list_init(struct ezt_hook_list_t *p_list);
/* free the hook structure. before calling this function, make sure all
 * the data pointers have been freed.
 */
static inline void ezt_hook_list_free(struct ezt_hook_list_t *p_list);
/* add a new hook to the list. */
static inline void ezt_hook_list_add(struct ezt_hook_list_t *p_list,
                                     void*p_data, ezt_hook_id_t hook_id);
/* remove a hook from the list. Return 0 if the hook cannot be found in the list */
static inline int ezt_hook_list_remove(struct ezt_hook_list_t *p_list,
                                       ezt_hook_id_t hook_id);
/* retrive the data corresponding to a hook id or NULL if the hook is not in the list */
static inline void* ezt_hook_list_retrieve_data(
    struct ezt_hook_list_t *p_hook_list, ezt_hook_id_t hook_id);

/* initialize a hook list */
static inline void ezt_hook_list_init(struct ezt_hook_list_t *p_list) {
  ezt_list_new(&p_list->hook_list);
}

/* free the hook structure. before calling this function, make sure all
 * the data pointers have been freed.
 */
static inline void ezt_hook_list_free(struct ezt_hook_list_t *p_list) {
  struct ezt_list_token_t *p_token, *temp;

  ezt_list_foreach_safe(&p_list->hook_list, p_token, temp)
  {
    struct ezt_hook_t *p_hook =
      ezt_container_of(p_token, struct ezt_hook_t, list_token);
    ezt_list_remove(&p_hook->list_token);
    if (p_hook->data)
      free(p_hook->data);
    free(p_hook);
  }
}

/* add a new hook to the list. */
static inline void ezt_hook_list_add(struct ezt_hook_list_t *p_list,
                                     void*p_data, ezt_hook_id_t hook_id) {

#if DEBUG
  if( ezt_hook_list_retrieve_data(p_list, hook_id)) {
    fprintf(stderr, "Trying to add a hook (id %d) in a list that already contains it\n", hook_id);
    abort();
  }
#endif	/* DEBUG */

  struct ezt_hook_t *p_hook = (struct ezt_hook_t*) malloc(
      sizeof(struct ezt_hook_t));
  p_hook->hook_id = hook_id;
  p_hook->p_hook_list = p_list;
  p_hook->data = p_data;
  ezt_list_add(&p_list->hook_list, &p_hook->list_token);
  return;
}

/* remove a hook from the list. Return 0 if the hook cannot be found in the list */
static inline int ezt_hook_list_remove(struct ezt_hook_list_t *p_list,
                                       ezt_hook_id_t hook_id) {
  struct ezt_list_token_t *p_token, *temp;
  ezt_list_foreach_safe(&p_list->hook_list, p_token, temp)
  {
    struct ezt_hook_t *p_hook =
      ezt_container_of(p_token, struct ezt_hook_t, list_token);
    if (p_hook->hook_id == hook_id) {
      ezt_list_remove(&p_hook->list_token);
      free(p_hook);
      return 1;
    }
  }
  return 0;
}

/* retrive the data corresponding to a hook id or NULL if the hook is not in the list */
static inline void* ezt_hook_list_retrieve_data(struct ezt_hook_list_t *p_list,
                                                ezt_hook_id_t hook_id) {
  int i = 0;
  struct ezt_list_token_t *p_token;
  ezt_list_foreach(&p_list->hook_list, p_token)
  {
    i++;
    struct ezt_hook_t *p_hook =
      ezt_container_of(p_token, struct ezt_hook_t, list_token);
    if (p_hook->hook_id == hook_id)
      return p_hook->data;
  }
  return NULL;
}

#endif	/* EZTRACE_HOOK_H */