public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zoltan Kiss <zoltan.kiss@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.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 v3] xen-netback: Adding debugfs "io_ring_qX" files
Date: Tue, 8 Jul 2014 19:43:16 +0100	[thread overview]
Message-ID: <53BC3BC4.5010504@citrix.com> (raw)
In-Reply-To: <20140708173934.GA6597@laptop.dumpdata.com>

On 08/07/14 18:39, Konrad Rzeszutek Wilk wrote:

>
>
>> +	return count;
>> +}
>> +
>> +static int xenvif_dump_open(struct inode *inode, struct file *filp)
>> +{
>> +	int ret;
>> +	void *queue = NULL;
>> +
>> +	if (inode->i_private)
>> +		queue = inode->i_private;
>> +	ret = single_open(filp, xenvif_read_io_ring, queue);
>> +	filp->f_mode |= FMODE_PWRITE;
>> +	return ret;
>> +}
>> +
>> +static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
>> +	.owner = THIS_MODULE,
>> +	.open = xenvif_dump_open,
>> +	.read = seq_read,
>> +	.llseek = seq_lseek,
>> +	.release = single_release,
>> +	.write = xenvif_write_io_ring,
>> +};
>> +
>> +static void xenvif_debugfs_addif(struct xenvif_queue *queue)
>> +{
>> +	struct dentry *pfile;
>> +	struct xenvif *vif = queue->vif;
>> +	int i;
>> +
>> +	if (!IS_ERR_OR_NULL(xen_netback_dbg_root))
>> +		return;
>
> I am curious to how you tested this patch, as my reading of
> the code above would imply that when xen_netback_dbg_root is
> initialized - we won't continue within this function?
Indeed, I've just copy-pasted that snippet you wrote in your prev mail 
and I haven't tried it out, as it was a very small change. I'll fix it.

>> +
>>   static int netback_remove(struct xenbus_device *dev)
>>   {
>>   	struct backend_info *be = dev_get_drvdata(&dev->dev);
>> @@ -246,8 +413,12 @@ static void backend_create_xenvif(struct backend_info *be)
>>
>>   static void backend_disconnect(struct backend_info *be)
>>   {
>> -	if (be->vif)
>> +	if (be->vif) {
>> +#ifdef CONFIG_DEBUG_FS
>> +		xenvif_debugfs_delif(be->vif);
>> +#endif /* CONFIG_DEBUG_FS */
>
> Why don't you just leave it as it (without the #ifdef) and add an
> empty function for the #else CONFIG_DEBUG_FS like:
>
> #else
> static inline void xenvif_debugfs_addif(struct xenvif_queue *queue) {}
> static inline void xenvif_debugfs_delif(struct xenvif *vif) {}
> #endif
It wouldn't change the end result, but from the code reader's point of 
view the current way is a little bit better, as (s)he doesn't need to 
check the declaration to realize it has effect only if that config 
option is enabled.


  reply	other threads:[~2014-07-08 18:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 16:33 [PATCH net-next v3] xen-netback: Adding debugfs "io_ring_qX" files Zoltan Kiss
2014-07-08 17:39 ` [Xen-devel] " Konrad Rzeszutek Wilk
2014-07-08 18:43   ` Zoltan Kiss [this message]
2014-07-08 18:49     ` Konrad Rzeszutek Wilk

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=53BC3BC4.5010504@citrix.com \
    --to=zoltan.kiss@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox