[Prev][Next][Index][Thread]

Re: Linux ext2 filesystem



> From: Yves Martin <ymartin@ensisun.imag.fr>
> Subject: Linux ext2 filesystem 
> 
> > >     I would like to report some problems
> > >   with Linux FS library and Linux devices.

Well, appended below is a patch relative to snapshot oskit-20000505.  It
fixes the second problem (with chdir("..")). You should be able to apply it
in the top level of your oskit tree, if you are running 2000505. Make sure
you clean and rebuild at least the linux/fs and linux/dev directories.

As for the first problem. I was not able to reproduce that one. I commented
out the call to pic_set_irqmask(), and it ran just fine. Note that I was
talking to a Freebsd partition using the linux UFS filesystem module
(instead of ext2). But, I kinda doubt that the problem would be local to
the ext2 code.

I'm not sure why you redefine base_multiboot_init_mem(). I sure wouldn't,
although it did run that way. Is there something special about the hardware
you are running on?

Lbs

-------

diff -Nr -c linux/dev/global.h ../oskit-foo/linux/dev/global.h
*** linux/dev/global.h	Thu May  4 15:32:18 2000
--- ../oskit-foo/linux/dev/global.h	Tue May 16 15:23:32 2000
***************
*** 643,649 ****
  #define unregister_netdev FDEV_LINUX_unregister_netdev
  #define ni52_probe FDEV_LINUX_ni52_probe
  #define ni65_probe FDEV_LINUX_ni65_probe
- #define linux_oskit_osenv_device FDEV_LINUX_linux_oskit_osenv_device
  #define default_irqs FDEV_LINUX_default_irqs
  #define pas16_abort FDEV_LINUX_pas16_abort
  #define pas16_biosparam FDEV_LINUX_pas16_biosparam
--- 643,648 ----
diff -Nr -c linux/fs/file.c ../oskit-foo/linux/fs/file.c
*** linux/fs/file.c	Thu Mar  9 18:59:07 2000
--- ../oskit-foo/linux/fs/file.c	Tue May 16 15:23:33 2000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 1997, 1998, 1999 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
--- 1,5 ----
  /*
!  * Copyright (c) 1997-2000 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
***************
*** 35,40 ****
--- 35,44 ----
  #include "errno.h"
  #include "types.h"
  
+ #include <assert.h>
+ #include "hashtab.h"
+ extern hashtab_t	dentrytab;	/* dentry -> oskit_file_t */
+ 
  /* So we don't need <oskit/c/stddef.h>. */
  #define	offsetof(type, member)	((size_t)(&((type *)0)->member))
  
***************
*** 112,118 ****
--- 116,129 ----
  
  	newcount = --file->count;
  	if (newcount == 0) {
+ 		int rc;
+ 		
  		oskit_filesystem_release(&file->fs->fsi);
+ 
+ 		rc = hashtab_remove(dentrytab,
+ 				    (hashtab_key_t) file->dentry, 0, 0);
+ 		assert(rc == HASHTAB_SUCCESS);
+ 		
  		dput(file->dentry);
  		kfree(file);
  	}
***************
*** 852,862 ****
--- 863,880 ----
  
  	newcount = --dir->count;
  	if (newcount == 0) {
+ 		int rc;
+ 		
  		/* This is the difference between this method and file_release. */
  		if (dir->vparent && dir->vparent != d)
  			oskit_dir_release(dir->vparent);
  
  		oskit_filesystem_release(&dir->fs->fsi);
+ 
+ 		rc = hashtab_remove(dentrytab,
+ 				    (hashtab_key_t) dir->dentry, 0, 0);
+ 		assert(rc == HASHTAB_SUCCESS);
+ 		
  		dput(dir->dentry);
  		kfree(dir);
  	}
***************
*** 943,949 ****
  		return errno_to_oskit_error(ENOENT);
  	}
  		
! 	err = gfile_create(dir->fs, dentry, &file);
  	if (err) {
  		dput(dentry);
  		fs_linux_destroy_current();
--- 961,967 ----
  		return errno_to_oskit_error(ENOENT);
  	}
  		
! 	err = gfile_lookup(dir->fs, dentry, &file);
  	if (err) {
  		dput(dentry);
  		fs_linux_destroy_current();
***************
*** 1005,1011 ****
  		return errno_to_oskit_error(-(PTR_ERR(dentry)));
  	}
  
! 	err = gfile_create(dir->fs, dentry, &file);
  	if (err) {
  		dput(dentry);
  		fs_linux_destroy_current();
--- 1023,1029 ----
  		return errno_to_oskit_error(-(PTR_ERR(dentry)));
  	}
  
! 	err = gfile_lookup(dir->fs, dentry, &file);
  	if (err) {
  		dput(dentry);
  		fs_linux_destroy_current();
***************
*** 1468,1474 ****
  	if (out_dir == NULL)
  		return OSKIT_E_INVALIDARG;
  
! 	err = gfile_create(dir->fs, dir->dentry, (gfile_t **)&new_dir);
  	if (err)
  		return err;
  	if (parent) {
--- 1486,1492 ----
  	if (out_dir == NULL)
  		return OSKIT_E_INVALIDARG;
  
! 	err = gfile_lookup(dir->fs, dir->dentry, (gfile_t **)&new_dir);
  	if (err)
  		return err;
  	if (parent) {
***************
*** 1512,1517 ****
--- 1530,1564 ----
  
  
  /*
+  * Look for the gfile in the hashtable. Search key is the dentry. Only
+  * create the gfile if its not hashed, since we need to return a unique
+  * COM object for the underlying filesystem object.
+  */
+ oskit_error_t
+ gfile_lookup(gfilesystem_t *fs, struct dentry *dentry, gfile_t **out_file)
+ {
+ 	struct gfile *file;
+ 	oskit_error_t rc;
+ 
+ 	file = hashtab_search(dentrytab, (hashtab_key_t) dentry);
+ 
+ 	if (file) {
+ 		/* gfile exists for dentry */
+ 		oskit_file_addref(&file->filei);
+ 	}
+ 	else
+ 	{
+ 		/* no gfile for dentry; create a new one */
+ 		rc = gfile_create(fs, dentry, &file);
+ 		if (rc)
+ 			return rc;
+ 	}
+ 
+ 	*out_file = file;
+ 	return 0;
+ }
+ 
+ /*
   * Create and initialize a gfile OR gdir.
   * oskit_file/dir_release are the counterparts to this.
   */
***************
*** 1521,1526 ****
--- 1568,1574 ----
  	gdir_t *dir;
  	gfile_t *file;
  	struct inode *inode = dentry->d_inode;
+ 	int rc;
  
  	/*
  	 * Initialize the specific stuff.
***************
*** 1541,1546 ****
--- 1589,1604 ----
  		if (file == NULL)
  			return OSKIT_ENOMEM;
  		file->filei.ops = &file_ops;
+ 	}
+ 
+ 	/*
+ 	 * Add to the hashtable.
+ 	 */
+ 	rc = hashtab_insert(dentrytab,
+ 			    (hashtab_key_t) dentry, (hashtab_datum_t) file);
+ 	if (rc) {
+ 		kfree(file);
+ 		return OSKIT_E_FAIL;
  	}
  
  	/*
diff -Nr -c linux/fs/filesystem.c ../oskit-foo/linux/fs/filesystem.c
*** linux/fs/filesystem.c	Thu Mar  9 18:59:08 2000
--- ../oskit-foo/linux/fs/filesystem.c	Tue May 16 15:23:33 2000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 1997, 1998, 1999 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
--- 1,5 ----
  /*
!  * Copyright (c) 1997-2000 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
***************
*** 186,192 ****
  	if (out_dir == NULL)
  		return OSKIT_E_INVALIDARG;
  
! 	err = gfile_create(fs, fs->sb->s_root, (gfile_t **)&dir);
  	if (err)
  		return err;
  	*out_dir = &dir->diri;
--- 186,192 ----
  	if (out_dir == NULL)
  		return OSKIT_E_INVALIDARG;
  
! 	err = gfile_lookup(fs, fs->sb->s_root, (gfile_t **)&dir);
  	if (err)
  		return err;
  	*out_dir = &dir->diri;
***************
*** 330,336 ****
  	dentry->d_sb = inode->i_sb;
  
  	/* Make a file from the dentry. */
! /**/	err = gfile_create(fs, dentry, &file);
  	if (err) {
  		iput(inode);
  		fs_linux_destroy_current();
--- 330,336 ----
  	dentry->d_sb = inode->i_sb;
  
  	/* Make a file from the dentry. */
! /**/	err = gfile_lookup(fs, dentry, &file);
  	if (err) {
  		iput(inode);
  		fs_linux_destroy_current();
diff -Nr -c linux/fs/global.h ../oskit-foo/linux/fs/global.h
*** linux/fs/global.h	Thu Feb 17 17:13:32 2000
--- ../oskit-foo/linux/fs/global.h	Tue May 16 15:23:33 2000
***************
*** 318,324 ****
  #define iunique FS_LINUX_iunique
  #define linux_char_to_upper_linux FS_LINUX_linux_char_to_upper_linux
  #define linux_errno_to_oskit_error FS_LINUX_linux_errno_to_oskit_error
- #define linux_oskit_osenv_device FS_LINUX_linux_oskit_osenv_device
  #define ll_rw_block FS_LINUX_ll_rw_block
  #define load_nls FS_LINUX_load_nls
  #define load_nls_default FS_LINUX_load_nls_default
--- 318,323 ----
diff -Nr -c linux/fs/glue.c ../oskit-foo/linux/fs/glue.c
*** linux/fs/glue.c	Tue Jan 25 04:12:10 2000
--- ../oskit-foo/linux/fs/glue.c	Tue May 16 15:23:33 2000
***************
*** 234,239 ****
--- 234,240 ----
  	(void)console_getchar();
  }
  
+ #if 0
  void
  floppy_eject(void)
  {
***************
*** 241,243 ****
--- 242,245 ----
  	wait_for_keypress();
  	printk("Thanks!\n");
  }
+ #endif
diff -Nr -c linux/fs/hashtab.c ../oskit-foo/linux/fs/hashtab.c
*** linux/fs/hashtab.c	Wed Dec 31 17:00:00 1969
--- ../oskit-foo/linux/fs/hashtab.c	Tue May 16 15:14:36 2000
***************
*** 0 ****
--- 1,248 ----
+ /*
+  * Copyright (c) 1997-2000 University of Utah and the Flux Group.
+  * All rights reserved.
+  * 
+  * This file is part of the Flux OSKit.  The OSKit is free software, also known
+  * as "open source;" you can redistribute it and/or modify it under the terms
+  * of the GNU General Public License (GPL), version 2, as published by the Free
+  * Software Foundation (FSF).  To explore alternate licensing terms, contact
+  * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
+  * 
+  * The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY
+  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+  * FOR A PARTICULAR PURPOSE.  See the GPL for more details.  You should have
+  * received a copy of the GPL along with the OSKit; see the file COPYING.  If
+  * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
+  */
+ 
+ /* 
+    hashtab.c
+ 
+    Implementation of a generic hash table type.
+ */
+ 
+ #define NULL ((void *) 0)
+ 
+ #include "hashtab.h"
+ #include <linux/fs.h>
+ #include <linux/malloc.h>
+ 
+ #define MALLOC(ptr, type, size, d, e) \
+ 	(ptr) = (type) kmalloc((size), GFP_KERNEL)
+ #define FREE(addr, type) \
+ 	kfree((addr))
+ 
+ #define HASHTAB_DEBUG 0
+ 
+ hashtab_t hashtab_create(unsigned int (*hash_value)(hashtab_key_t key), 
+ 		         int (*keycmp)(hashtab_key_t key1, hashtab_key_t key2),
+ 		         unsigned int size)
+ {
+     hashtab_t p;
+     int i;
+ 
+ 
+     MALLOC(p, hashtab_t, sizeof(hashtab_val_t), M_TEMP, M_WAITOK);
+     if (p == NULL)
+ 	    return p;
+ 
+     p->size = size;
+     p->hash_value = hash_value;
+     p->keycmp = keycmp;
+     MALLOC(p->htable, hashtab_ptr_t *, sizeof(hashtab_ptr_t)*size, M_TEMP,M_WAITOK);
+     if (p->htable == NULL)
+     {
+ 	FREE(p, M_TEMP);
+ 	return NULL;
+     }
+ 
+     for (i = 0; i < size; i++)
+ 	    p->htable[i] = (hashtab_ptr_t) NULL;
+ 
+     return p;
+ }
+ 
+ 
+ int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
+ {
+     int hvalue;
+     hashtab_ptr_t current, newnode;
+ 
+ 
+     if (!h)
+ 	    return HASHTAB_OVERFLOW;
+     
+     hvalue = h->hash_value(key);
+     current = h->htable[hvalue];
+     while (current != NULL && h->keycmp(current->key, key) != 0)
+ 	    current = current->next;
+ 
+     if (current != NULL)
+ 	    return HASHTAB_PRESENT;
+ 
+     MALLOC(newnode, hashtab_ptr_t, sizeof(struct hashtab_node_t), M_TEMP, M_WAITOK);
+     if (newnode == NULL)
+ 	    return HASHTAB_OVERFLOW;
+     newnode->key = key;
+     newnode->datum = datum;
+     newnode->next = h->htable[hvalue];
+     h->htable[hvalue] = newnode;
+     return HASHTAB_SUCCESS;
+ }
+ 
+ int hashtab_remove(hashtab_t h, hashtab_key_t key, 
+ 		   void (*destroy)(hashtab_key_t, hashtab_datum_t, void *),
+ 		   void *args)
+ {
+     int hvalue;
+     hashtab_ptr_t current, last;
+ 
+ 
+     if (!h)
+ 	    return HASHTAB_MISSING;
+     
+     hvalue = h->hash_value(key);
+     last = NULL;
+     current = h->htable[hvalue];
+     while (current != NULL && h->keycmp(current->key, key))
+     {
+ 	last = current;
+ 	current = current->next;
+     }
+ 
+     if (current == NULL)
+ 	    return HASHTAB_MISSING;
+ 
+     if (last == NULL)
+ 	    h->htable[hvalue] = current->next;
+     else
+ 	    last->next = current->next;
+ 
+     if (destroy)
+ 	    destroy(current->key,current->datum,args);
+     FREE(current, M_TEMP);
+     return HASHTAB_SUCCESS;
+ }
+ 
+ hashtab_datum_t hashtab_search(hashtab_t h, hashtab_key_t key)
+ {
+     int hvalue;
+     hashtab_ptr_t current;
+ 
+ 
+     if (!h)
+ 	    return NULL;
+     
+     hvalue = h->hash_value(key);
+     current = h->htable[hvalue];
+     while (current != NULL && h->keycmp(current->key, key))
+ 	    current = current->next;
+ 
+     if (current == NULL)
+ 	    return NULL;
+ 
+     return current->datum;
+ }	    
+ 
+ void hashtab_destroy(hashtab_t h)
+ {
+     int i;
+     hashtab_ptr_t current, temp;
+ 
+ 
+     if (!h)
+ 	    return;
+ 
+     for (i = 0; i < h->size; i++)
+ 	{
+ 	    current = h->htable[i];
+ 	    while (current != NULL)
+ 	    {
+ 		temp = current;
+ 		current = current->next;
+ 		FREE(temp, M_TEMP);
+ 	    }
+ 	}
+ 
+     FREE(h->htable, M_TEMP);
+ 
+     FREE(h, M_TEMP);
+ }
+ 
+ int hashtab_map(hashtab_t h, int (*f)(hashtab_key_t, hashtab_datum_t,void*), void *p)
+ {
+     int i, ret;
+     hashtab_ptr_t current;
+ 
+ 
+     if (!h)
+ 	    return HASHTAB_SUCCESS;
+     
+     for (i = 0; i < h->size; i++)
+ 	{
+ 	    current = h->htable[i];
+ #if HASHTAB_DEBUG
+ 	    if (current != NULL)
+ 		    printf("\nchecking slot %d of %d.\n", i, h->size);
+ #endif HASHTAB_DEBUG
+ 	    while (current != NULL)
+ 	    {
+ 		ret = f(current->key, current->datum, p);
+ 		if (ret)
+ 			return ret;
+ 		current = current->next;
+ 	    }
+ 	}
+     return HASHTAB_SUCCESS;
+ }
+ 
+ void hashtab_map_remove_on_error(hashtab_t h, 
+ 				int (*f)(hashtab_key_t,hashtab_datum_t,void*),
+ 				void (*g)(hashtab_key_t,hashtab_datum_t,void*),
+ 				void *p)
+ {
+     int i, ret;
+     hashtab_ptr_t last, current, temp;
+ 
+ 
+     if (!h)
+ 	    return;
+     
+     for (i = 0; i < h->size; i++)
+ 	{
+ 	    last = NULL;
+ 	    current = h->htable[i];
+ #if HASHTAB_DEBUG
+ 	    if (current != NULL)
+ 		    printf("\nchecking slot %d of %d.\n", i, h->size);
+ #endif HASHTAB_DEBUG
+ 	    while (current != NULL)
+ 	    {
+ 		ret = f(current->key, current->datum, p);
+ 		if (ret)
+ 		{
+ 		    if (last)
+ 		    {
+ 			last->next = current->next;
+ 		    }
+ 		    else
+ 		    {
+ 			h->htable[i] = current->next;
+ 		    }
+ 		    
+ 		    temp = current;
+ 		    current = current->next;
+ 		    g(temp->key, temp->datum, p);
+ 		    FREE(temp, M_TEMP);
+ 		}
+ 		else
+ 		{
+ 		    last = current;
+ 		    current = current->next;
+ 		}
+ 	    }
+ 	}
+ 
+     return;
+ }
+ 
diff -Nr -c linux/fs/hashtab.h ../oskit-foo/linux/fs/hashtab.h
*** linux/fs/hashtab.h	Wed Dec 31 17:00:00 1969
--- ../oskit-foo/linux/fs/hashtab.h	Tue May 16 15:13:48 2000
***************
*** 0 ****
--- 1,161 ----
+ /*
+  * Copyright (c) 1997-1998 University of Utah and the Flux Group.
+  * All rights reserved.
+  * 
+  * This file is part of the Flux OSKit.  The OSKit is free software, also known
+  * as "open source;" you can redistribute it and/or modify it under the terms
+  * of the GNU General Public License (GPL), version 2, as published by the Free
+  * Software Foundation (FSF).  To explore alternate licensing terms, contact
+  * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
+  * 
+  * The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY
+  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+  * FOR A PARTICULAR PURPOSE.  See the GPL for more details.  You should have
+  * received a copy of the GPL along with the OSKit; see the file COPYING.  If
+  * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
+  */
+ 
+ /* 
+    hashtab.h
+ 
+    Definition of a generic hash table type.
+    
+    A hash table establishes an association between a set
+    of key values and a set of datum values.  Each entry in
+    the hash table is a (key,datum) pair.  Keys must uniquely
+    identify an entry in the hash table.
+ 
+    Keys and datums are pointers to objects of any type.  
+    The datum types may vary for different objects within
+    the same hash table.  
+ 
+    Collision resolution is performed using chaining.
+ */
+ 
+ #ifndef _HASHTAB_H_
+ #define _HASHTAB_H_
+ 
+ typedef char* hashtab_key_t;		       /* generic key type */
+ typedef void* hashtab_datum_t;		       /* generic datum type */
+ 
+ /* 
+   A node in a hash table is a (key,datum) pair.  
+ */
+ typedef struct hashtab_node_t* hashtab_ptr_t;
+ 
+ struct hashtab_node_t
+ {
+     hashtab_key_t key;
+     hashtab_datum_t datum;
+     hashtab_ptr_t next;			       /* link to next node in chain */
+ };
+ 
+ 
+ /* 
+   A hash table is implemented as a record containing:
+          an array of pointers to chains of nodes (htable)
+ 	 the number of slots in the array (size)
+ 	 the hash function to be used (hash_value)
+ 	 the comparison function for keys (keycmp)
+ 
+   The two functions, hash_value and keycmp, are defined when
+   a new hash table is created so that the hash table code need
+   not depend upon the types of the keys.
+ 
+   keycmp is expected to have the same semantics as strcmp,
+   although the implementation only requires the ability to
+   distinguish between equal keys and nonequal keys.
+ */
+ typedef struct 
+ {
+     hashtab_ptr_t *htable;
+     unsigned int size;
+     unsigned int (*hash_value)(hashtab_key_t key);
+     int (*keycmp)(hashtab_key_t key1, hashtab_key_t key2);
+ } hashtab_val_t;
+ 
+ 
+ typedef hashtab_val_t* hashtab_t;
+ 
+ /* Define status codes for hash table functions */
+ #define HASHTAB_SUCCESS     0		
+ #define HASHTAB_OVERFLOW    1
+ #define HASHTAB_PRESENT     2
+ #define HASHTAB_MISSING     3
+ 
+ /* 
+   Creates a new hash table with the specified characteristics.
+ 
+   Returns NULL if insufficent space is available or 
+   the new hash table otherwise.
+ */
+ hashtab_t hashtab_create(unsigned int (*hash_value)(hashtab_key_t key), 
+ 	           int (*keycmp)(hashtab_key_t key1, hashtab_key_t key2),
+ 	           unsigned int size);
+ 
+ /*
+   Inserts the specified (key, datum) pair into the specified hash table.
+ 
+   Returns HASHTAB_OVERFLOW if insufficient space is available or
+           HASHTAB_PRESENT  if there is already an entry with the same key or
+ 	  HASHTAB_SUCCESS otherwise.
+ */
+ int hashtab_insert(hashtab_t, hashtab_key_t, hashtab_datum_t);
+ 
+ /*
+   Removes the entry with the specified key from the hash table.
+   Applies the specified destructor to the (key,datum) pair.
+ 
+   Returns HASHTAB_MISSING if no entry has the specified key or
+           HASHTAB_SUCCESS otherwise.
+ */
+ int hashtab_remove(hashtab_t, hashtab_key_t, 
+ 		   void (*destroy)(hashtab_key_t, hashtab_datum_t, void *),
+ 		   void *);
+ 
+ /* 
+   Searches for the entry with the specified key in the hash table.
+ 
+   Returns NULL if no entry has the specified key or
+   the datum of the entry otherwise.
+ */
+ hashtab_datum_t hashtab_search(hashtab_t, hashtab_key_t);
+ 
+ /*
+   Destroys the specified hash table.
+ 
+   Note that this function does not destroy the keys and datums
+   stored in the specified hash table, since keys and datums were
+   allocated by the caller before insertion.
+ */
+ void hashtab_destroy(hashtab_t);
+ 
+ /* 
+   Applies the specified function to each (key,datum) pair in
+   the specified hash table.  The order in which the function
+   is applied to the entries is dependent upon the internal
+   structure of the hash table.
+ 
+   In addition to passing the (key,datum) pair to f, hashtab_map
+   passes the specified void* pointer to f on each invocation.
+ 
+   If f returns a non-zero status, then hashtab_map will cease
+   iterating through the hash table and will propagate the error
+   return to its caller.
+ */
+ int hashtab_map(hashtab_t, int (*f)(hashtab_key_t, hashtab_datum_t,void*), void*);
+ 
+ 
+ /*
+   Same as hashtab_map, except that if f returns a non-zero status,
+   then the (key,datum) pair will be removed from the hashtab and the
+   g function will be applied to the (key,datum) pair. 
+  */
+ void hashtab_map_remove_on_error(hashtab_t, 
+ 				int (*f)(hashtab_key_t,hashtab_datum_t,void*),
+ 				void (*g)(hashtab_key_t,hashtab_datum_t,void*),
+ 				void*);
+ 
+ #endif
+ 
+ 
diff -Nr -c linux/fs/init.c ../oskit-foo/linux/fs/init.c
*** linux/fs/init.c	Thu Feb 17 17:13:16 2000
--- ../oskit-foo/linux/fs/init.c	Tue May 16 15:23:33 2000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 1997, 1998, 1999 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
--- 1,5 ----
  /*
!  * Copyright (c) 1997-2000 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
***************
*** 22,27 ****
--- 22,35 ----
  
  #include "dev.h"
  #include "shared.h"
+ #include "hashtab.h"
+ 
+ /*
+  * Hash table
+  */
+ hashtab_t		dentrytab;	/* dentry -> oskit_file_t */
+ static oskit_error_t	dentrytab_init(void);
+ #define DENTRYTAB_SIZE	103
  
  #ifndef CPUNITS
  /*
***************
*** 63,68 ****
--- 71,79 ----
  	inode_init();
  	dcache_init();
  	buffer_init(0x1000000);
+ 
+ 	/* Create the dentry -> oskit_file_t hashtable */
+ 	dentrytab_init();
  #ifndef CPUNITS
  	real_fs_init();
  
***************
*** 71,73 ****
--- 82,111 ----
  	return 0;
  }
  
+ 
+ /*
+  * Hashtab support.
+  */
+ static unsigned int
+ dentryhash(hashtab_key_t key)
+ {
+ 	unsigned int h;
+ 	
+ 	h = (unsigned int) key;
+ 	return h % DENTRYTAB_SIZE;
+ }
+ 
+ static int
+ dentrycmp(hashtab_key_t key1, hashtab_key_t key2)
+ {
+ 	return !(key1 == key2);
+ }
+ 
+ static int
+ dentrytab_init(void)
+ {
+ 	dentrytab = hashtab_create(dentryhash, dentrycmp, DENTRYTAB_SIZE);
+ 	if (!dentrytab)
+ 		return OSKIT_ENOMEM;
+ 	return 0;
+ }
diff -Nr -c linux/fs/types.h ../oskit-foo/linux/fs/types.h
*** linux/fs/types.h	Thu Mar  9 18:59:08 2000
--- ../oskit-foo/linux/fs/types.h	Tue May 16 15:23:33 2000
***************
*** 1,5 ****
  /*
!  * Copyright (c) 1997, 1998, 1999 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
--- 1,5 ----
  /*
!  * Copyright (c) 1997-2000 The University of Utah and the Flux Group.
   * 
   * This file is part of the OSKit Linux Glue Libraries, which are free
   * software, also known as "open source;" you can redistribute them and/or
***************
*** 58,63 ****
--- 58,66 ----
  typedef struct gfile gfile_t;
  
  extern oskit_error_t gfile_create(gfilesystem_t *fs, struct dentry *dentry,
+ 				  gfile_t **out_file);
+ 
+ extern oskit_error_t gfile_lookup(gfilesystem_t *fs, struct dentry *dentry,
  				  gfile_t **out_file);
  
  /*
diff -Nr -c linux/shared/global.h ../oskit-foo/linux/shared/global.h
*** linux/shared/global.h	Mon Nov 15 17:54:13 1999
--- ../oskit-foo/linux/shared/global.h	Tue May 16 15:23:33 2000
***************
*** 83,88 ****
--- 83,89 ----
  #define kmem_cache_create OSKIT_LINUX_kmem_cache_create
  #define kmem_cache_free OSKIT_LINUX_kmem_cache_free
  #define linux_cli OSKIT_LINUX_linux_cli
+ #define linux_oskit_osenv_device OSKIT_LINUX_linux_oskit_osenv_device
  #define linux_oskit_osenv_driver OSKIT_LINUX_linux_oskit_osenv_driver
  #define linux_oskit_osenv_intr OSKIT_LINUX_linux_oskit_osenv_intr
  #define linux_oskit_osenv_ioport OSKIT_LINUX_linux_oskit_osenv_ioport

Follow-Ups: