Re: [PATCH 1/6] lsmem: display global memmap on memory parameter

Sumanth Korikkar <[email protected]> Thu, 16 Oct 2025 14:02:31 +0200
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
> > +static int get_memmap_mode(char *res, char *src, int len)
> > +{
> > +	if (!strncmp(src, "Y", 1))
> > +		strncpy(res, "yes", len);
> > +	else if (!strncmp(src, "N", 1))
> > +		strncpy(res, "no", len);
> > +	else if (!strncmp(src, "force", 5))
> > +		strncpy(res, "force", len);
> > +	else
> > +		return -1;
> > +	return 0;
> 
> In other places, we translate these strings, so it should be
> N_("yes"), etc, and use _() in the final printf().

Hi Karal,

Sure. I'll add it.

> 
> > +}
> > +
> >  static void print_summary(struct lsmem *lsmem)
> >  {
> > +	const char *path = "/sys/module/memory_hotplug/parameters/memmap_on_memory";
> 
> We rarely use hardcoded paths directly in code in util-linux. How
> about adding #define _PATH_SYS_MEMMAP_PARM or something similar.

Noted. Thank you.