Index: trunk/kernel/fs/devfs.c
===================================================================
--- trunk/kernel/fs/devfs.c	(revision 614)
+++ trunk/kernel/fs/devfs.c	(revision 623)
@@ -3,5 +3,5 @@
  *
  * Author   Mohamed Lamine Karaoui (2014,2015)
- *          Alain Greiner (2016,2017)
+ *          Alain Greiner (2016,2017,2018,2019)
  *
  * Copyright (c) Sorbonne Universites
@@ -91,10 +91,10 @@
                         xptr_t * devfs_external_inode_xp )
 {
-    error_t  error;
-    xptr_t   unused_xp;   // required by vfs_add_child_in_parent()
+    error_t       error;
+    xptr_t        unused_xp;   // required by vfs_add_child_in_parent()
+    vfs_inode_t * inode;
 
     // create DEVFS "dev" inode in cluster 0
     error = vfs_add_child_in_parent( 0,                // cxy
-                                     INODE_TYPE_DIR,
                                      FS_TYPE_DEVFS,
                                      root_inode_xp,
@@ -103,10 +103,17 @@
                                      devfs_dev_inode_xp );
 
+    // update inode "type" field
+    inode = GET_PTR( *devfs_dev_inode_xp );
+    inode->type = INODE_TYPE_DIR;
+ 
     // create dentries <.> and <..> in <dev>
     error |= vfs_add_special_dentries( *devfs_dev_inode_xp,
                                        root_inode_xp );
 
-// check success
-assert( (error == 0) , "cannot create <dev>\n" );
+    if( error )
+    {
+        printk("\n[PANIC] in %s : cannot create <dev> directory\n", __FUNCTION__ );
+        hal_core_sleep();
+    }
 
 #if DEBUG_DEVFS_GLOBAL_INIT
@@ -120,5 +127,4 @@
     // create DEVFS "external" inode in cluster 0
     error = vfs_add_child_in_parent( 0,               // cxy
-                                     INODE_TYPE_DIR,
                                      FS_TYPE_DEVFS,
                                      *devfs_dev_inode_xp,
@@ -127,10 +133,17 @@
                                      devfs_external_inode_xp );
 
+    // update inode "type" field
+    inode = GET_PTR( *devfs_external_inode_xp );
+    inode->type = INODE_TYPE_DIR;
+ 
     // create dentries <.> and <..> in <external>
     error |= vfs_add_special_dentries( *devfs_external_inode_xp,
                                        *devfs_dev_inode_xp );
 
-// check success
-assert( (error == 0) , "cannot create <external>\n" );
+    if( error )
+    {
+        printk("\n[PANIC] in %s : cannot create <external> directory\n", __FUNCTION__ );
+        hal_core_sleep();
+    }
 
 #if DEBUG_DEVFS_GLOBAL_INIT
@@ -153,5 +166,4 @@
     chdev_t     * chdev_ptr;
     xptr_t        inode_xp;
-    cxy_t         inode_cxy;
     vfs_inode_t * inode_ptr;
     uint32_t      channel;
@@ -171,5 +183,4 @@
 
     error = vfs_add_child_in_parent( local_cxy,
-                                     INODE_TYPE_DIR,
                                      FS_TYPE_DEVFS,
                                      devfs_dev_inode_xp,
@@ -178,10 +189,17 @@
                                      devfs_internal_inode_xp );
 
+    // set inode "type" field
+    inode_ptr = GET_PTR( *devfs_internal_inode_xp );
+    inode_ptr->type = INODE_TYPE_DEV;
+ 
     // create dentries <.> and <..> in <internal>
     error |= vfs_add_special_dentries( *devfs_internal_inode_xp,
                                        devfs_dev_inode_xp );
 
-// check success
-assert( (error == 0) , "cannot create <external>\n" );
+    if( error )
+    {
+        printk("\n[PANIC] in %s : cannot create <internal> directory\n", __FUNCTION__ );
+        hal_core_sleep();
+    }
 
 #if DEBUG_DEVFS_LOCAL_INIT 
@@ -199,8 +217,12 @@
         chdev_cxy = GET_CXY( chdev_xp );
 
-assert( (chdev_cxy == local_cxy ), "illegal MMC chdev in cluster %x\n", local_cxy );
+        if( chdev_cxy != local_cxy )
+        {
+            printk("\n[PANIC] in %s : illegal MMC chdev in cluster %x\n",
+            __FUNCTION__, local_cxy );
+            hal_core_sleep();
+        }
 
         error = vfs_add_child_in_parent( local_cxy,
-                                         INODE_TYPE_DEV,
                                          FS_TYPE_DEVFS,
                                          *devfs_internal_inode_xp,
@@ -209,10 +231,15 @@
                                          &inode_xp );
 
-assert( (error == 0) , "cannot create MMC inode\n" );
-
-        // update child inode "extend" field
-        inode_cxy = GET_CXY( inode_xp );
+        if( error )
+        {
+            printk("\n[PANIC] in %s : cannot create MMC inode in cluster %x\n",
+            __FUNCTION__, local_cxy );
+            hal_core_sleep();
+        }
+
+        // update child inode "extend" and "type" fields
         inode_ptr = GET_PTR( inode_xp );
-        hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+        inode_ptr->extend = chdev_ptr;
+        inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -234,8 +261,12 @@
             chdev_cxy = GET_CXY( chdev_xp );
 
-assert( (chdev_cxy == local_cxy ), "illegal DMA chdev in cluster %x\n", local_cxy );
+            if( chdev_cxy != local_cxy )
+            {
+                printk("\d[PANIC] in %s : illegal DMA chdev in cluster %x\n",
+                __FUNCTION__, local_cxy );
+                hal_core_sleep();
+            }
 
             error = vfs_add_child_in_parent( local_cxy,
-                                             INODE_TYPE_DEV,
                                              FS_TYPE_DEVFS,
                                              *devfs_internal_inode_xp,
@@ -243,11 +274,15 @@
                                              &unused_xp,
                                              &inode_xp );
-
-assert( (error == 0) , "cannot create DMA inode\n" );
-
-            // update child inode "extend" field
-            inode_cxy = GET_CXY( inode_xp );
+            if( error )
+            {
+                printk("\n[PANIC] in %s : cannot create DMA inode in cluster %x\n",
+                __FUNCTION__, local_cxy );
+                hal_core_sleep();
+            }
+
+            // update child inode "extend" and "type" fields
             inode_ptr = GET_PTR( inode_xp );
-            hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+            inode_ptr->extend = chdev_ptr;
+            inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -270,5 +305,4 @@
         {
             error = vfs_add_child_in_parent( local_cxy,
-                                             INODE_TYPE_DEV,
                                              FS_TYPE_DEVFS,
                                              devfs_external_inode_xp,
@@ -276,11 +310,15 @@
                                              &unused_xp,
                                              &inode_xp );
-
-assert( (error == 0) , "cannot create IOB inode\n" );
-
-            // update child inode "extend" field
-            inode_cxy = GET_CXY( inode_xp );
+            if( error )
+            {
+                printk("\n[PANIC] in %s : cannot create IOB inode in cluster %x\n",
+                __FUNCTION__, local_cxy );
+                hal_core_sleep();
+            }
+
+            // update child inode "extend" and "type" fields
             inode_ptr = GET_PTR( inode_xp );
-            hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+            inode_ptr->extend = chdev_ptr;
+            inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -303,5 +341,4 @@
         {
             error = vfs_add_child_in_parent( local_cxy,
-                                             INODE_TYPE_DEV,
                                              FS_TYPE_DEVFS,
                                              devfs_external_inode_xp,
@@ -310,10 +347,15 @@
                                              &inode_xp );
 
-assert( (error == 0) , "cannot create PIC inode\n" );
+            if( error )
+            {
+                printk("\n[PANIC] in %s : cannot create PIC inode in cluster %x\n",
+                __FUNCTION__, local_cxy );
+                hal_core_sleep();
+            }
 
             // update child inode "extend" field
-            inode_cxy = GET_CXY( inode_xp );
             inode_ptr = GET_PTR( inode_xp );
-            hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+            inode_ptr->extend = chdev_ptr;
+            inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -338,5 +380,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -345,10 +386,15 @@
                                                  &inode_xp );
 
-assert( (error == 0) , "cannot create TXT_RX inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create TXT_RX inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -374,5 +420,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -380,11 +425,15 @@
                                                  &unused_xp,
                                                  &inode_xp );
-
-assert( (error == 0) , "cannot create TXT_TX inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create TXT_TX inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT 
@@ -410,5 +459,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -416,11 +464,15 @@
                                                  &unused_xp,
                                                  &inode_xp );
-
-assert( (error == 0) , "cannot create IOC inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create IOC inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -446,5 +498,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -452,11 +503,15 @@
                                                  &unused_xp,
                                                  &inode_xp );
-
-assert( (error == 0) , "cannot create FBF inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create FBF inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -482,5 +537,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -488,11 +542,15 @@
                                                  &unused_xp,
                                                  &inode_xp );
-
-assert( (error == 0) , "cannot create NIC_RX inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create NIC_RX inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
  
 #if DEBUG_DEVFS_LOCAL_INIT
@@ -518,5 +576,4 @@
             {
                 error = vfs_add_child_in_parent( local_cxy,
-                                                 INODE_TYPE_DEV,
                                                  FS_TYPE_DEVFS,
                                                  devfs_external_inode_xp,
@@ -524,11 +581,15 @@
                                                  &unused_xp,
                                                  &inode_xp );
-
-assert( (error == 0) , "cannot create NIC_TX inode\n" );
-
-                // update child inode "extend" field
-                inode_cxy = GET_CXY( inode_xp );
+                if( error )
+                {
+                    printk("\n[PANIC] in %s : cannot create NIC_TX inode in cluster %x\n",
+                    __FUNCTION__, local_cxy );
+                    hal_core_sleep();
+                }
+
+                // update child inode "extend" and "type" fields
                 inode_ptr = GET_PTR( inode_xp );
-                hal_remote_spt( XPTR( inode_cxy , &inode_ptr->extend ) , chdev_ptr );
+                inode_ptr->extend = chdev_ptr;
+                inode_ptr->type   = INODE_TYPE_DEV;
         
 #if DEBUG_DEVFS_LOCAL_INIT
