[rtems commit] JFFS2: Add device identifier for the flash device

Sebastian Huber sebh at rtems.org
Fri Jun 13 14:00:22 UTC 2014


Module:    rtems
Branch:    master
Commit:    73bf499ce7710ff8e75833042f88d1ff5b3e84fa
Changeset: http://git.rtems.org/rtems/commit/?id=73bf499ce7710ff8e75833042f88d1ff5b3e84fa

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 10 10:56:55 2014 +0200

JFFS2: Add device identifier for the flash device

It is used in combination with the inode number to uniquely identify a
file system node in the system.

---

 cpukit/libfs/src/jffs2/include/rtems/jffs2.h |   11 ++++++++++-
 cpukit/libfs/src/jffs2/src/fs-rtems.c        |    7 +++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/cpukit/libfs/src/jffs2/include/rtems/jffs2.h b/cpukit/libfs/src/jffs2/include/rtems/jffs2.h
index e69fc20..7b2f4d5 100644
--- a/cpukit/libfs/src/jffs2/include/rtems/jffs2.h
+++ b/cpukit/libfs/src/jffs2/include/rtems/jffs2.h
@@ -118,7 +118,8 @@ typedef struct rtems_jffs2_flash_control rtems_jffs2_flash_control;
  *     .flash_size = FLASH_SIZE,
  *     .read = flash_read,
  *     .write = flash_write,
- *     .erase = flash_erase
+ *     .erase = flash_erase,
+ *     .device_identifier = 0xc01dc0fe
  *   }
  * };
  *
@@ -265,6 +266,14 @@ struct rtems_jffs2_flash_control {
    * This operation is optional and the pointer may be @c NULL.
    */
   rtems_jffs2_flash_destroy destroy;
+
+  /**
+   * @brief The device identifier of the flash device.
+   *
+   * It is used in combination with the inode number to uniquely identify a
+   * file system node in the system.
+   */
+  dev_t device_identifier;
 };
 
 typedef struct rtems_jffs2_compressor_control rtems_jffs2_compressor_control;
diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c
index 85f9ede..00a52bd 100644
--- a/cpukit/libfs/src/jffs2/src/fs-rtems.c
+++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c
@@ -405,9 +405,12 @@ static int rtems_jffs2_fstat(
 )
 {
 	struct _inode *inode = rtems_jffs2_get_inode_by_location(loc);
+	struct super_block *sb = inode->i_sb;
+	rtems_jffs2_flash_control *fc = sb->s_flash_control;
 
-	rtems_jffs2_do_lock(inode->i_sb);
+	rtems_jffs2_do_lock(sb);
 
+	buf->st_dev = fc->device_identifier;
 	buf->st_blksize = PAGE_SIZE;
 	buf->st_mode = inode->i_mode;
 	buf->st_ino = inode->i_ino;
@@ -419,7 +422,7 @@ static int rtems_jffs2_fstat(
 	buf->st_mtime = inode->i_mtime;
 	buf->st_ctime = inode->i_ctime;
 
-	rtems_jffs2_do_unlock(inode->i_sb);
+	rtems_jffs2_do_unlock(sb);
 
 	return 0;
 }



More information about the vc mailing list