From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:47836 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729723AbeGaNsC (ORCPT ); Tue, 31 Jul 2018 09:48:02 -0400 Date: Tue, 31 Jul 2018 05:07:52 -0700 From: Matthew Wilcox To: Pavel Machek Cc: David Howells , "Theodore Y. Ts'o" , 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] Message-ID: <20180731120752.GA23378@bombadil.infradead.org> References: <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> <18974.1533031913@warthog.procyon.org.uk> <20180731113422.GA22939@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180731113422.GA22939@amd> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jul 31, 2018 at 01:34:22PM +0200, Pavel Machek wrote: > On Tue 2018-07-31 11:11:53, David Howells wrote: > > 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). > > I'd always use strings at kernel->user interface. Yes, we should > support integers and IP addresses in kernel, but I'd convert them to > strings before passing them to userspace. Then you haven't solved the translation problem at all; you've just made the in-kernel implementation harder. One example from the gettext docs: In Polish we use e.g. plik (file) this way: 1 plik 2,3,4 pliki 5-21 plik�w 22-24 pliki 25-31 plik�w Your proposal means that userspace needs to detect "%s file", determine if the corresponding string consists of ^[0-9]*$, then parse the string to figure out which of the plik* words is the correct one to use. In my preferred solution of just sending the damned english string, it's no more complex to regex match the string for "[0-9]* file", and choose the appropriate plik* translation.