sure tzvetomir. On Thu, Mar 4, 2021 at 2:29 PM Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote: > > On Thu, Mar 4, 2021 at 9:24 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > > > 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. > > One remark, not directly related to this discussion. When the implementation > of the API is ready, there should be a unit test (in a separate patch) - as for > any of the other APIs. Usually these are the first use cases that I write for > the new APIs. > Sameer, please look at utest directory where the unit tests are, each API has > a unit test there. We use the cunit framework, ask if there are questions about > it. This should be the next step, when the final version of the > implementation is > ready. > Thanks! > > > > > > 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 > > > > -- > Tzvetomir (Ceco) Stoyanov > VMware Open Source Technology Center