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

Pavel Machek
2018-07-31T11:34:28Z

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

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.

> You also haven't proposed what you think the internal interface should look
> like.

No, I did not.

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

I guess internal interface can stay the same, at expense of complexity
in infof function. It would data according to %blablax into string,
then replace %blablax with %s. I guess we can keep infof function
simpler by only allowing certain format specifiers...

Best regards,
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 --]