[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140708150104.GA2863@laptop.dumpdata.com>
Date: Tue, 8 Jul 2014 11:01:04 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Zoltan Kiss <zoltan.kiss@...rix.com>
Cc: Wei Liu <wei.liu2@...rix.com>,
Ian Campbell <Ian.Campbell@...rix.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org
Subject: Re: [Xen-devel] [PATCH net-next v2] xen-netback: Adding debugfs
"io_ring_qX" files
On Tue, Jul 08, 2014 at 03:33:50PM +0100, Zoltan Kiss wrote:
> On 02/07/14 21:02, Konrad Rzeszutek Wilk wrote:
> >On Wed, Jul 02, 2014 at 08:53:50PM +0100, Zoltan Kiss wrote:
> >>+static ssize_t
> >>+xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
> >>+ loff_t *ppos)
> >>+{
> >>+ struct xenvif_queue *queue =
> >>+ ((struct seq_file *)filp->private_data)->private;
> >>+ int len;
> >>+ char write[sizeof("kick")];
> >
> ><blinks>
> >>+
> >>+ /* don't allow partial writes and check the length */
> >>+ if (*ppos != 0)
> >>+ return 0;
> >>+ if (count < sizeof("kick") - 1)
> >
> >Um, could you just use a #define please?
> OK
>
> >
> >>+ return -ENOSPC;
> >>+
> >>+ len = simple_write_to_buffer(write,
> >>+ sizeof(write),
> >>+ ppos,
> >>+ buf,
> >>+ count);
> >>+ if (len < 0)
> >>+ return len;
> >>+
> >>+ if (!strncmp(write, "kick", sizeof("kick") - 1))
> >>+ xenvif_interrupt(0, (void *)queue);
> >>+ else
> >>+ pr_warn("Unknown command to io_ring. Available: kick\n");
> >
> >It is 'io_ring_q%d'?
> Yes
>
> >Why don't you split that back out to the user
> >instead of the console?
> How do you mean? Printing it into buf? I don't think the user cares about
> its content after doing the write syscall. More importantly, I don't know if
> that buffer is big enough to hold the message.
Isn't it 4K?
Either way I think you need to do 'count = -EINVAL' here.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists