Re: [PATCH v2] trace-cmd: libtracecmd: Rename private functions to fix static building

Metin Kaya <[email protected]> Mon, 25 Nov 2024 11:50:16 +0000
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
On 22/11/2024 9:49 pm, Steven Rostedt wrote:
> On Tue, 19 Nov 2024 15:33:00 +0000
> Metin Kaya <[email protected]> wrote:
> 
>> diff --git a/tracecmd/trace-agent.c b/tracecmd/trace-agent.c
>> index b6b44f58..6b8e40f4 100644
>> --- a/tracecmd/trace-agent.c
>> +++ b/tracecmd/trace-agent.c
>> @@ -32,11 +32,11 @@ static void make_vsocks(int nr, int *fds, unsigned int *ports)
>>   	int i, fd, ret;
>>   
>>   	for (i = 0; i < nr; i++) {
>> -		fd = trace_vsock_make_any();
>> +		fd = tcmd_vsock_make_any();
>>   		if (fd < 0)
>>   			die("Failed to open vsocket");
>>   
>> -		ret = trace_vsock_get_port(fd, &port);
>> +		ret = tcmd_vsock_get_port(fd, &port);
>>   		if (ret < 0)
>>   			die("Failed to get vsocket address");
>>   
>> @@ -199,8 +199,8 @@ static void agent_handle(int sd, int nr_cpus, int page_size,
>>   	if (ret < 0)
>>   		die("Failed to receive trace request");
>>   
> 
>> -	tsync_proto = tracecmd_tsync_get_proto(tsync_protos, get_clock(argc, argv),
>> -					       tsync_role);
>> +	tsync_proto = tcmd_tsync_get_proto(tsync_protos, get_clock(argc, argv),
>> +					   tsync_role);
> 
> I'm fine with this change in general, except for converting any function
> name that starts with "tracecmd_" that is in the tracecmd/ directory. Yes
> it's marked as hidden, but these are functions that are not quite ready to
> become API, but are planned to.
> 
> I used this as a general notation. If it starts with "tracecmd_" and marked
> as __hidden, it means that it is still a WIP API. If it is marked with
> "trace_" it is just a direct hook between trace-cmd and the libraries.
> 
> Care to send a v3?

Will do, but there is no function starts with "tracecmd_" defined under 
tracecmd/ directory. Should it be lib/trace-cmd/ instead?
IOW, I should *not* rename the functions below. Correct?
- tracecmd_copy_trace_data()
- tracecmd_filter_free()
- tracecmd_filter_get()
- tracecmd_filter_match()
- tracecmd_filter_set()
- tracecmd_tsync_get_proto()

Thanks,

> 
> Thanks,
> 
> -- Steve
> 
> 
>>   
>>   	if (use_fifos && open_agent_fifos(nr_cpus, fds))
>>   		use_fifos = false;
>> @@ -223,9 +223,9 @@ static void agent_handle(int sd, int nr_cpus, int page_size,
>>   				remote_id = -1;
>>   				local_id = -2;
>>   			}
>> -			fd = trace_vsock_make_any();
>> +			fd = tcmd_vsock_make_any();
>>   			if (fd >= 0 &&
>> -			    trace_vsock_get_port(fd, &tsync_port) < 0) {
>> +			    tcmd_vsock_get_port(fd, &tsync_port) < 0) {
>>   				close(fd);
>>   				fd = -1;
>>   			}
>> @@ -327,13 +327,13 @@ static void agent_serve(unsigned int port, bool do_daemon, int proxy_id,
>>   		if (listen(sd, 5) < 0)
>>   			die("Failed to listen on %d\n", port);
>>   	} else
>> -		sd = trace_vsock_make(port);
>> +		sd = tcmd_vsock_make(port);
>>   	if (sd < 0)
>>   		die("Failed to open socket");
>>   	tracecmd_tsync_init();
>>   
>>   	if (!network) {
>> -		cid = trace_vsock_local_cid();
>> +		cid = tcmd_vsock_local_cid();
>>   		if (cid >= 0)
>>   			printf("listening on @%u:%u\n", cid, port);
>>   	}