aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe
diff options
context:
space:
mode:
authorEd Cashin <ecashin@coraid.com>2013-09-11 17:25:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:59:24 -0400
commit1cf94797c2bbc514c2bd0892e1774a0a8ca9afdb (patch)
tree033aea3daa4046adf14484dc056f25fa95e92456 /drivers/block/aoe
parente8866cf2b90f3a29859d2113c0fd23daf189c282 (diff)
aoe: provide file operations for debugfs files
The place holder in the file contents is filled out in the following patch. Signed-off-by: Ed Cashin <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/aoe')
-rw-r--r--drivers/block/aoe/aoeblk.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index d76c5cb3c708..0511d38e412d 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -110,6 +110,24 @@ static ssize_t aoedisk_show_payload(struct device *dev,
110 return snprintf(page, PAGE_SIZE, "%lu\n", d->maxbcnt); 110 return snprintf(page, PAGE_SIZE, "%lu\n", d->maxbcnt);
111} 111}
112 112
113static int aoedisk_debugfs_show(struct seq_file *s, void *ignored)
114{
115 struct aoedev *d;
116 unsigned long flags;
117
118 d = s->private;
119 spin_lock_irqsave(&d->lock, flags);
120 seq_printf(s, "%s\n", d->gd->disk_name); /* place holder */
121 spin_unlock_irqrestore(&d->lock, flags);
122
123 return 0;
124}
125
126static int aoe_debugfs_open(struct inode *inode, struct file *file)
127{
128 return single_open(file, aoedisk_debugfs_show, inode->i_private);
129}
130
113static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL); 131static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL);
114static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL); 132static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL);
115static DEVICE_ATTR(netif, S_IRUGO, aoedisk_show_netif, NULL); 133static DEVICE_ATTR(netif, S_IRUGO, aoedisk_show_netif, NULL);
@@ -132,7 +150,12 @@ static const struct attribute_group attr_group = {
132 .attrs = aoe_attrs, 150 .attrs = aoe_attrs,
133}; 151};
134 152
135static const struct file_operations aoe_debugfs_fops; 153static const struct file_operations aoe_debugfs_fops = {
154 .open = aoe_debugfs_open,
155 .read = seq_read,
156 .llseek = seq_lseek,
157 .release = single_release,
158};
136 159
137static void 160static void
138aoedisk_add_debugfs(struct aoedev *d) 161aoedisk_add_debugfs(struct aoedev *d)