Re: [PATCH] libtracefs: An API to set the filtering of functions

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

 



On Wed, 3 Mar 2021 06:46:26 +0530
Sameeruddin Shaik <sameeruddin.shaik8@xxxxxxxxx> wrote:

> what if we store the indices of the failed filters in an integer array
> and return them back?

There's not much difference if we return an array of pointers to the
filters or an array of integers to the index. I was just thinking about
how I would use the interface. When having a working interface, we
should write a few robust programs to see how easy it is to use, and
that will help in making the API appropriate. This needs to be done
*before* we accept it. This particular API is going to be widely used,
and it needs to be simple and robust.

> let's return the number of bytes written, also we will calculate the
> complete filters length and return it, if there is difference,
> we will loop into the integer array and print the erroneous filters

Not sure how that is helpful. How would you use the number of bytes
written?

> 
> Let's fix the number of parameters to this function:)

Not sure what you mean by that.


Here's how I envision this interface.

	char **errs;
	char *filters[] = {
		"sched*", "spin_*", NULL
	};
	int ret;


	ret = tracefs_function_filter(NULL, filters, NULL, &errs);
	if (ret < 0) {
		int i;

		printf("Failed to apply: ");
		for (i = 0; errs[i]; i++) {
			if (i)
				printf(", ");
			printf("'%s'", errs[i]);
		}
		printf("\n";
		exit(ret);
	}

-- Steve



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

  Powered by Linux