All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Zoltan Kiss <zoltan.kiss@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [PATCH net-next v2] xen-netback: Adding debugfs "io_ring_qX" files
Date: Tue, 8 Jul 2014 11:01:04 -0400	[thread overview]
Message-ID: <20140708150104.GA2863@laptop.dumpdata.com> (raw)
In-Reply-To: <53BC014E.5090600@citrix.com>

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.

      parent reply	other threads:[~2014-07-08 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 19:53 [PATCH net-next v2] xen-netback: Adding debugfs "io_ring_qX" files Zoltan Kiss
2014-07-02 20:02 ` Konrad Rzeszutek Wilk
2014-07-02 20:02 ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-07-08 14:33   ` Zoltan Kiss
2014-07-08 14:33   ` [Xen-devel] " Zoltan Kiss
2014-07-08 15:01     ` Konrad Rzeszutek Wilk
2014-07-08 15:01     ` Konrad Rzeszutek Wilk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140708150104.GA2863@laptop.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zoltan.kiss@citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.