[Kos-cvs] kos/modules/karm Makefile, 1.12, 1.13 mount.c, 1.9, 1.10 open.c, 1.13, 1.14

thomas at kos.enix.org thomas at kos.enix.org
Sun Jan 30 17:11:22 CET 2005


Update of /home/kos/cvs/kos/modules/karm
In directory the-doors:/tmp/cvs-serv3480/modules/karm

Modified Files:
	Makefile mount.c open.c 
Log Message:
2005-01-30  Thomas Petazzoni  <thomas at crazy.kos.nx>

	* modules/x86/mm/Makefile (DEBUG_LEVEL): 1 -> 0

	* modules/vmm/_vmm_as.c: Moved as_dump and vr_dump, create
	as_dump_unsafe.

	* modules/vmm/Makefile (DEBUG_LEVEL): 3 -> 0

	* modules/tty/_tty.c, modules/tty/_tty_kres.c: DEBUG_PRINTx
	conformance + memset().

	* modules/lib/blockfile/libblockfile.c,
	modules/lib/charfile/libcharfile.c,
	modules/lib/filemap/libfilemap.c: Added memset() needed when
	allocated buffer is poisoned. Whitespaces.

	* modules/kmem/_kvmem_free.c: DEBUG_PRINTx conformance +
	whitespaces.

	* modules/kmem/_kvmem_alloc.c (kvalloc): Poison the allocated
	memory + DEBUG_PRINTx conformance.

	* modules/kmem/_kslab_cache_free.c (__kslab_cache_free_by_slab):
	Poison the freed buffer.

	* modules/kmem/_kslab_cache_alloc.c (kslab_cache_alloc): Poison
	the allocated buffer.

	* modules/kmem/_kmem_free.c (kfree): DEBUG_PRINTx conformance.

	* modules/kmem/_kmem_alloc.c (kmalloc): Whitespaces + DEBUG_PRINTx
	conformance.

	* modules/kitc/_kmutex.c: Remove [function] as they are generated
	by DEBUG_PRINTx now.

	* modules/karm/open.c: Whitespaces.

	* modules/karm/mount.c (mount): Cleaned the way of calling
	fs->attach().

	* modules/ide/_ide_karm.c: More debugging messages.

	* modules/ide/_ide.h (ide_device_info): Correct position of packed
	attribute to make gcc happy.

	* modules/part/Makefile (DEBUG_LEVEL), modules/karm/Makefile
	(DEBUG_LEVEL), modules/ide/Makefile
	(DEBUG_LEVEL), modules/fs/devfs/Makefile
	(DEBUG_LEVEL), modules/fs/fat/Makefile
	(DEBUG_LEVEL) : New variable.

	* modules/fs/devfs/devfs.c, modules/fs/fat/_fat.c,
	modules/fs/fat/_fat_karm.c: Added memset() found using the
	poisoning stuff in kmem. More debugging messages using
	DEBUG_PRINTx.

	* modules/debug/debug.h: DEBUG_PRINTx macros now call
	DEBUG_PRINT_VERBOSE instead of __dbg_printk, so that the line
	number, function and file names are printed before the debug
	message.

	* TODO: More things to do.



Index: Makefile
===================================================================
RCS file: /home/kos/cvs/kos/modules/karm/Makefile,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Makefile	30 Dec 2003 00:41:30 -0000	1.12
+++ Makefile	30 Jan 2005 16:11:20 -0000	1.13
@@ -1,6 +1,8 @@
 OBJS=interface.o interface-desc.o kres.o view.o ures.o nscache.o\
      open.o close.o fs_support.o mount.o syscall.o karm.o
 
+DEBUG_LEVEL=0
+
 all: karm.ro
 
 karm.ro: $(OBJS)

Index: mount.c
===================================================================
RCS file: /home/kos/cvs/kos/modules/karm/mount.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mount.c	21 Aug 2003 15:33:41 -0000	1.9
+++ mount.c	30 Jan 2005 16:11:20 -0000	1.10
@@ -32,14 +32,17 @@
   struct kres       *root_kr;
   void              *fs_infos;
   struct nsnode     *root_node;
-  int result;
+  result_t result;
 
   ASSERT_RETURN_VAL(mountpoint && fs, -1);
 
   /* Attach the filesystem */
-  if (fs->attach(device, &root_kr, &fs_infos, conf) != 0)
+  result = fs->attach(device, &root_kr, &fs_infos, conf);
+
+  if(result < 0)
     {
-      return -1;
+      DEBUG_PRINT2("[mount] fs->attach failed : %s\n", strerror(result));
+      return result;
     }
 
   /* Mount the root filesystem */

Index: open.c
===================================================================
RCS file: /home/kos/cvs/kos/modules/karm/open.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- open.c	21 Aug 2003 15:33:41 -0000	1.13
+++ open.c	30 Jan 2005 16:11:20 -0000	1.14
@@ -17,7 +17,7 @@
 #define BIG_OPEN_LOCK() write_spin_lock(big_open_spinlock, flags);
 #define BIG_OPEN_UNLOCK() write_spin_unlock(big_open_spinlock, flags);
 
