/* Add an entry to the event buffer. When we get near to the end we wake up the process sleeping on the read() of the file. To protect the event_buffer this function may only be called when buffer_mutex is set.  */
void add_event_entry(unsigned long value)
/* Add an entry to the event buffer. When we get near to the end we wake up the process sleeping on the read() of the file. To protect the event_buffer this function may only be called when buffer_mutex is set.  */
void add_event_entry(unsigned long value)
{
	if (!event_buffer) {
		WARN_ON_ONCE(1);
		return;
	}
	if (buffer_pos == buffer_size) {
		atomic_inc(&oprofile_stats.event_lost_overflow);
		return;
	}
	event_buffer[buffer_pos] = value;
	if (++buffer_pos == buffer_size - buffer_watershed) {
		atomic_set(&buffer_ready, 1);
		wake_up(&buffer_wait);
	}
}