From 1a59b922011f77e42b56f13c55431cd3dbd973a1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 11 Jan 2013 09:16:29 +0100 Subject: rtems_yaffs: Add dev field to OS context --- rtems/rtems_yaffs.c | 2 ++ rtems/rtems_yaffs.h | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/rtems/rtems_yaffs.c b/rtems/rtems_yaffs.c index 3e9c44d..3bea242 100644 --- a/rtems/rtems_yaffs.c +++ b/rtems/rtems_yaffs.c @@ -398,11 +398,13 @@ static int ryfs_fstat(const rtems_filesystem_location_info_t *loc, struct stat * int rv = 0; struct yaffs_obj *obj = ryfs_get_object_by_location(loc); struct yaffs_dev *dev = obj->my_dev; + rtems_yaffs_os_context *os_context = dev->os_context; ylock(dev); obj = yaffs_get_equivalent_obj(obj); if (obj != NULL) { + buf->st_dev = os_context->dev; buf->st_ino = obj->obj_id; buf->st_mode = obj->yst_mode; buf->st_nlink = (nlink_t) yaffs_get_obj_link_count(obj); diff --git a/rtems/rtems_yaffs.h b/rtems/rtems_yaffs.h index dce8204..e94fba7 100644 --- a/rtems/rtems_yaffs.h +++ b/rtems/rtems_yaffs.h @@ -53,6 +53,13 @@ typedef struct { rtems_yaffs_os_handler lock; rtems_yaffs_os_handler unlock; rtems_yaffs_os_handler unmount; + + /** + * @brief The device containing the file system instance. + * + * This will be used for the st_dev field in stat(). + */ + dev_t dev; } rtems_yaffs_os_context; /** @@ -83,12 +90,12 @@ typedef struct { /** * @brief YAFFS mount handler. * - * The @a data pointer must point to a completely initizialized + * The @a data pointer must point to a completely initialized * rtems_yaffs_mount_data structure. The ownership of the YAFFS device * structure changes. This structure is now owned by the file system layer. * * @retval 0 Successful operation. - * @retval -1 An error occured. The @c errno indicates the error. + * @retval -1 An error occurred. The @c errno indicates the error. */ int rtems_yaffs_mount_handler( rtems_filesystem_mount_table_entry_t *mt_entry, @@ -98,13 +105,13 @@ int rtems_yaffs_mount_handler( /** * @brief Initializes the default per file system context @a os_context. * - * A binary semaphore with priority inheritence will be used to ensure mutual + * A binary semaphore with priority inheritance will be used to ensure mutual * exclusion. * * The umount handler will release all resources of the default context. * * @retval 0 Successful operation. - * @retval -1 An error occured. The @c errno indicates the error. + * @retval -1 An error occurred. The @c errno indicates the error. */ int rtems_yaffs_initialize_default_os_context( rtems_yaffs_default_os_context *os_context -- cgit v1.2.3