Re: [PATCH perf/core 01/11] uprobes: Add unique flag to uprobe consumer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/02, Jiri Olsa wrote:
>
> +static bool consumer_can_add(struct list_head *head, struct uprobe_consumer *uc)
> +{
> +	/* Uprobe has no consumer, we can add any. */
> +	if (list_empty(head))
> +		return true;
> +	/* Uprobe has consumer/s, we can't add unique one. */
> +	if (uc->is_unique)
> +		return false;
> +	/*
> +	 * Uprobe has consumer/s, we can add nother consumer only if the
> +	 * current consumer is not unique.
> +	 **/
> +	return !list_first_entry(head, struct uprobe_consumer, cons_node)->is_unique;
> +}

Since you are going to send V2 anyway... purely cosmetic and subjective nit,
but somehow I can't resist,

	bool consumer_can_add(struct list_head *head, struct uprobe_consumer *new)
	{
		struct uprobe_consumer *old = list_first_entry_or_null(...);

		return !old || (!old->exclusive && !new->exclusive);
	}

looks a bit more readable to me. Please ignore if you like your version more.

Oleg.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux