[2.3.12] /proc/ioports

Luca Montecchiani (m.luca@iname.com)
Mon, 02 Aug 1999 14:39:21 +0200


Hi all,

I'm just starting to play with 2.3.x and looking around
/proc I've found that ioports can be multilevel now
see:

0040-005f : timer
0060-006f : keyboard
0060-0060 : status
0070-007f : rtc

At first look it can be take as a typo error ;)

The upatch I wrote give a more readable /proc/ioports ( like "ps xf" )
see:

0040-005f : timer
0060-006f : keyboard
\_ 0060-0060 : status
0070-007f : rtc

If this can be bad for /proc/ioports backward compatibility
we can use a "parent.entry" notation, see:

0040-005f : timer
0060-006f : keyboard
0060-0060 : keyboard.status
0070-007f : rtc

Or at last a new /proc/resource ;)

Good holiday to everyone, I'm leaving the keyboard for a week

Follow the upatch:

--- resource.c.ori Mon Aug 2 13:51:14 1999
+++ resource.c Mon Aug 2 14:01:04 1999
@@ -18,11 +18,8 @@
/*
* This generates reports for /proc/ioports and /proc/memory
*/
-static char * do_resource_list(struct resource *entry, const char *fmt, int offset, char *buf, char *end)
+static char * do_resource_list(struct resource *entry, const char *fmt, int sublevel, char *buf, char *end)
{
- if (offset < 0)
- offset = 0;
-
while (entry) {
const char *name = entry->name;
unsigned long from, to;
@@ -35,9 +32,16 @@
if (!name)
name = "<BAD>";

- buf += sprintf(buf, fmt + offset, from, to, name);
+ if (sublevel > 0)
+ {
+ int i;
+ for ( i = 1 ; i < sublevel ; i++ )
+ buf += sprintf(buf,"%s"," ");
+ buf += sprintf(buf,"%s"," \\_ ");
+ }
+ buf += sprintf(buf, fmt, from, to, name);
if (entry->child)
- buf = do_resource_list(entry->child, fmt, offset-2, buf, end);
+ buf = do_resource_list(entry->child, fmt, sublevel+1, buf, end);
entry = entry->sibling;
}

@@ -48,11 +52,11 @@
{
char *fmt;

- fmt = " %08lx-%08lx : %s\n";
+ fmt = "%08lx-%08lx : %s\n";
if (root == &ioport_resource)
- fmt = " %04lx-%04lx : %s\n";
- return do_resource_list(root->child, fmt, 8, buf, buf + size) - buf;
-}
+ fmt = "%04lx-%04lx : %s\n";
+ return do_resource_list(root->child, fmt, 0, buf, buf + size) - buf;
+}

int request_resource(struct resource *root, struct resource *new)
{

_______________________________________________________________
Aiem...: Luca Montecchiani W.W.W.: http://i.am/m.luca
E-mail.: m.luca@iname.com Kernel: 2.2
I.R.C..: defrag (#linux-it) I.C.Q.: 17655604
PGP5.0i: available on my home page Lime98: io c'ero ;)
_______________________________________________________________

-
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.tux.org/lkml/