From 2c7dcef74c3259d2d5db7a11f5c77d18d3a51e85 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Thu, 19 Aug 2010 23:10:11 +0000 Subject: 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. --- main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index e08bbdb7..15602819 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; } -- cgit v1.2.3