-// #define OPEN_DEBUGGING
+//#define OPEN_DEBUGGING
 
 #ifdef OPEN_DEBUGGING
  #define OPEN_DEBUG(fmt,args...) __dbg_printk(_B_GREEN "[open] " fmt _B_NORM, ## args)
@@ -28,7 +28,7 @@
 /** Open an object with a specific interface. The object is specified
     using a location in the global namespace (e.g "/dev/disk/hda"),
     and the interface is specified using an unique interface ID.
-    
+
     @param path      The location of the object to open in the global
                      namespace.
 
@@ -66,7 +66,7 @@
   /** Find the deepest node already opened in the cache */
   result = nscache_lookup(NULL,NULL,path, &remaining_path, & cnode);
 
-  OPEN_DEBUG("open: nscache_lookup returned %d (remaining path=%s %d)\n", 
+  OPEN_DEBUG("open: nscache_lookup returned %d (remaining path=%s %d)\n",
 	     result, remaining_path, *remaining_path);
 
   /** If all the path has been resolved through the cache, there's no
@@ -83,7 +83,7 @@
       size_t len;
 
       OPEN_DEBUG("Remaining_path=[%s]\n", remaining_path);
-      
+
       len = dirname_len(remaining_path, &begin_dirname);
 
       /* Did we reach the leaf ressource to open ? */
@@ -99,16 +99,16 @@
 	      with the good interface, and to register the ures */
 	  stop = TRUE;
 	}
-      else 
+      else
 	{
 	  /** We are not at the end, so create a zero-terminated
 	      string so that we can lookup this part of the path */
 	  begin_dirname[len] = '\0';
 	}
-      
+
       OPEN_DEBUG("look for [%s], in cnode [%s]\n", begin_dirname, cnode->name);
-      
-      if(! strcmp(begin_dirname, ".")) 
+
+      if(! strcmp(begin_dirname, "."))
 	{
 	  tnode = cnode;
 	}
@@ -118,28 +118,28 @@
 		     cnode->name, cnode->parent->name);
 	  tnode = cnode->parent;
 	}
-      else 
+      else
 	{
 	  OPEN_DEBUG("Open the current node %s as a directory :"
-		     "cnode=%p, kres=%p\n", 
+		     "cnode=%p, kres=%p\n",
 		     cnode->name, cnode, cnode->kres);
 
 	  /** open the current node as a directory, so that we can lookup
 	      through it */
 	  result = ures_open(cnode->kres, INTERFACE_DIR_ID, & tmp_ures);
-	  
-	  if(result < 0) 
+
+	  if(result < 0)
 	    {
 	      BIG_OPEN_UNLOCK();
 	      return result;
 	    }
-	  
+
 	  OPEN_DEBUG("Allocate a new node and open the next temporary node "
 		     "name = %s\n", begin_dirname);
 
 	  /** allocate a new node and open the next temporary node */
 	  result = nsnode_alloc(begin_dirname, & tnode);
-	  
+
 	  if(result < 0)
 	    {
 	      ures_close(tmp_ures);
@@ -147,21 +147,21 @@
 	      BIG_OPEN_UNLOCK();
 	      return result;
 	    }
-	  
+
 	  result = DIR_OPS(tmp_ures->view->ops)
 	    ->lookup(tmp_ures, begin_dirname, &kres);
-	  
+
 	  if(result < 0) {
 	    nsnode_free(tnode);
 	    ures_close(tmp_ures);
-	    OPEN_DEBUG("lookup failed with %d\n", result);
+	    OPEN_DEBUG("lookup failed on %s : %s\n", path, strerror(result));
 	    BIG_OPEN_UNLOCK();
 	    return result;
 	  }
-	  
+
 	  /** free the useless directory node */
 	  result = ures_close(tmp_ures);
-	  
+
 	  if(result < 0)
 	    {
 	      nsnode_free(tnode);
@@ -169,19 +169,19 @@
 	      BIG_OPEN_UNLOCK();
 	      return result;
 	    }
-	  
+
 	  /** setup the new temporary node */
 	  tnode->kres = kres;
 	  tnode->local_root = cnode->local_root;
-	  
+
 	  /** insert the new node as a current node leaf */
 	  nscache_attach(cnode, tnode);
 	}
-      
+
       if(! stop) {
-	begin_dirname[len] = '/';     /** < restore the path */      
+	begin_dirname[len] = '/';     /** < restore the path */
       }
-      
+
       cnode = tnode;                /** < go deeper in the tree */
       remaining_path = begin_dirname + len;
     }
@@ -190,7 +190,7 @@
 
   /** open the leaf resource with the proper interface */
   result = ures_open(cnode->kres, interface, & tmp_ures);
-  
+
   if(result < 0)
     {
       /* TODO : undo what was done */



More information about the Kos-cvs mailing list