Re: [PATCH 36/38] vfs: Add a sample program for the new mount API [ver #10]

Pavel Machek
2018-07-31T12:28:06Z

[-- Attachment #1: Type: text/plain, Size: 1903 bytes --]

On Tue 2018-07-31 05:07:52, Matthew Wilcox wrote:
> 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 <pavel@ucw.cz> 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.

Have you actually used computer set in slavic language? Receiving "5
soubor(u) zkopirovano" is still preferable to message in english.

> 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.

Regexes do not work in presence of arbitrary strings in the
message. If we had a way to tell start / end of string inserted in the
message, yes, the problem would be solved.

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]