Re: [RFC PATCH v1 04/25] printk-rb: add writer interface
From: John Ogness
Date: Thu Feb 14 2019 - 20:20:04 EST
On 2019-02-15, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> prb_commit() does not actually care what is in the handle. It is going
> to commit everything up to the reserve.
After thinking about what I wrote here, I realized that the struct
prb_handle has no purpose in this ringbuffer implementation. We really
could simplify the writer interface to:
char *prb_reserve(struct printk_ringbuffer *rb, unsigned int size);
void prb_commit(struct printk_ringbuffer *rb);
That probably feels really strange because the writer doesn't specify
_what_ to commit. But this ringbuffer implementation doesn't need to
know that.
The only reason I can think of for having a handle is if there should be
any statistics, debugging, or sanity checking added. (For example if a
writer tried to commit something it did not reserve.)
John Ogness