On Thu, Dec 19, 2019 at 11:29:51PM +0000, Al Viro wrote: > I wonder if we should do the following: > * structure with two members - pointer to fc_log and a string > (prefix) embedded into fs_context, in place of ->log. > * __logfc() taking pointer to that struct, integer or > character representing the "log level", then format and vararg part. > * warnf() being simply __logfc(&fc->log, 'w', fmt, ## __VA_ARGS__) > * __logfc() using "%c %s%s%pV", > loglevel, > prefix?prefix:"", > prefix ? ":" : "", > fmt, va > for kvasprintf() (assuming that %pV *can* be used with it, of course) > * const char *set_log_prefix(pointer, string) replacing the > prefix field of the struct and returning the original. fs_context > allocation would set it to fs_type->name. > * __fs_parse() would be taking a pointer to that field of > fs_context instead of the entire thing; ditto for fs_param_is_...() > * rbd would create a local structure with "rbd" for prefix > and NULL for log > * net/ceph would replace the prefix in the thing it has > been given with "libceph" and revert back to original in the end > > The most worrying part in that is kvasprintf interplay with %pV - > we might need to open-code it, since we need va_copy() not of that > sucker's arguments, but of the va_list one level deeper. We won't - va_format() itself does take a copy. So no open-coding is needed, kasprint() would work. OK, that simplifies things...