Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4961611imm; Tue, 31 Jul 2018 03:14:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcgNFGYACMhmIbxsgIeloXmKLDK+UvjdXc/uSwwL5tFECMb6HKZY7r1s846DD28L1mLXuXw X-Received: by 2002:a62:d1b:: with SMTP id v27-v6mr21876947pfi.87.1533032043256; Tue, 31 Jul 2018 03:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533032043; cv=none; d=google.com; s=arc-20160816; b=TwJVlH+JxvKnXxCBSCITZeqFNPUDEAWqxYAWWYigxERBk2yGuvJjg82xGt8DMgANIL jzd0lBZnVGMPSVpwJXsvzrRgJCrEzBCQV9EI9MA8Cz1Fvs9WSdOFdoTe/M+um9shgTjQ Ybx60VvOnftxg/FvMX+9l1SXWKmmfFZ3ZDaNrVXqzXfMEjvQhgSamHzJPAFj8dEgmhf5 ULCyc2Ot+iHZKeTtHtsdWv1M5EGKlZhz+Vym6orGta2ufjmN9mhquU14LUQxwCwz0uYg UCiGHudXNBp0BN+rk8hFVefO3nZ/uZL6UQCMWGd+pgVAMTAzoJHocMX+WWYbUF9fyS2f e6dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:arc-authentication-results; bh=nW96cQxGOIvIgv9MXOg3x8u1lXeZUdpsDneppufxoNs=; b=XDBZQtXwSdCaYey3eI3Ri6ZkFH0w6F/6JZc/dEx8ZVY6qClpgB8Ocns4tS6GEcsW30 5GUyOY/MR9aCKRuhJEPIhYH8bwGpXKxHcE9DTXSZ4sc+VgUudCU+SC5tt4VCfaPTNhQM GBmOLJwUTSwE41rlRbei7F0i86LiQwi725YI1M/LTAyKQmcod3T2pqHn9FEKXZ2X0u/s 4Kt56A+YOLG1VatT8bqr6MvOXxSgLHF3VUwrhvmepUjajq42Xe59ulB86Wg0E8FFlWnQ rx8RH3V767cxbh+AM5N5jTATdz/5l1KISRxUbuiIHb79VkmRMu1CjrLQF0g6Nr6d2Bkb OTqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c16-v6si13767840pfj.333.2018.07.31.03.13.48; Tue, 31 Jul 2018 03:14:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731511AbeGaLvc convert rfc822-to-8bit (ORCPT + 99 others); Tue, 31 Jul 2018 07:51:32 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727409AbeGaLvc (ORCPT ); Tue, 31 Jul 2018 07:51:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD7E97C6A9; Tue, 31 Jul 2018 10:11:55 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-116.rdu2.redhat.com [10.10.120.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64048111AF3D; Tue, 31 Jul 2018 10:11:54 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20180731094021.GC9836@amd> References: <20180731094021.GC9836@amd> <25489.1532953411@warthog.procyon.org.uk> <20180730143104.GB24051@amd> <20180730180842.GA5544@bombadil.infradead.org> <20180730183847.GB5544@bombadil.infradead.org> <20180730194938.GA12962@bombadil.infradead.org> <20180730210209.GY21725@thunk.org> <20180730235849.GA19692@bombadil.infradead.org> <20180731005802.GB21725@thunk.org> To: Pavel Machek Cc: dhowells@redhat.com, "Theodore Y. Ts'o" , Matthew Wilcox , Linus Torvalds , Al Viro , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 36/38] vfs: Add a sample program for the new mount API [ver #10] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18973.1533031913.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Tue, 31 Jul 2018 11:11:53 +0100 Message-ID: <18974.1533031913@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 31 Jul 2018 10:11:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 31 Jul 2018 10:11:55 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Machek wrote: > Proposal is "message %s foo %s\0param 1\0param2\0", only strings > allowed. I think that's too strict and you will need to allow integer values, IP addresses and possibly other things also. It could certainly have a limited set (e.g. no kernel pointers). You also haven't proposed what you think the internal interface should look like. > That's simple enough, yet allows translations. Yes and no. From the point of view of translating it, yes, it's easier, but from the point of view of actually writing these things in the kernel, it's not. So, currently, I have, say: cg_invalf(fc, "option or name mismatch, new: 0x%x \"%s\", old: 0x%x \"%s\"", ...); Now I can split that to separate out the option change error from the option change error: cg_invalf(fc, "Name mismatch, new: \"%s\", old: \"%s\"", ...); cg_invalf(fc, "Option mismatch, new: 0x%x, old: 0x%x", ...); but we still need to communicate to the logging function how many arguments we're actually passing. Now, I wouldn't consider this a fast-path, so actually counting the arguments encoded in the format string is probably fine - otherwise we have to actually pass the number of arguments in, e.g.: cg_invalf(fc, "Option mismatch, new: 0x%x, old: 0x%x", 2, ...); and then the kernel has to render the whole lot into Another example, in ext4 we have: printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d", so we could do something like: infof(fc, "EXT4-fs (%s): last error at time %u: %.*s:%d", ...); on mount. But the use of "%.*s" is a pain for your interface. We can't pass qualifiers like "*" to userspace, so either the caller would have to copy the string first or the logging routines would have to edit the format string. Though I suppose we could leave the editing to userspace. David