[PATCH 2/3] IMFS: Use rtems_filesystem_make_dev_t_from_pointer

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 4 13:46:25 UTC 2015


---
 cpukit/libfs/src/imfs/imfs.h          | 19 +------------------
 cpukit/libfs/src/imfs/imfs_initsupp.c |  3 ---
 cpukit/libfs/src/imfs/imfs_stat.c     | 10 ++--------
 3 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h
index b8ff29d..c296bff 100644
--- a/cpukit/libfs/src/imfs/imfs.h
+++ b/cpukit/libfs/src/imfs/imfs.h
@@ -228,19 +228,6 @@ typedef struct {
 /**@{*/
 
 /*
- * Major device number for the IMFS. This is not a real device number because
- * the IMFS is just a file system and does not have a driver.
- */
-#define IMFS_DEVICE_MAJOR_NUMBER (0xfffe)
-
-/**
- * @ingroup IMFSGenericNodes
- *
- * @brief Generic IMFS device major number.
- */
-#define IMFS_GENERIC_DEVICE_MAJOR_NUMBER (0xfffd)
-
-/*
  *  Maximum length of a "basename" of an IMFS file/node.
  */
 
@@ -385,7 +372,6 @@ static inline void IMFS_mtime_ctime_update( IMFS_jnode_t *jnode )
 }
 
 typedef struct {
-  int instance;
   ino_t ino_count;
   const IMFS_node_control *node_controls [IMFS_TYPE_COUNT];
 } IMFS_fs_info_t;
@@ -1008,10 +994,7 @@ static inline dev_t IMFS_generic_get_device_identifier_by_node(
   const IMFS_jnode_t *node
 )
 {
-  return rtems_filesystem_make_dev_t(
-    IMFS_GENERIC_DEVICE_MAJOR_NUMBER,
-    node->st_ino
-  );
+  return rtems_filesystem_make_dev_t_from_pointer( node );
 }
 
 #ifdef __cplusplus
diff --git a/cpukit/libfs/src/imfs/imfs_initsupp.c b/cpukit/libfs/src/imfs/imfs_initsupp.c
index 5f857d1..563d620 100644
--- a/cpukit/libfs/src/imfs/imfs_initsupp.c
+++ b/cpukit/libfs/src/imfs/imfs_initsupp.c
@@ -61,15 +61,12 @@ int IMFS_initialize_support(
   const IMFS_node_control *const node_controls [IMFS_TYPE_COUNT]
 )
 {
-  static int imfs_instance;
-
   int rv = 0;
   IMFS_fs_info_t *fs_info = calloc( 1, sizeof( *fs_info ) );
 
   if ( fs_info != NULL ) {
     IMFS_jnode_t *root_node;
 
-    fs_info->instance = imfs_instance++;
     memcpy(
       fs_info->node_controls,
       node_controls,
diff --git a/cpukit/libfs/src/imfs/imfs_stat.c b/cpukit/libfs/src/imfs/imfs_stat.c
index 1499d2b..3d07fe8 100644
--- a/cpukit/libfs/src/imfs/imfs_stat.c
+++ b/cpukit/libfs/src/imfs/imfs_stat.c
@@ -28,16 +28,10 @@ int IMFS_stat(
   struct stat *buf
 )
 {
-  IMFS_fs_info_t *fs_info = loc->mt_entry->fs_info;
+  const IMFS_fs_info_t *fs_info = loc->mt_entry->fs_info;
   IMFS_jnode_t *the_jnode = loc->node_access;
 
-  /*
-   * The device number of the IMFS is the major number and the minor is the
-   * instance.
-   */
-  buf->st_dev =
-    rtems_filesystem_make_dev_t( IMFS_DEVICE_MAJOR_NUMBER, fs_info->instance );
-
+  buf->st_dev   = rtems_filesystem_make_dev_t_from_pointer( fs_info );
   buf->st_mode  = the_jnode->st_mode;
   buf->st_nlink = the_jnode->st_nlink;
   buf->st_ino   = the_jnode->st_ino;
-- 
1.8.1.4




More information about the devel mailing list