nommu: struct vm_region's vm_usage count need not be atomic
[safe/jmp/linux-2.6] / include / linux / hw_breakpoint.h
index 5da472e..41235c9 100644 (file)
@@ -20,13 +20,19 @@ enum {
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 
-/* As it's for in-kernel or ptrace use, we want it to be pinned */
-#define DEFINE_BREAKPOINT_ATTR(name)   \
-struct perf_event_attr name = {                \
-       .type = PERF_TYPE_BREAKPOINT,   \
-       .size = sizeof(name),           \
-       .pinned = 1,                    \
-};
+static inline void hw_breakpoint_init(struct perf_event_attr *attr)
+{
+       memset(attr, 0, sizeof(*attr));
+
+       attr->type = PERF_TYPE_BREAKPOINT;
+       attr->size = sizeof(*attr);
+       /*
+        * As it's for in-kernel or ptrace use, we want it to be pinned
+        * and to call its callback every hits.
+        */
+       attr->pinned = 1;
+       attr->sample_period = 1;
+}
 
 static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
 {
@@ -45,33 +51,24 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
 
 extern struct perf_event *
 register_user_hw_breakpoint(struct perf_event_attr *attr,
-                           perf_callback_t triggered,
+                           perf_overflow_handler_t triggered,
                            struct task_struct *tsk);
 
 /* FIXME: only change from the attr, and don't unregister */
-extern struct perf_event *
-modify_user_hw_breakpoint(struct perf_event *bp,
-                         struct perf_event_attr *attr,
-                         perf_callback_t triggered,
-                         struct task_struct *tsk);
+extern int
+modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
 
 /*
  * Kernel breakpoints are not associated with any particular thread.
  */
 extern struct perf_event *
-register_wide_hw_breakpoint_cpu(unsigned long addr,
-                               int len,
-                               int type,
-                               perf_callback_t triggered,
-                               int cpu,
-                               bool active);
+register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
+                               perf_overflow_handler_t triggered,
+                               int cpu);
 
 extern struct perf_event **
-register_wide_hw_breakpoint(unsigned long addr,
-                           int len,
-                           int type,
-                           perf_callback_t triggered,
-                           bool active);
+register_wide_hw_breakpoint(struct perf_event_attr *attr,
+                           perf_overflow_handler_t triggered);
 
 extern int register_perf_hw_breakpoint(struct perf_event *bp);
 extern int __register_perf_hw_breakpoint(struct perf_event *bp);
@@ -92,26 +89,18 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
 
 static inline struct perf_event *
 register_user_hw_breakpoint(struct perf_event_attr *attr,
-                           perf_callback_t triggered,
+                           perf_overflow_handler_t triggered,
                            struct task_struct *tsk)    { return NULL; }
-static inline struct perf_event *
+static inline int
 modify_user_hw_breakpoint(struct perf_event *bp,
-                         struct perf_event_attr *attr,
-                         perf_callback_t triggered,
-                         struct task_struct *tsk)      { return NULL; }
+                         struct perf_event_attr *attr) { return -ENOSYS; }
 static inline struct perf_event *
-register_wide_hw_breakpoint_cpu(unsigned long addr,
-                               int len,
-                               int type,
-                               perf_callback_t triggered,
-                               int cpu,
-                               bool active)            { return NULL; }
+register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
+                               perf_overflow_handler_t  triggered,
+                               int cpu)                { return NULL; }
 static inline struct perf_event **
-register_wide_hw_breakpoint(unsigned long addr,
-                           int len,
-                           int type,
-                           perf_callback_t triggered,
-                           bool active)                { return NULL; }
+register_wide_hw_breakpoint(struct perf_event_attr *attr,
+                           perf_overflow_handler_t triggered)  { return NULL; }
 static inline int
 register_perf_hw_breakpoint(struct perf_event *bp)     { return -ENOSYS; }
 static inline int