4 * Copyright (C) 2010 Sebastien Bourdeauducq
5 * Copyright (C) 2011 Stephan Hoffmann <sho@reLinux.de>
6 * Copyright (C) 2011 embedded brains GmbH <rtems@embedded-brains.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * As a special exception, including this header in a file does not by
13 * itself cause the resulting executable application to be covered by the
14 * GNU General Public License.
15 * This exception does not however invalidate any other reasons why the
16 * executable file might be covered by the GNU Public License. In particular,
17 * the other YAFFS files are not covered by this exception, and using them
18 * in a proprietary application requires a paid license from Aleph One.
21 #ifndef __RTEMS_YAFFS_H
22 #define __RTEMS_YAFFS_H
29 #endif /* __cplusplus */
31 /* Must be inside the extern "C" */
33 #include "yaffs_guts.h"
36 * @defgroup rtems_yaffs YAFFS Support for RTEMS
42 #define RTEMS_FILESYSTEM_TYPE_YAFFS "yaffs"
44 typedef void (*rtems_yaffs_os_handler)(
45 struct yaffs_dev *dev,
50 * @brief Per YAFFS file system instance context.
53 rtems_yaffs_os_handler lock;
54 rtems_yaffs_os_handler unlock;
55 rtems_yaffs_os_handler unmount;
58 * @brief The device containing the file system instance.
60 * This will be used for the st_dev field in stat().
63 } rtems_yaffs_os_context;
66 * @brief Default per YAFFS file system instance context.
69 rtems_yaffs_os_context os_context;
70 rtems_id semaphore_id;
71 } rtems_yaffs_default_os_context;
74 * @brief Data for YAFFS mount handler.
76 * @see rtems_yaffs_mount_handler()
80 * @brief YAFFS device of the file system instance.
82 * The @a param field has to be completely set up. The
83 * @a driver_context can point to arbitrary driver specific
84 * information. The @a os_context must point to an initialized
85 * structure that begins with a rtems_yaffs_os_context structure.
87 struct yaffs_dev *dev;
88 } rtems_yaffs_mount_data;
91 * @brief YAFFS mount handler.
93 * The @a data pointer must point to a completely initialized
94 * rtems_yaffs_mount_data structure. The ownership of the YAFFS device
95 * structure changes. This structure is now owned by the file system layer.
97 * @retval 0 Successful operation.
98 * @retval -1 An error occurred. The @c errno indicates the error.
100 int rtems_yaffs_mount_handler(
101 rtems_filesystem_mount_table_entry_t *mt_entry,
106 * @brief Initializes the default per file system context @a os_context.
108 * A binary semaphore with priority inheritance will be used to ensure mutual
111 * The umount handler will release all resources of the default context.
113 * @retval 0 Successful operation.
114 * @retval -1 An error occurred. The @c errno indicates the error.
116 int rtems_yaffs_initialize_default_os_context(
117 rtems_yaffs_default_os_context *os_context
124 #endif /* __cplusplus */
126 #endif /* __RTEMS_YAFFS_H */