Home | History | Annotate | Download | only in gcov-src
      1 /* Header file for libgcov-*.c.
      2    Copyright (C) 1996-2014 Free Software Foundation, Inc.
      3 
      4    This file is part of GCC.
      5 
      6    GCC is free software; you can redistribute it and/or modify it under
      7    the terms of the GNU General Public License as published by the Free
      8    Software Foundation; either version 3, or (at your option) any later
      9    version.
     10 
     11    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     12    WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14    for more details.
     15 
     16    Under Section 7 of GPL version 3, you are granted additional
     17    permissions described in the GCC Runtime Library Exception, version
     18    3.1, as published by the Free Software Foundation.
     19 
     20    You should have received a copy of the GNU General Public License and
     21    a copy of the GCC Runtime Library Exception along with this program;
     22    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     23    <http://www.gnu.org/licenses/>.  */
     24 
     25 #ifndef GCC_LIBGCOV_KERNEL_H
     26 #define GCC_LIBGCOV_KERNEL_H
     27 
     28 /* work around the poisoned malloc/calloc in system.h.  */
     29 #ifndef xmalloc
     30 #define xmalloc vmalloc
     31 #endif
     32 #ifndef xcalloc
     33 #define xcalloc vcalloc
     34 #endif
     35 #ifndef xrealloc
     36 #define xrealloc vrealloc
     37 #endif
     38 #ifndef xfree
     39 #define xfree vfree
     40 #endif
     41 #ifndef alloca
     42 #define alloca __builtin_alloca
     43 #endif
     44 
     45 #ifndef SEEK_SET
     46 #define SEEK_SET 0
     47 #endif
     48 
     49  /* Define MACROs to be used by kernel compilation.  */
     50 # define L_gcov
     51 # define L_gcov_interval_profiler
     52 # define L_gcov_pow2_profiler
     53 # define L_gcov_one_value_profiler
     54 # define L_gcov_indirect_call_profiler_v2
     55 # define L_gcov_direct_call_profiler
     56 # define L_gcov_indirect_call_profiler
     57 # define L_gcov_indirect_call_topn_profiler
     58 # define L_gcov_time_profiler
     59 # define L_gcov_average_profiler
     60 # define L_gcov_ior_profiler
     61 # define L_gcov_merge_add
     62 # define L_gcov_merge_single
     63 # define L_gcov_merge_delta
     64 # define L_gcov_merge_ior
     65 # define L_gcov_merge_time_profile
     66 # define L_gcov_merge_icall_topn
     67 # define L_gcov_merge_dc
     68 
     69 # define IN_LIBGCOV 1
     70 # define IN_GCOV 0
     71 #define THREAD_PREFIX
     72 #define GCOV_LINKAGE /* nothing */
     73 #define BITS_PER_UNIT 8
     74 #define LONG_LONG_TYPE_SIZE 64
     75 #define MEMMODEL_RELAXED 0
     76 
     77 #define ENABLE_ASSERT_CHECKING 1
     78 
     79 /* gcc_assert() prints out a warning if the check fails. It
     80    will not abort.  */
     81 #if ENABLE_ASSERT_CHECKING
     82 # define gcc_assert(EXPR) \
     83     ((void)(!(EXPR) ? printk (KERN_WARNING \
     84       "GCOV assertion fails: func=%s line=%d\n", \
     85       __FUNCTION__, __LINE__), 0 : 0))
     86 #else
     87 # define gcc_assert(EXPR) ((void)(0 && (EXPR)))
     88 #endif
     89 
     90 /* In Linux kernel mode, a virtual file is used for file operations.  */
     91 struct gcov_info;
     92 typedef struct {
     93   long size; /* size of buf */
     94   long count; /* element written into buf */
     95   struct gcov_info *info;
     96   char *buf;
     97 } gcov_kernel_vfile;
     98 
     99 #define _GCOV_FILE gcov_kernel_vfile
    100 
    101 /* Wrappers to the file operations.  */
    102 #define _GCOV_fclose     kernel_file_fclose
    103 #define _GCOV_ftell      kernel_file_ftell
    104 #define _GCOV_fseek      kernel_file_fseek
    105 #define _GCOV_ftruncate  kernel_file_ftruncate
    106 #define _GCOV_fread      kernel_file_fread
    107 #define _GCOV_fwrite     kernel_file_fwrite
    108 #define _GCOV_fileno     kernel_file_fileno
    109 
    110 /* Declarations for virtual files operations.  */
    111 extern int kernel_file_fclose (gcov_kernel_vfile *);
    112 extern long kernel_file_ftell (gcov_kernel_vfile *);
    113 extern int kernel_file_fseek (gcov_kernel_vfile *, long, int);
    114 extern int kernel_file_ftruncate (gcov_kernel_vfile *, off_t);
    115 extern int kernel_file_fread (void *, size_t, size_t,
    116     gcov_kernel_vfile *);
    117 extern int kernel_file_fwrite (const void *, size_t, size_t,
    118     gcov_kernel_vfile *);
    119 extern int kernel_file_fileno (gcov_kernel_vfile *);
    120 
    121 #endif /* GCC_LIBGCOV_KERNEL_H */
    122