Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370087
b: refs/heads/master
c: 1f817b8
h: refs/heads/master
i:
  370085: 2ddf8e2
  370083: e1578f1
  370079: d370b6d
v: v3
  • Loading branch information
David Howells authored and Al Viro committed Apr 29, 2013
1 parent 1129a3d commit 08edac2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 207e39099a90a7385900aca4868ed686f25300cb
refs/heads/master: 1f817b86d5e6aceed48dac7db6ce9a82a4375e3f
52 changes: 31 additions & 21 deletions trunk/drivers/staging/comedi/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,57 +31,67 @@
#include "comedidev.h"
#include "comedi_internal.h"
#include <linux/proc_fs.h>
#include <linux/string.h>
#include <linux/seq_file.h>

static int comedi_read(char *buf, char **start, off_t offset, int len,
int *eof, void *data)
static int comedi_read(struct seq_file *m, void *v)
{
int i;
int devices_q = 0;
int l = 0;
struct comedi_driver *driv;

l += sprintf(buf + l,
seq_printf(m,
"comedi version " COMEDI_RELEASE "\n"
"format string: %s\n",
"\"%2d: %-20s %-20s %4d\", i, "
"driver_name, board_name, n_subdevices");

for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device *dev = comedi_dev_from_minor(i);

if (!dev)
continue;

if (dev->attached) {
devices_q = 1;
l += sprintf(buf + l, "%2d: %-20s %-20s %4d\n",
i,
dev->driver->driver_name,
dev->board_name, dev->n_subdevices);
seq_printf(m, "%2d: %-20s %-20s %4d\n",
i, dev->driver->driver_name,
dev->board_name, dev->n_subdevices);
}
}
if (!devices_q)
l += sprintf(buf + l, "no devices\n");
seq_puts(m, "no devices\n");

for (driv = comedi_drivers; driv; driv = driv->next) {
l += sprintf(buf + l, "%s:\n", driv->driver_name);
for (i = 0; i < driv->num_names; i++) {
l += sprintf(buf + l, " %s\n",
*(char **)((char *)driv->board_name +
i * driv->offset));
}
seq_printf(m, "%s:\n", driv->driver_name);
for (i = 0; i < driv->num_names; i++)
seq_printf(m, " %s\n",
*(char **)((char *)driv->board_name +
i * driv->offset));

if (!driv->num_names)
l += sprintf(buf + l, " %s\n", driv->driver_name);
seq_printf(m, " %s\n", driv->driver_name);
}

return l;
return 0;
}

/*
* seq_file wrappers for procfile show routines.
*/
static int comedi_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, comedi_read, NULL);
}

static const struct file_operations comedi_proc_fops = {
.open = comedi_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

void comedi_proc_init(void)
{
create_proc_read_entry("comedi", S_IFREG | S_IRUGO, NULL,
comedi_read, NULL);
proc_create("comedi", 0644, NULL, &comedi_proc_fops);
}

void comedi_proc_cleanup(void)
Expand Down

0 comments on commit 08edac2

Please sign in to comment.