Messages in this thread |  | | Date | Fri, 5 Feb 2021 00:47:58 +0000 | From | Chris Down <> | Subject | Re: [PATCH] printk: Userspace format enumeration support |
| |
Some improvements I noticed that I'll include when sending v2.
Chris Down writes: >+static void remove_printk_fmt_sec(const struct module *mod) >+{ >+ struct printk_fmt_sec *tmp = NULL, *ps = NULL; >+ const char **fptr = NULL;
fptr can be scoped to list_for_each_entry_safe, I'll move it.
>+static int proc_pf_show(struct seq_file *s, void *v) >+{ >+ const struct printk_fmt_sec *ps = NULL; >+ const char **fptr = NULL;
Ditto for list_for_each_entry.
>+ >+ mutex_lock(&printk_fmts_mutex); >+ >+ list_for_each_entry(ps, &printk_fmts_list, list) { >+ const char *mod_name = ps_get_module_name(ps); >+ >+ for (fptr = ps->start; fptr < ps->end; fptr++) { >+ seq_puts(s, mod_name); >+ seq_putc(s, ','); >+ seq_puts(s, *fptr); >+ seq_putc(s, '\0'); >+ } >+ }
Not sure why I didn't just use seq_printf here. I'll do that.
I'll wait a few days for feedback then will send v2 either way. :-)
|  |