From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F0AAC43603 for ; Fri, 20 Dec 2019 18:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 10B582082E for ; Fri, 20 Dec 2019 18:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727400AbfLTSON (ORCPT ); Fri, 20 Dec 2019 13:14:13 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:41502 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbfLTSON (ORCPT ); Fri, 20 Dec 2019 13:14:13 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiMmx-0003Dr-Gk; Fri, 20 Dec 2019 18:14:11 +0000 Date: Fri, 20 Dec 2019 18:14:11 +0000 From: Al Viro To: Eric Sandeen Cc: fsdevel , David Howells Subject: Re: [PATCH V2] fs_parser: remove fs_parameter_description name field Message-ID: <20191220181411.GA25833@ZenIV.linux.org.uk> References: <22be7526-d9da-5309-22a8-3405ed1c0842@sandeen.net> <20191218033606.GF4203@ZenIV.linux.org.uk> <20191218040651.GH4203@ZenIV.linux.org.uk> <20191219232951.GL4203@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191219232951.GL4203@ZenIV.linux.org.uk> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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...