11 #include <linux/types.h>
16 #include <linux/export.h>
17 #include <asm/uaccess.h>
19 #include <asm/setup.h>
22 proc_bus_zorro_lseek(
struct file *
file, loff_t off,
int whence)
33 new = file->
f_pos + off;
39 if (new < 0 || new >
sizeof(
struct ConfigDev))
48 proc_bus_zorro_read(
struct file *file,
char __user *
buf,
size_t nbytes, loff_t *ppos)
50 struct inode *
ino = file->
f_path.dentry->d_inode;
52 struct zorro_dev *z = dp->
data;
60 if (pos + nbytes >
sizeof(
struct ConfigDev))
66 cd.cd_SlotAddr = z->slotaddr;
67 cd.cd_SlotSize = z->slotsize;
68 cd.cd_BoardAddr = (
void *)zorro_resource_start(z);
69 cd.cd_BoardSize = zorro_resource_len(z);
80 .llseek = proc_bus_zorro_lseek,
81 .read = proc_bus_zorro_read,
84 static void * zorro_seq_start(
struct seq_file *
m, loff_t *pos)
89 static void * zorro_seq_next(
struct seq_file *m,
void *
v, loff_t *pos)
95 static void zorro_seq_stop(
struct seq_file *m,
void *v)
99 static int zorro_seq_show(
struct seq_file *m,
void *v)
101 unsigned int slot = *(loff_t *)v;
104 seq_printf(m,
"%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, z->id,
105 (
unsigned long)zorro_resource_start(z),
106 (
unsigned long)zorro_resource_len(z),
112 .start = zorro_seq_start,
113 .next = zorro_seq_next,
114 .stop = zorro_seq_stop,
115 .show = zorro_seq_show,
118 static int zorro_devices_proc_open(
struct inode *inode,
struct file *file)
120 return seq_open(file, &zorro_devices_seq_ops);
125 .open = zorro_devices_proc_open,
133 static int __init zorro_proc_attach_device(
unsigned int slot)
140 &proc_bus_zorro_operations,
144 entry->
size =
sizeof(
struct zorro_dev);
148 static int __init zorro_proc_init(
void)
154 proc_create(
"devices", 0, proc_bus_zorro_dir,
155 &zorro_devices_proc_fops);
157 zorro_proc_attach_device(slot);