public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PPC64 iSeries viodasd proc file
@ 2004-06-18  6:54 Stephen Rothwell
  2004-06-18 15:09 ` Jeff Garzik
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2004-06-18  6:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus, linuxppc64-dev, LKML

[-- Attachment #1: Type: text/plain, Size: 2606 bytes --]

Hi Andrew,

This patch adds a proc file for viodasd so to make it
easier to enumerate the available disks.  It is in a
(somewhat) strange format to try for a simple level of
compatability with the old viodasd code (that was in a
couple of vendor's kernels).

Please apply (and for Linus' tree as well).

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.6.7/drivers/block/viodasd.c 2.6.7.viodasd.1/drivers/block/viodasd.c
--- 2.6.7/drivers/block/viodasd.c	2004-06-16 22:15:21.000000000 +1000
+++ 2.6.7.viodasd.1/drivers/block/viodasd.c	2004-06-18 16:00:33.000000000 +1000
@@ -42,6 +42,8 @@
 #include <linux/completion.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 
 #include <asm/uaccess.h>
 #include <asm/vio.h>
@@ -171,6 +173,34 @@
 } viodasd_devices[MAX_DISKNO];
 
 /*
+ * Proc file so that disks may be identified.  It looks like
+ * this in order to be (somewhat) compatible with the old code
+ * which just dumped statistics for each disk.
+ */
+static int viodasd_proc_show(struct seq_file *m, void *v)
+{
+	int i;
+
+	seq_printf(m, "viod %d possible devices\n", MAX_DISKNO);
+	for (i = 0; i < MAX_DISKNO; i++)
+		if (viodasd_devices[i].disk != NULL)
+			seq_printf(m, "DISK %2.2d:\n", i);
+	return 0;
+}
+
+static int viodasd_proc_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, viodasd_proc_show, NULL);
+}
+
+static struct file_operations viodasd_proc_operations = {
+	.open		= viodasd_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
+/*
  * External open entry point.
  */
 static int viodasd_open(struct inode *ino, struct file *fil)
@@ -755,6 +785,7 @@
 static int __init viodasd_init(void)
 {
 	int i;
+	struct proc_dir_entry *e;
 
 	/* Try to open to our host lp */
 	if (viopath_hostLp == HvLpIndexInvalid)
@@ -794,6 +825,12 @@
 	vio_register_driver(&viodasd_driver);	/* FIX ME - error checking */
 	driver_create_file(&viodasd_driver.driver, &driver_attr_probe);
 
+	e = create_proc_entry("iSeries/viodasd", S_IFREG|S_IRUGO, NULL);
+	if (e) {
+		e->owner = THIS_MODULE;
+		e->proc_fops = &viodasd_proc_operations;
+	}
+
 	return 0;
 }
 module_init(viodasd_init);
@@ -806,6 +843,7 @@
 	driver_remove_file(&viodasd_driver.driver, &driver_attr_probe);
 	vio_unregister_driver(&viodasd_driver);
 
+	remove_proc_entry("iSeries/viodasd", NULL);
         for (i = 0; i < MAX_DISKNO; i++) {
 		d = &viodasd_devices[i];
 		if (d->disk) {

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH] PPC64 iSeries viodasd proc file
@ 2004-06-23 23:54 Stephen Rothwell
  2004-06-23 23:55 ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2004-06-23 23:54 UTC (permalink / raw)
  To: greg, jeremy.katz; +Cc: akpm, jgarzik, katzj, linux-kernel, sfr, torvalds

From: Greg KH <greg@kroah.com>
> 
> I agree, I don't think that many things have disappeared from /proc just
> yet, right?  You should just have more information than what you
> previously did, right?  Or did scsi drop their /proc support fully?

What started this discussion is that I had to drop all the proc support
from the iSeries virtual devices while attempting to get the drivers
into the mainline kernel.

Cheers,
Stephen

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-06-24 21:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-18  6:54 [PATCH] PPC64 iSeries viodasd proc file Stephen Rothwell
2004-06-18 15:09 ` Jeff Garzik
2004-06-18 15:17   ` Christoph Hellwig
2004-06-20 19:52     ` Jeremy
2004-06-20 21:11       ` Christoph Hellwig
2004-06-21  6:04       ` Greg KH
     [not found]         ` <cb5afee10406210914451dc6@mail.gmail.com>
2004-06-23 21:15           ` Jeremy Katz
2004-06-23 21:45             ` Jeff Garzik
2004-06-23 22:03             ` Greg KH
2004-06-24  0:38               ` Jeff Garzik
2004-06-24 20:59                 ` Greg KH
2004-06-24 21:25                   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2004-06-23 23:54 Stephen Rothwell
2004-06-23 23:55 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox