[...]
> > +static ssize_t buffer_size_kb_write(struct file *filp, const char __user
> > *ubuf, size_t cnt,
> > + loff_t *ppos)
> > +{
> > + struct trace_remote *remote = filp->private_data;
> > + unsigned long val;
> > + int ret;
> > +
> > + ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
> > + if (ret)
> > + return ret;
> > +
> > + /* KiB to Bytes */
> > + if (!val || check_shl_overflow(val, 10, &val))
> > + return -EINVAL;
> > +
> > + guard(mutex)(&remote->lock);
> > +
> > + remote->trace_buffer_size = val;
>
> Should this be allowed to change when it is already loaded?
It would only be effective on the next unload/load.
But now thinking more about it, this is probably not clear to a user and
returning -EBUSY when loaded might be a better solution?
>
> -- Steve
>
> > +
> > + return cnt;
> > +}
> > +
> > +static int buffer_size_kb_show(struct seq_file *s, void *unused)
> > +{
> > + struct trace_remote *remote = s->private;
> > +
> > + seq_printf(s, "%lu (%s)\n", remote->trace_buffer_size >> 10,
> > + trace_remote_loaded(remote) ? "loaded" : "unloaded");
> > +
> > + return 0;
> > +}
> > +DEFINE_SHOW_STORE_ATTRIBUTE(buffer_size_kb);
> > +
>