Re: [PATCH] Revert "kernel/printk: add kmsg SEEK_CUR handling"
From: Bruno Meneguele
Date: Mon Jun 22 2020 - 13:10:18 EST
On Mon, Jun 22, 2020 at 09:42:25AM -0700, Linus Torvalds wrote:
> > Would it make sense to return the next buffer index instead? Basically
> > the same as SEEK_END does? The first "if (offset)" in the function would
> > prevent any real relative move while SEEK_CUR would return a valid
> > address following this buffer behavior of specific points it could seek
> > to.
>
> Maybe. At the same time, the way we don't actually return a real
> position means that that's very dangerous too. We'll always return
> "we're at position zero".
>
> And we never accept byte-by-byte reads and require a "get the whole
> record" model.
>
> So I think we might as well accept "kmsg is special".
>
> I don't have hugely strong opinions on it - I certainly agree that
> "SEEK_CUR with offset zero could be a no-op", but I also don't think
> there's a huge reason to try to change it, considering just _how_
> special kmsg is.
Although both options are pretty fine by me too, I "fear" (not really)
we can end up stacking special behavior interfaces, forcing userspace to
keep a "table of special case files". Personally, I prefer to return
something _valid_ to userspace rather than _fail_ with special meaning.
But in any case I think it's worth adding a note in the docs just to
make sure we have somewhere to point in case they start looking.
Thanks Linus! Will wait some more in case we have other thoughts around
it before posting anything (doc patch or the other approach).
--
bmeneg
PGP Key: http://bmeneg.com/pubkey.txt
Attachment:
signature.asc
Description: PGP signature