linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Lynch <nathanl@austin.ibm.com>
To: linuxppc-dev@lists.linuxppc.org
Subject: [PATCH/RFC] add proc_dir_entry fields to device_node
Date: Fri, 03 Oct 2003 11:22:01 -0500	[thread overview]
Message-ID: <3F7DA229.7090409@austin.ibm.com> (raw)

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

Hi-

I am doing some ppc64 work to enable dynamic addition and removal of
nodes in /proc/device-tree.  It seems that recording a node's directory
and symlinks (if any) in the device_node is the easiest way to assure
that a node is cleaned up properly after deletion.

I need to add a few lines to fs/proc/proc_devtree.c::add_node() to
record the proc entries for each node as it is processed.  These will
refer to fields that do not yet exist in ppc's device_node.  I propose
adding these fields to ppc's device_node (patch attached).  If that
comment in prom.h about breaking BootX is still valid, there are
alternatives, but they would likely involve ifdefs and macros.

I have attached the proposed changes in separate patches against linus
2.5 bk.  The proc_devtree patch is for illustration purposes -- the
patch I submit to lkml will make add_node() extern and place its
declaration in the proper header.

Comments?

Nathan

[-- Attachment #2: ppc_device_node.patch --]
[-- Type: text/plain, Size: 680 bytes --]

diff -Nru a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
--- a/include/asm-ppc/prom.h	Fri Oct  3 10:57:25 2003
+++ b/include/asm-ppc/prom.h	Fri Oct  3 10:57:25 2003
@@ -9,6 +9,7 @@
 #define _PPC_PROM_H

 #include <linux/config.h>
+#include <linux/proc_fs.h>

 typedef void *phandle;
 typedef void *ihandle;
@@ -57,6 +58,9 @@
 	struct	device_node *sibling;
 	struct	device_node *next;	/* next device of same type */
 	struct	device_node *allnext;	/* next in list of all nodes */
+	struct  proc_dir_entry *pde;       /* node's directory */
+	struct  proc_dir_entry *name_link; /* name symlink */
+	struct  proc_dir_entry *addr_link; /* address symlink */
 };

 struct prom_args;

[-- Attachment #3: proc_devtree.patch --]
[-- Type: text/plain, Size: 662 bytes --]

diff -Nru a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
--- a/fs/proc/proc_devtree.c	Fri Oct  3 11:05:05 2003
+++ b/fs/proc/proc_devtree.c	Fri Oct  3 11:05:05 2003
@@ -53,6 +53,7 @@
 	int l;
 	struct proc_dir_entry *list, **lastp, *al;

+	np->pde = de;
 	lastp = &list;
 	for (pp = np->properties; pp != 0; pp = pp->next) {
 		/*
@@ -102,6 +103,7 @@
 			al = proc_symlink(child->name, de, ent->name);
 			if (al == 0)
 				break;
+			child->name_link = al;
 			*lastp = al;
 			lastp = &al->next;
 		}
@@ -112,6 +114,7 @@
 		al = proc_symlink(at, de, ent->name);
 		if (al == 0)
 			break;
+		child->addr_link = al;
 		*lastp = al;
 		lastp = &al->next;
 	}

             reply	other threads:[~2003-10-03 16:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-03 16:22 Nathan Lynch [this message]
2003-10-04  7:55 ` [PATCH/RFC] add proc_dir_entry fields to device_node Benjamin Herrenschmidt
2003-10-06 19:12   ` Nathan Lynch
2003-10-06 19:40     ` Benjamin Herrenschmidt

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=3F7DA229.7090409@austin.ibm.com \
    --to=nathanl@austin.ibm.com \
    --cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).