mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus <torvalds@osdl.org>,
	linuxppc64-dev@lists.linuxppc.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] PPC64 iSeries viodasd proc file
Date: Fri, 18 Jun 2004 16:54:36 +1000	[thread overview]
Message-ID: <20040618165436.193d5d35.sfr@canb.auug.org.au> (raw)

[-- 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 --]

             reply	other threads:[~2004-06-18  6:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-18  6:54 Stephen Rothwell [this message]
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
2004-06-23 23:54 Stephen Rothwell
2004-06-23 23:55 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040618165436.193d5d35.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@lists.linuxppc.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®