/* write() implementation for reset file. Reset all profiling data to zero and remove ghost nodes.  */
static ssize_t reset_write(struct file *file, const char __user *addr, size_t len, loff_t *pos)
/* write() implementation for reset file. Reset all profiling data to zero and remove ghost nodes.  */
static ssize_t reset_write(struct file *file, const char __user *addr, size_t len, loff_t *pos)
{
	struct gcov_node *node;
	mutex_lock(&node_lock);
restart:
	list_for_each_entry(node, &all_head, all) {
		if (node->info)
			gcov_info_reset(node->info);
		else if (list_empty(&node->children)) {
			remove_node(node);
			goto restart;
		}
	}
	mutex_unlock(&node_lock);
	return len;
}