summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-19 23:10:11 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:19:08 +0200
commit2c7dcef74c3259d2d5db7a11f5c77d18d3a51e85 (patch)
tree5135e8ce3082dc172cfce4d4b08f31a43f73590f /main.c
parentc6c770c33eb0f23e7e8e04976c711653cdf1a41d (diff)
Invent path-based inode numbers
* procfs.h, procfs.c (procfs_make_ino): New function, invents an inode number by hashing the parent's and the name of an entry. (procfs_lookup): Use it to assign an inode number to child nodes at lookup time. * main.c (root_make_node): Assign an arbitrary inode number to the root directory.
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.c b/main.c
index e08bbdb..1560281 100644
--- a/main.c
+++ b/main.c
@@ -42,6 +42,10 @@ root_make_node (struct node **np)
if (! *np)
return ENOMEM;
+ /* Since this one is not created through proc_lookup(), we have to affect an
+ inode number to it. */
+ (*np)->nn_stat.st_ino = * (uint32_t *) "PROC";
+
return 0;
}