Re: [LTP] [PATCH] libs: adopt lib* prefix instead of tst_* for libs/

Jan Stancek via ltp
2026-01-13T13:30:55Z

On Tue, Jan 13, 2026 at 12:51 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> > Hi Andrea, All,
>
> > On Mon, Jan 12, 2026 at 8:59 PM Andrea Cervesato <andrea.cervesato@suse.com>
> > wrote:
>
> > > Hi!
>
> > > I generally agree with this approach, but I have the feeling we are
> > > mixing naming a bit here. For instance, we have headers like ipcmsg.h
> > > that has no functions starting with tst_*, while tst_numa.h does. Also,
> > > the tst_* prefix for files has the clear goal to state we are importing
> > > some LTP functionalities inside the tests code.
>
> > > Said so, I would rather rename all LTP libraries as tst_*.h and to
> > > rename functions inside them with tst_* prefix. In this way, we know
> > > at the very first look, when a library is imported from LTP and not
> > > from other sources.
>
> 'tst_' prefix is only for *new* C API. That's why ipcmsg.h/libs/ipc/libipc.c
> don't use it. I would prefer to keep that way (not use 'tst_' for legacy C API
> library source).
>
> That's why I quite like Li's approach (I'm ok if libs/ sources' headers will
> have 'lib' prefix instead of 'tst_'), although I liked more
> libs/sigwait/sigwait.c than libs/sigwait/libsigwait.c.
>
> > I indeed thought about all use tst_* for those global header files.
> > But to distinguish lib/ with libs/ I finally feel that libs/ is not the
> > core LTP API
> > and sometimes built only when they are needed, if we rename all these
> > header file with tst_* that will mislead people to find the *.c file in
> > lib/, which
> > is not the right place.
>
> > So in my patch, keep define tst_* only for the core LTP API, and lib* prefix
> > reserve for libs/ that will be clear at a glance.
>
> +1
>
> > Or, if go with tst_*.h for all (and rename functions with tst_*), I think
> > the libs/ should be merged into lib/.
>
> I don't think this would be good. It would require also changing a build system,
> touch too many files. And I don't even see a benefit for a such change.

I'd keep them separate from core library. For non-core libraries, I'd go with
something more distinct, like "ltp" prefix for file and function names.

When I look at "libnuma.h" I'd have to think for a bit if this is
header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core
nor numa-devel.

my 2 cents,
Jan

>
> Kind regards,
> Petr
>
> > @Cyril, Petr, any comments?
>
> I also wonder Cyril's and Jan's opinion.
>
> Kind regards,
> Petr