[LTP] [PATCH v2] lib: Introduce tst_path.h to consolidate system paths

Petr Vorel pvorel@suse.cz
Fri May 15 17:32:50 CEST 2026


> Hi!
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (c) Linux Test Project, 2026
> > + * Copyright (c) 2026 Li Wang <li.wang@linux.dev>
> > + */
> > +
> > +#ifndef TST_PATH__
> > +#define TST_PATH__
> > +
> > +/* PROC */
> > +#define PROC_SYS_VM		"/proc/sys/vm/"
> > +#define PROC_SYS_FS		"/proc/sys/fs/"
> > +#define PROC_SYS_NET		"/proc/sys/net/"
> > +#define PROC_SYS_USER		"/proc/sys/user/"
> > +#define PROC_SYS_KERNEL		"/proc/sys/kernel/"
> > +/* SYS */
> > +#define SYS_KERNEL_MM		"/sys/kernel/mm/"

> I wonder if this is really better. The macro name is not shorter and the
> kernel path is not going to change since it's part of API.

IMHO it's not about kernel change but about user typos :).
I prefer constants (build failure in case of typo instead of wrong patch being
hidden for years).

I thought in the past about replacing tag keys ("linux-git", "glibc-git", ...)
with constants, but never implement it as I expected it'd be rejected as
useless.

Kind regards,
Petr


More information about the ltp mailing list