perf/core: Add PERF_SAMPLE_WEIGHT_STRUCT
[linux-2.6-microblaze.git] / kernel / events / core.c
index 55d1879..5206097 100644 (file)
@@ -1879,8 +1879,8 @@ static void __perf_event_header_size(struct perf_event *event, u64 sample_type)
        if (sample_type & PERF_SAMPLE_PERIOD)
                size += sizeof(data->period);
 
-       if (sample_type & PERF_SAMPLE_WEIGHT)
-               size += sizeof(data->weight);
+       if (sample_type & PERF_SAMPLE_WEIGHT_TYPE)
+               size += sizeof(data->weight.full);
 
        if (sample_type & PERF_SAMPLE_READ)
                size += event->read_size;
@@ -6907,8 +6907,8 @@ void perf_output_sample(struct perf_output_handle *handle,
                                          data->regs_user.regs);
        }
 
-       if (sample_type & PERF_SAMPLE_WEIGHT)
-               perf_output_put(handle, data->weight);
+       if (sample_type & PERF_SAMPLE_WEIGHT_TYPE)
+               perf_output_put(handle, data->weight.full);
 
        if (sample_type & PERF_SAMPLE_DATA_SRC)
                perf_output_put(handle, data->data_src.val);
@@ -11564,6 +11564,9 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
        if (attr->sample_type & PERF_SAMPLE_CGROUP)
                return -EINVAL;
 #endif
+       if ((attr->sample_type & PERF_SAMPLE_WEIGHT) &&
+           (attr->sample_type & PERF_SAMPLE_WEIGHT_STRUCT))
+               return -EINVAL;
 
 out:
        return ret;