Re: [PATCH] proc: Use str_yes_no() helper in proc_pid_ksm_stat()

From: Al Viro
Date: Wed Feb 12 2025 - 07:05:16 EST


On Wed, Feb 12, 2025 at 12:59:52PM +0100, Thorsten Blum wrote:
> Remove hard-coded strings by using the str_yes_no() helper function.

> seq_printf(m, "ksm_merge_any: %s\n",
> - test_bit(MMF_VM_MERGE_ANY, &mm->flags) ? "yes" : "no");
> + str_yes_no(test_bit(MMF_VM_MERGE_ANY, &mm->flags)));
> ret = mmap_read_lock_killable(mm);
> if (ret) {
> mmput(mm);
> return ret;
> }
> seq_printf(m, "ksm_mergeable: %s\n",
> - ksm_process_mergeable(mm) ? "yes" : "no");
> + str_yes_no(ksm_process_mergeable(mm)));

Is that any more readable? If anything, that might be better off with something
like a printf modifier...