[Kos-cvs] kos/modules/fs/devfs Makefile,1.1,1.2 devfs.c,1.7,1.8

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/fs/devfs
In directory the-doors:/tmp/cvs-serv3480/modules/fs/devfs

Modified Files:
	Makefile devfs.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/fs/devfs/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	17 Aug 2003 19:54:05 -0000	1.1
+++ Makefile	30 Jan 2005 16:11:20 -0000	1.2
@@ -1,5 +1,7 @@
 OBJS= devfs.o
 
+DEBUG_LEVEL=0
+
 all: devfs.ro
 
 devfs.ro: $(OBJS)

Index: devfs.c
===================================================================
RCS file: /home/kos/cvs/kos/modules/fs/devfs/devfs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- devfs.c	28 Dec 2004 18:44:19 -0000	1.7
+++ devfs.c	30 Jan 2005 16:11:20 -0000	1.8
@@ -61,9 +61,15 @@
 
   if(ndev == NULL)
     {
+      DEBUG_PRINT2("Returning -ENOMEM\n");
       return -ENOMEM;
     }
 
+  DEBUG_PRINT3("Register device %s in group %s (0x%x)\n",
+	       dev_name, group, (unsigned) ndev);
+
+  memset(ndev, 0, sizeof(struct devfs_device));
+
   ndev->group = strdup(group);
   ndev->dev   = strdup(dev_name);
   ndev->kres  = kres;
@@ -196,8 +202,12 @@
       struct devfs_device *device;
       int i;
 
+      DEBUG_PRINT2("[devfs_lookup] Lookup %s in root directory\n", name);
+
       list_foreach(devices_list, device, i)
 	{
+	  DEBUG_PRINT2("[devfs_lookup] Comparing %s <=> %s\n", device->group, name);
+
 	  if(!strcmp(device->group, name))
 	    {
 	      /* Ok, at least one device in this group */
@@ -221,6 +231,8 @@
 		  return -ENOMEM;
 		}
 
+	      memset(view, 0x0, sizeof(struct view));
+
 	      view_data = kmalloc(sizeof(struct devfs_view_data));
 	      if(view_data == NULL)
 		{
@@ -229,6 +241,8 @@
 		  return -ENOMEM;
 		}
 
+	      memset(view_data, 0x0, sizeof(struct devfs_view_data));
+
 	      view_data->type  = SUB_KRES;
 	      view_data->group = strdup(name);
 
@@ -254,6 +268,8 @@
 	    }
 	}
 
+      DEBUG_PRINT2("[devfs_lookup] Group '%s' was not found\n", name);
+
       /* Group wasn't found */
       return -ENOENT;
     }
@@ -264,6 +280,8 @@
       struct devfs_device *device;
       int i;
 
+      DEBUG_PRINT2("[devfs_lookup] Lookup %s in directory %s\n", name, data->group);
+
       list_foreach(devices_list, device, i)
 	{
 	  /* We have to find a decide whose group in the good one (the



More information about the Kos-cvs mailing list