Commit 68809958 authored by David S. Miller's avatar David S. Miller

Merge branch 'xen-netback-debugfs'

Wei Liu says:

====================
xen-netback: fix debugfs code

This small series fixes two problems in xen-netback debugfs code.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 490cc7d0 628fa76b
...@@ -116,6 +116,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) ...@@ -116,6 +116,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v)
} }
#define XENVIF_KICK_STR "kick" #define XENVIF_KICK_STR "kick"
#define BUFFER_SIZE 32
static ssize_t static ssize_t
xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count, xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
...@@ -124,22 +125,24 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count, ...@@ -124,22 +125,24 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
struct xenvif_queue *queue = struct xenvif_queue *queue =
((struct seq_file *)filp->private_data)->private; ((struct seq_file *)filp->private_data)->private;
int len; int len;
char write[sizeof(XENVIF_KICK_STR)]; char write[BUFFER_SIZE];
/* don't allow partial writes and check the length */ /* don't allow partial writes and check the length */
if (*ppos != 0) if (*ppos != 0)
return 0; return 0;
if (count < sizeof(XENVIF_KICK_STR) - 1) if (count >= sizeof(write))
return -ENOSPC; return -ENOSPC;
len = simple_write_to_buffer(write, len = simple_write_to_buffer(write,
sizeof(write), sizeof(write) - 1,
ppos, ppos,
buf, buf,
count); count);
if (len < 0) if (len < 0)
return len; return len;
write[len] = '\0';
if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1)) if (!strncmp(write, XENVIF_KICK_STR, sizeof(XENVIF_KICK_STR) - 1))
xenvif_interrupt(0, (void *)queue); xenvif_interrupt(0, (void *)queue);
else { else {
...@@ -171,10 +174,9 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = { ...@@ -171,10 +174,9 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
.write = xenvif_write_io_ring, .write = xenvif_write_io_ring,
}; };
static void xenvif_debugfs_addif(struct xenvif_queue *queue) static void xenvif_debugfs_addif(struct xenvif *vif)
{ {
struct dentry *pfile; struct dentry *pfile;
struct xenvif *vif = queue->vif;
int i; int i;
if (IS_ERR_OR_NULL(xen_netback_dbg_root)) if (IS_ERR_OR_NULL(xen_netback_dbg_root))
...@@ -733,10 +735,11 @@ static void connect(struct backend_info *be) ...@@ -733,10 +735,11 @@ static void connect(struct backend_info *be)
be->vif->num_queues = queue_index; be->vif->num_queues = queue_index;
goto err; goto err;
} }
}
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
xenvif_debugfs_addif(queue); xenvif_debugfs_addif(be->vif);
#endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_DEBUG_FS */
}
/* Initialisation completed, tell core driver the number of /* Initialisation completed, tell core driver the number of
* active queues. * active queues.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment