forked from Imagelibrary/rtems
2010-05-15 Chris Johns <chrisj@rtems.org>
* libfs/src/imfs/imfs_initsupp.c, libfs/src/imfs/imfs.h,
libfs/src/imfs/imfs_stat.c: PR1419. Return a device for the IMFS.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2010-05-15 Chris Johns <chrisj@rtems.org>
|
||||
|
||||
* libfs/src/imfs/imfs_initsupp.c, libfs/src/imfs/imfs.h,
|
||||
libfs/src/imfs/imfs_stat.c: PR1419. Return a device for the IMFS.
|
||||
|
||||
2010-05-14 Chris Johns <chrisj@rtems.org>
|
||||
|
||||
* libblock/src/flashdisk.c: Clean up on initialisation errors.
|
||||
|
||||
@@ -155,6 +155,12 @@ typedef union {
|
||||
IMFS_fifo_t fifo;
|
||||
} IMFS_types_union;
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
/*
|
||||
* Maximum length of a "basename" of an IMFS file/node.
|
||||
*/
|
||||
@@ -213,6 +219,7 @@ struct IMFS_jnode_tt {
|
||||
} while (0)
|
||||
|
||||
typedef struct {
|
||||
int instance;
|
||||
ino_t ino_count;
|
||||
const rtems_filesystem_file_handlers_r *memfile_handlers;
|
||||
const rtems_filesystem_file_handlers_r *directory_handlers;
|
||||
|
||||
@@ -69,6 +69,7 @@ int IMFS_initialize_support(
|
||||
const rtems_filesystem_file_handlers_r *directory_handlers
|
||||
)
|
||||
{
|
||||
static int imfs_instance;
|
||||
IMFS_fs_info_t *fs_info;
|
||||
IMFS_jnode_t *jnode;
|
||||
|
||||
@@ -103,6 +104,7 @@ int IMFS_initialize_support(
|
||||
* Set st_ino for the root to 1.
|
||||
*/
|
||||
|
||||
fs_info->instance = imfs_instance++;
|
||||
fs_info->ino_count = 1;
|
||||
fs_info->memfile_handlers = memfile_handlers;
|
||||
fs_info->directory_handlers = directory_handlers;
|
||||
|
||||
@@ -27,6 +27,7 @@ int IMFS_stat(
|
||||
struct stat *buf
|
||||
)
|
||||
{
|
||||
IMFS_fs_info_t *fs_info;
|
||||
IMFS_jnode_t *the_jnode;
|
||||
IMFS_device_t *io;
|
||||
|
||||
@@ -58,6 +59,14 @@ int IMFS_stat(
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* The device number of the IMFS is the major number and the minor is the
|
||||
* instance.
|
||||
*/
|
||||
fs_info = loc->mt_entry->fs_info;
|
||||
buf->st_dev =
|
||||
rtems_filesystem_make_dev_t( IMFS_DEVICE_MAJOR_NUMBER, fs_info->instance );
|
||||
|
||||
buf->st_mode = the_jnode->st_mode;
|
||||
buf->st_nlink = the_jnode->st_nlink;
|
||||
buf->st_ino = the_jnode->st_ino;
|
||||
|
||||
Reference in New Issue
Block a user