Re: [PATCH 4/6] libtracefs: Combine allocate and create APIs into one

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

 



Hi Tzvetomir,


On Thu,  5 Nov 2020 11:33:52 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> @@ -59,24 +59,38 @@ void tracefs_instance_free(struct tracefs_instance *instance)
>  
>  /**
>   * tracefs_instance_create - Create a new ftrace instance
> - * @instance: Pointer to the instance to be created
> + * @name: Name of the instance to be created
> + * @instance: Return, pointer to a newly allocated instance
>   *
>   * Returns 1 if the instance already exist, 0 if the instance
> - * is created successful or -1 in case of an error
> + * is created successful or -1 in case of an error.
> + * If 1 or 0 is returned, @instance points to anewly allocated instance
> + * which must be freed by tracefs_instance_free()
>   */
> -int tracefs_instance_create(struct tracefs_instance *instance)
> +int tracefs_instance_create(const char *name, struct tracefs_instance **instance)

I think it makes more sense if we just return the allocated instance.
The return would be the allocated instance or NULL on failure.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux