diff -ru zealos-vanilla/doc/THANKS zealos-new/doc/THANKS
--- zealos-vanilla/doc/THANKS	Sun Apr 22 18:44:41 2001
+++ zealos-new/doc/THANKS	Wed May 16 10:16:51 2001
@@ -8,8 +8,9 @@
 		(S)nail-mail address, (O)ther
 - Mark
 
-N: aristeu (???)
+N: Aristeu Sergio Rozanski Filho
 I: _aris
+E: aris@cathedrallabs.org
 D: Helped with some stupid CVS questions, gave some ideas
 
 N: Silas Albrecht
diff -ru zealos-vanilla/generic/fs/vfs_inode.c zealos-new/generic/fs/vfs_inode.c
--- zealos-vanilla/generic/fs/vfs_inode.c	Mon Apr 30 01:45:02 2001
+++ zealos-new/generic/fs/vfs_inode.c	Wed May 16 11:56:40 2001
@@ -21,7 +21,8 @@
  */
 
 /* Notes/Changes:
- *
+ * 16/05/2001(_aris) - fixed some bugs in list management
+ * FIXME: we need some locks here :)
  */
 
 #include <common.h>
@@ -37,17 +38,14 @@
 // writting these functions :)
 struct inode *inode_lookup(struct inode *list, ulong i_num)
 {
-	struct inode *tmp;
+	for ( ; list && list->i_number != i_num; list = list->next);
 
-	for( tmp = list; tmp != NULL; tmp = tmp->next ) {
-		if (tmp->i_number == i_num) {
-			return tmp;
-		}
-	}
-	return tmp;	// null.......
+	return list;
 }
 
-errRet inode_add(struct inode *list, struct inode *to_add)
+// returns pointer to new root of inode list
+// in case of failing... failing? :)
+struct inode *inode_add(struct inode *list, struct inode *to_add)
 {
 	// make sure its not here =)
 //	if(inode_lookup(list, to_add->i_number != NULL)) {
@@ -56,61 +54,83 @@
 
 	to_add->next = list;
 	to_add->prev = NULL;
-	list = to_add;
 
-	return SUCCESS;
+	return list;
 }
 
-errRet inode_rm(struct inode *list, ulong i_num)
+// returns pointer to new root of inode list
+// it doesn't fail: it returns only the root of inode list if it sucessfully
+// erases or not the inode
+sturct inode *inode_rm(struct inode *list, ulong i_num)
 {
 	struct inode *inode = NULL;
 
 	if( (inode = inode_lookup(list, i_num)) == NULL) {
-		return ENOEXIST;
+		goto out;
 	}
 
 	if (inode->dirty) {
 		inode_write(inode);
 	}
 
-	inode->prev->next = inode->next;
-	inode->next->prev = inode->prev;
+	if (inode != list) {
+		inode->prev->next = inode->next;
+	}
+	else {
+		list = inode->next;
+	}
+	if (inode->next) {
+		inode->next->prev = inode->prev;
+	}
+
 	kfree(inode);
 
-	return SUCCESS;
+:out
+	return list;
 }
+
 /*
  * this makes sure the inode doesn't exist, does its best to fill out the 
  * inode, and adds it to the list...
+ * we shouldn't look if the inode already exists! we know what we're doing,
+ * aren't we? :) (_aris)
+ * also, we must keep allocation functions separated from insertion ones
  */
 struct inode *inode_make_new(struct sblock *sb, ulong i_num)
 {
 	struct inode *inode;
 
-	if (inode_lookup(sb->inodes, i_num) != NULL) {
-		return NULL;
-	}
+//	if (inode_lookup(sb->inodes, i_num) != NULL) {
+//		return NULL;
+//	}
 
 	inode = (struct inode *) kmalloc (sizeof(struct inode));
+	if (!inode) {
+		// insert a panic here :)
+	}
+	kmemset(inode, 0, sizeof(struct inode));
 
 	inode->i_number = i_num;
 	inode->sb = sb;
 	// anything else? :)
 
-	inode_add(sb->inodes, inode);
+//	inode_add(sb->inodes, inode);
 
 	return inode;
 }
 
+// we must do a null function to inodes that doesn't has write function and
+// transform this function in a static function to work only as macro
 void inode_write(struct inode *i)
 {
-	if (!i->dirty)
-		return;
-
-	if (!i->sb || !i->sb->super_ops || !i->sb->super_ops->write_inode) {
-		i->dirty = 0;
-		return;
-	}
+// no paranoia checkings, we already did it before
+//	if (!i->dirty)
+//		return;
+
+//	if (!i->sb || !i->sb->super_ops || !i->sb->super_ops->write_inode) {
+//		i->dirty = 0;
+//		return;
+//	}
 
 	i->sb->super_ops->write_inode(i);
 }
@@ -124,13 +144,12 @@
 // sync a list..
 void inode_sync_list(struct inode *list)
 {
-	struct inode *tmp;
-
-	for( tmp = list; tmp != NULL; tmp = tmp->next ) {
-		if (tmp->dirty) {
-			inode_write(tmp);
+	for ( ; list; list = list->next) {
+		if (list->dirty) {
+			inode_write(list);
 		}
-	}	
+	}
+
 	return;
 }
 
diff -ru zealos-vanilla/generic/fs/vfs_super.c zealos-new/generic/fs/vfs_super.c
--- zealos-vanilla/generic/fs/vfs_super.c	Mon Apr 30 01:45:02 2001
+++ zealos-new/generic/fs/vfs_super.c	Wed May 16 12:06:02 2001
@@ -22,6 +22,7 @@
 
 /* Notes/Changes:
  *	28/04/2001 - second time making this one :( (accidental rm, inode too)
+ *	16/05/2001 - what about don't use strings to identify fs types? (_aris)
  */
 
 #include <common.h>
@@ -38,13 +39,29 @@
 struct sblock *super_blocks = NULL, *last_sblock = NULL;
 
 // file_systems management
+struct fs_type *fs_type_create(char *fsname, struct s_ops *super_ops)
+{
+	struct fs_type *new;
+
+	new = (struct fs_type *)kmalloc(sizeof(struct fs_type));
+	if (new) {
+		kmemset(new, 0, sizeof(struct fs_type));
+
+		// we assume that fsname is an allocated space, we won't copy
+		new->fsname = fsname;
+		new->s_ops = s_ops;
+	}
+
+	return new;
+}
+
 struct fs_type *fs_type_find(char *fsname)
 {
 	struct fs_type *tmp;
 
-	for( tmp = file_systems; tmp != NULL; tmp = tmp->next ) {
+	for( tmp = file_systems; tmp; tmp = tmp->next ) {
 		if (kstrcmp(tmp->fsname, fsname)) {
-			return tmp;
+			break;
 		}
 	}
 
@@ -57,28 +74,56 @@
 		return EEXIST;
 	}
 
+	if (file_systems) {
+		file_systems->prev = fs;
+	}	
 	fs->next = file_systems;
+// we don't fill prev here because it's already NULL (kmemset)
 	file_systems = fs;
 
 	return SUCCESS;
 }
 
+// FIXME - this code is more list management. what about generic functions?
 errRet fs_type_unreg (struct fs_type *fs)
 {
-	struct fs_type *tmp, *old = NULL;
+	struct fs_type *tmp;
 
-	for( tmp = file_systems; tmp != NULL; tmp = tmp->next ) {
-		if (kstrcmp(tmp->fsname, fs->fsname)) {
-			(old?old->next:file_systems) = tmp->next;
-			kfree(tmp);
-			return SUCCESS; // or should it be ENOEXIST, muahaha!
-		}
-		old = tmp;
+	tmp = fs_type_find(fs->name);
+
+	if (!tmp) {
+		return ENOEXIST;
+	}
+
+	if (tmp != file_systems) {
+		tmp->prev->next = tmp->next;
+	}
+	else {
+		file_systems = tmp->next;
+	}
+	if (tmp->next) {
+		tmp->next->prev = tmp->prev;
 	}
-	return ENOEXIST;
+
+	kfree(tmp);
+
+	return ESUCESS;
 }
 
 // super_blocks management below!!
+struct sblock *sb_create(void)
+{
+	struct sblock *new;
+	// FIXME - i'm not filling any thing here, i don't know what's default
+
+	new = (struct sblock *)kmalloc(sizeof(struct sblock));
+	if (new) {
+		kmemset(new, 0, sizeof(struct sblock));
+		// fill your fields here :)
+	}
+	return new;
+}
+
 struct sblock *sb_find(struct devNum *dev)
 {
 	struct sblock *tmp = super_blocks;
@@ -91,19 +136,23 @@
 		if (tmp->dev->major == dev->major &&
 			tmp->dev->minor == dev->minor) {
 			last_sblock = tmp;
-			return (tmp);
+			break;
 		}
 	}
 
-	return tmp;	// NULL!
+	return tmp;
 }
 
 errRet sb_reg (struct sblock *sb)
 {
-	if (sb_find(sb->dev) != NULL) {
-		return EEXIST;
-	}
+// no paranoia :)
+//	if (sb_find(sb->dev) != NULL) {
+//		return EEXIST;
+//	}
 
+	if (super_blocks) {
+		super_blocks->prev = sb;
+	}
 	sb->next = super_blocks;
 	super_blocks = sb;
 
@@ -112,27 +161,38 @@
 
 errRet sb_unreg (struct devNum *dev)
 {
-	struct sblock *tmp = super_blocks, *old = NULL;
+	struct sblock *tmp;
 
-	for (; tmp != NULL; tmp = tmp->next) {
-		if (tmp->dev->major == dev->major &&
-		    tmp->dev->minor == dev->minor) { 
-			// w00t! got 'im
-			if (tmp->super_ops && tmp->super_ops->write_super)
-				tmp->super_ops->write_super(tmp);
-			(old?old->next:super_blocks) = tmp->next;
-			kfree(tmp);
-			return SUCCESS;
-		}
-		old = tmp;
+	tmp = sb_find(dev);
+
+	if (!tmp) {
+		return ENOEXIST;
+	}
+
+	if (tmp != super_blocks) {
+		tmp->prev->next = tmp->next;
+	}
+	else {
+		superblocks = tmp->next;
 	}
+	if (tmp->next) {
+		tmp->next->prev = tmp->prev;
+	}
+
+	if (last_sblock == tmp) {
+		last_sblock = NULL;
+	}
+
+	kfree(tmp);
 
-	return ENOEXIST;
+	return SUCESS;
 }
 
+EXPORT_SYMBOL(fs_type_create);
 EXPORT_SYMBOL(fs_type_find);
 EXPORT_SYMBOL(fs_type_reg);
 EXPORT_SYMBOL(fs_type_unreg);
+EXPORT_SYMBOL(sb_create);
 EXPORT_SYMBOL(sb_find);
 EXPORT_SYMBOL(sb_reg);
 EXPORT_SYMBOL(sb_unreg);
diff -ru zealos-vanilla/include/generic/fs/vfs.h zealos-new/include/generic/fs/vfs.h
--- zealos-vanilla/include/generic/fs/vfs.h	Sat May 12 07:27:01 2001
+++ zealos-new/include/generic/fs/vfs.h	Wed May 16 11:54:19 2001
@@ -60,6 +60,7 @@
 	char *fsname;
 	struct s_ops *super_ops;
 	struct fs_type *next;
+	struct fs_type *prev;
 };
 
 /* 
@@ -85,10 +86,18 @@
 
 	ulong		inode_in_use;	// FIXME: not used yet
 
+// FIXME - what about a different struct here? like a struct for linking only
+//         dirty inodes?
+//         ex: struct dirty_inodes {
+//             		struct inode *inode;
+//                      struct dirty_inodes *next;
+//                      struct dirty_inodes *prev;
+//
 	struct inode	*dirty_inodes;	// used for quick sync'ing
 	struct inode	*inodes;
 
 	struct sblock	*next;
+	struct sblock	*prev;
 };
 
 struct i_ops {

