Re: [PATCH v2 01/10] trace-cmd library: New API for allocating an output handler

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

 



On Thu, 11 Nov 2021 17:03:12 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> +/**
> + * tracecmd_output_allocate - allocate new output handler to a trace file
> + * @handle: file descriptor to an empty file, it can be -1 if the handler
> + *	    will not write to a file

Nit, but technically, the parameter description should fit on one line.
If more needs to be said about it, it can be done in the description,
where every reference of the name has the "@" attached to it.

I only mentioned this because I noticed it in a few places already.

-- Steve

> + *
> + * This API only allocates a handler and performs minimal initialization.
> + * No data is written in the file.
> + *
> + * Returns pointer to a newly allocated file descriptor, that can be used
> + * with other library APIs. In case of an error, NULL is returned. The returned
> + * handler must be freed with tracecmd_output_close() or tracecmd_output_free()
> + */
> +struct tracecmd_output *tracecmd_output_allocate(int fd)
> +{
> +	struct tracecmd_output *handle;
> +
> +	handle = calloc(1, sizeof(*handle));
> +	if (!handle)
> +		return NULL;
> +
> +	handle->fd = fd;
> +
> +	handle->file_version = FILE_VERSION;
> +
> +	handle->page_size = getpagesize();
> +	handle->big_endian = tracecmd_host_bigendian();
> +
> +	list_head_init(&handle->options);
> +
> +	handle->file_state = TRACECMD_FILE_ALLOCATED;
> +
> +	return handle;
> +}
> +
> +
>  static int select_file_version(struct tracecmd_output *handle,
>  				struct tracecmd_input *ihandle)
>  {




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

  Powered by Linux