~ubuntu-branches/ubuntu/precise/open-vm-tools/precise

« back to all changes in this revision

Viewing changes to lib/include/stats_user_defs.h

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************
2
 
 * Copyright (C) 1998 VMware, Inc. All rights reserved.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License as published
6
 
 * by the Free Software Foundation version 2.1 and no later version.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
11
 
 * License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program; if not, write to the Free Software Foundation, Inc.,
15
 
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
16
 
 *
17
 
 *********************************************************/
18
 
 
19
 
/*
20
 
 * stats_user_defs.h --
21
 
 *
22
 
 *      Defines for user statcounters.  This started life as a clone of
23
 
 *      stats_defs.h, which is too monitor entangled to easily work outside
24
 
 *      of vmx code (e.g. in lib).
25
 
 */
26
 
 
27
 
#ifndef STATS_USER_DEFS_H
28
 
#define STATS_USER_DEFS_H
29
 
 
30
 
#define INCLUDE_ALLOW_MODULE
31
 
#define INCLUDE_ALLOW_USERLEVEL
32
 
#define INCLUDE_ALLOW_VMCORE
33
 
#include "includeCheck.h"
34
 
 
35
 
#ifndef STATS_MODULE
36
 
#error "stats_user_defs.h must be included with STATS_MODULE defined"
37
 
#endif
38
 
 
39
 
#define EXTERN_STAT_DECL(_name, _desc)
40
 
#define STAT_DECL(_name, _desc)
41
 
 
42
 
#define STATS_USER_MODULE_STR  XSTR(XCONC(STATS_, STATS_MODULE))
43
 
#define STATS_USER_NAME(name)  XCONC(STAT_, XCONC(STATS_MODULE, _##name))
44
 
#define STATS_USER_BLKVAR      XCONC(_stats_, XCONC(STATS_MODULE, _Blk))
45
 
#define STATS_USER_LOG_FN(name)XCONC(name, _StatsLog)
46
 
#define STATS_USER_INST_NAME(name) \
47
 
        XCONC(STATINST_, XCONC(STATS_MODULE, _##name))
48
 
#define STATS_USER_INIT_INST_FN(name)   XCONC(name, _InitInstance)
49
 
#define STATS_USER_GETVAL_FN(name) XCONC(name, _StatsGetVal)
50
 
 
51
 
typedef struct StatsUserEntry {
52
 
   uint32 count;
53
 
} StatsUserEntry;
54
 
 
55
 
typedef struct StatsUserBlock {
56
 
   const char *name;
57
 
   uint32 size;
58
 
   StatsUserEntry *counters;
59
 
   struct StatsUserBlock *next;
60
 
} StatsUserBlock;
61
 
 
62
 
EXTERN StatsUserBlock STATS_USER_BLKVAR;
63
 
 
64
 
#ifndef STATS_SKIP_ACCESSORS
65
 
#define STATS_IS_INITIALIZED()     (STATS_USER_BLKVAR.counters != NULL)
66
 
#define STAT_GET(stat) \
67
 
        (&(STATS_USER_BLKVAR.counters[STATS_USER_NAME(stat)]))
68
 
#define STAT_INST_GET(inst, stat) \
69
 
        (&((inst)->counters[STATS_USER_INST_NAME(stat)]))
70
 
 
71
 
#define STAT_SAMPLE(stat)          STAT_GET(stat)->count++
72
 
#ifdef VMX86_STATS
73
 
#  define STAT_INC(stat)          STAT_GET(stat)->count++
74
 
#  define STAT_INC_BY(stat,inc)   STAT_GET(stat)->count += (inc)
75
 
#  define STAT_DEC_BY(stat,inc)   STAT_GET(stat)->count -= (inc)
76
 
#  define STAT_DEBUG_INC(stat)    DEBUG_ONLY(STAT_INC(stat))
77
 
#  define STAT_INST_INC(i,s)          STAT_INST_GET((i), s)->count++
78
 
#  define STAT_INST_INC_BY(i,s,inc)   STAT_INST_GET((i), s)->count += (inc)
79
 
#  define STAT_INST_DEC_BY(i,s,inc)   STAT_INST_GET((i), s)->count -= (inc)
80
 
#  define STAT_INST_DEBUG_INC(i,s)    DEBUG_ONLY(STAT_INST_INC((i), s))
81
 
#else
82
 
#  define STAT_INC(stat)
83
 
#  define STAT_INC_BY(stat,inc)
84
 
#  define STAT_DEC_BY(stat,inc)
85
 
#  define STAT_DEBUG_INC(stat)
86
 
#  define STAT_INST_INC(inst,stat)
87
 
#  define STAT_INST_INC_BY(inst,stat,inc)
88
 
#  define STAT_INST_DEC_BY(inst,stat,inc)
89
 
#  define STAT_INST_DEBUG_INC(stat)
90
 
#endif
91
 
#endif /* STATS_SKIP_ACCESSORS */
92
 
#endif /* STATS_DEFS_H */