linux-2.1.111 PATCH fixined /proc/ide support when ide drivers are modules

Adam J. Richter (adam@yggdrasil.com)
Sun, 26 Jul 1998 17:20:41 -0700


The following patch fixes /proc/ide so that it works even
when the IDE drivers are modularized. This will allow the sort of
user mode settings of IDE drive parameters based on drive types that
Linus had mentioned. Previously, only the single file /proc/ide/drivers
would be visibile when the IDE drivers were modularized. I have attached
the patch below.

In a previous posting, Linus had mentioned an "incoming"
directory for kernel patch submissions. If somebody could point me
to it, I would appreciate it.

Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 205
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
----------------------------CUT HERE-----------------------------------

diff -u -r /tmp/linux-2.1.111/drivers/block/ide-probe.c linux/drivers/block/ide-probe.c
--- /tmp/linux-2.1.111/drivers/block/ide-probe.c Wed May 6 14:42:53 1998
+++ linux/drivers/block/ide-probe.c Sun Jul 26 16:26:55 1998
@@ -729,6 +729,11 @@
for (index = 0; index < MAX_HWIFS; ++index)
if (probe[index])
hwif_init(&ide_hwifs[index]);
+#ifdef CONFIG_PROC_FS
+ for (index = 0; index < MAX_HWIFS; ++index)
+ if (probe[index])
+ proc_ide_add_interface(&ide_hwifs[index]);
+#endif
ide_register_module(&ideprobe_module);
MOD_DEC_USE_COUNT;
return 0;
diff -u -r /tmp/linux-2.1.111/drivers/block/ide-proc.c linux/drivers/block/ide-proc.c
--- /tmp/linux-2.1.111/drivers/block/ide-proc.c Wed May 6 14:42:53 1998
+++ linux/drivers/block/ide-proc.c Sun Jul 26 17:06:43 1998
@@ -72,6 +72,8 @@
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif

+static struct proc_dir_entry *proc_ide = NULL;
+
static int ide_getxdigit(char c)
{
int digit;
@@ -655,31 +657,31 @@
{ NULL, 0, NULL, NULL }
};

-static void create_proc_ide_interfaces (struct proc_dir_entry *parent)
+void
+proc_ide_add_interface (ide_hwif_t *hwif)
{
- int h;
struct proc_dir_entry *hwif_ent;

- for (h = 0; h < MAX_HWIFS; h++) {
- ide_hwif_t *hwif = &ide_hwifs[h];
-
- if (!hwif->present)
- continue;
- hwif_ent = create_proc_entry(hwif->name, S_IFDIR, parent);
+ if (hwif->present && proc_ide) {
+ hwif_ent = create_proc_entry(hwif->name, S_IFDIR, proc_ide);
if (!hwif_ent) return;
ide_add_proc_entries(hwif_ent, hwif_entries, hwif);
- create_proc_ide_drives(hwif, hwif_ent, parent);
+ create_proc_ide_drives(hwif, hwif_ent, proc_ide);
}
}

void proc_ide_create(void)
{
- struct proc_dir_entry *root, *ent;
- root = create_proc_entry("ide", S_IFDIR, 0);
- if (!root) return;
- create_proc_ide_interfaces(root);
+ struct proc_dir_entry *ent;
+ int h;
+
+ proc_ide = create_proc_entry("ide", S_IFDIR, 0);
+ if (!proc_ide) return;
+ for (h = 0; h < MAX_HWIFS; h++) {
+ proc_ide_add_interface(&ide_hwifs[h]);
+ }

- ent = create_proc_entry("drivers", 0, root);
+ ent = create_proc_entry("drivers", 0, proc_ide);
if (!ent) return;
ent->read_proc = proc_ide_read_drivers;
}
diff -u -r /tmp/linux-2.1.111/drivers/block/ide.c linux/drivers/block/ide.c
--- /tmp/linux-2.1.111/drivers/block/ide.c Tue Jun 30 12:27:48 1998
+++ linux/drivers/block/ide.c Sun Jul 26 16:29:05 1998
@@ -2931,6 +2931,7 @@
EXPORT_SYMBOL(ide_wait_cmd);
EXPORT_SYMBOL(ide_stall_queue);
#ifdef CONFIG_PROC_FS
+EXPORT_SYMBOL(proc_ide_add_interface);
EXPORT_SYMBOL(ide_add_proc_entries);
EXPORT_SYMBOL(ide_remove_proc_entries);
EXPORT_SYMBOL(proc_ide_read_geometry);
diff -u -r /tmp/linux-2.1.111/drivers/block/ide.h linux/drivers/block/ide.h
--- /tmp/linux-2.1.111/drivers/block/ide.h Wed Jul 22 14:53:33 1998
+++ linux/drivers/block/ide.h Sun Jul 26 16:27:52 1998
@@ -419,6 +419,7 @@
void proc_ide_destroy(void);
void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data);
void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p);
+void proc_ide_add_interface (ide_hwif_t *hwif);
read_proc_t proc_ide_read_capacity;
read_proc_t proc_ide_read_geometry;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html