RTEMS 6.1-rc6
|
Mount options for the Journalling Flash File System, Version 2 (JFFS2). More...
Data Structures | |
struct | rtems_jffs2_flash_control |
JFFS2 flash device control. More... | |
struct | rtems_jffs2_compressor_control |
JFFS2 compressor control. More... | |
struct | rtems_jffs2_compressor_zlib_control |
ZLIB compressor control structure. More... | |
struct | rtems_jffs2_mount_data |
JFFS2 mount options. More... | |
struct | rtems_jffs2_info |
JFFS2 filesystem instance information. More... | |
struct | rtems_jffs2_config |
Macros | |
#define | RTEMS_JFFS2_GET_INFO _IOR('F', 1, rtems_jffs2_info) |
IO control to get the JFFS2 filesystem instance information. | |
#define | RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION _IO('F', 2) |
IO control to perform an on demand garbage collection in a JFFS2 filesystem instance. | |
#define | RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION _IO('F', 3) |
IO control to force a garbage collection in a JFFS2 filesystem instance. | |
#define | RTEMS_JFFS2_DELAYED_WRITE_TASK_PRIORITY_DEFAULT 15 |
Typedefs | |
typedef int(* | rtems_jffs2_flash_read) (rtems_jffs2_flash_control *self, uint32_t offset, unsigned char *buffer, size_t size_of_buffer) |
Read from flash operation. | |
typedef int(* | rtems_jffs2_flash_write) (rtems_jffs2_flash_control *self, uint32_t offset, const unsigned char *buffer, size_t size_of_buffer) |
Write to flash operation. | |
typedef int(* | rtems_jffs2_flash_erase) (rtems_jffs2_flash_control *self, uint32_t offset) |
Flash erase operation. | |
typedef int(* | rtems_jffs2_flash_block_is_bad) (rtems_jffs2_flash_control *self, uint32_t offset, bool *bad) |
Flash bad block check operation. | |
typedef int(* | rtems_jffs2_flash_block_mark_bad) (rtems_jffs2_flash_control *self, uint32_t offset) |
Flash bad block mark operation. | |
typedef int(* | rtems_jffs2_flash_oob_write) (rtems_jffs2_flash_control *self, uint32_t offset, uint8_t *oobbuf, uint32_t obblen) |
Flash oob write. | |
typedef int(* | rtems_jffs2_flash_oob_read) (rtems_jffs2_flash_control *self, uint32_t offset, uint8_t *oobbuf, uint32_t obblen) |
Flash oob read. | |
typedef uint32_t(* | rtems_jffs2_flash_get_oob_size) (rtems_jffs2_flash_control *self) |
Flash get oob size. | |
typedef void(* | rtems_jffs2_flash_destroy) (rtems_jffs2_flash_control *self) |
Flash destroy operation. | |
typedef void(* | rtems_jffs2_trigger_garbage_collection) (rtems_jffs2_flash_control *self) |
Trigger garbage collection operation. | |
typedef struct rtems_jffs2_compressor_control | rtems_jffs2_compressor_control |
typedef uint16_t(* | rtems_jffs2_compressor_compress) (rtems_jffs2_compressor_control *self, unsigned char *data_in, unsigned char *cdata_out, uint32_t *datalen, uint32_t *cdatalen) |
Compress operation. | |
typedef int(* | rtems_jffs2_compressor_decompress) (rtems_jffs2_compressor_control *self, uint16_t comprtype, unsigned char *cdata_in, unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) |
Decompress operation. | |
typedef void(* | rtems_jffs2_compressor_destroy) (rtems_jffs2_compressor_control *self) |
Compressor destroy operation. | |
typedef struct rtems_jffs2_config | rtems_jffs2_config |
Functions | |
uint16_t | rtems_jffs2_compressor_rtime_compress (rtems_jffs2_compressor_control *self, unsigned char *data_in, unsigned char *cdata_out, uint32_t *datalen, uint32_t *cdatalen) |
RTIME compressor compress operation. | |
int | rtems_jffs2_compressor_rtime_decompress (rtems_jffs2_compressor_control *self, uint16_t comprtype, unsigned char *cdata_in, unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) |
RTIME compressor decompress operation. | |
uint16_t | rtems_jffs2_compressor_zlib_compress (rtems_jffs2_compressor_control *self, unsigned char *data_in, unsigned char *cdata_out, uint32_t *datalen, uint32_t *cdatalen) |
ZLIB compressor compress operation. | |
int | rtems_jffs2_compressor_zlib_decompress (rtems_jffs2_compressor_control *self, uint16_t comprtype, unsigned char *cdata_in, unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) |
ZLIB compressor decompress operation. | |
int | rtems_jffs2_initialize (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data) |
Initialization handler of the JFFS2 file system. | |
Variables | |
const rtems_jffs2_config | jffs2_config |
Mount options for the Journalling Flash File System, Version 2 (JFFS2).
The application must provide flash device geometry information and flash device operations in the flash control structure rtems_jffs2_flash_control.
The application can optionally provide a compressor control structure to enable data compression using the selected compression algorithm.
The application must enable JFFS2 support with rtems_filesystem_register() or CONFIGURE_FILESYSTEM_JFFS2 via <rtems/confdefs.h>.
An example mount with a simple memory based flash device simulation follows. The zlib is used for as the compressor.
#define RTEMS_JFFS2_DELAYED_WRITE_TASK_PRIORITY_DEFAULT 15 |
Default delayed-write servicing task priority.
#define RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION _IO('F', 3) |
IO control to force a garbage collection in a JFFS2 filesystem instance.
Use this operation with care since it may wear out your flash.
#define RTEMS_JFFS2_GET_INFO _IOR('F', 1, rtems_jffs2_info) |
IO control to get the JFFS2 filesystem instance information.
#define RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION _IO('F', 2) |
IO control to perform an on demand garbage collection in a JFFS2 filesystem instance.
This operation is intended to be used by an optional garbage collection thread. See rtems_jffs2_flash_control::trigger_garbage_collection.
typedef uint16_t(* rtems_jffs2_compressor_compress) (rtems_jffs2_compressor_control *self, unsigned char *data_in, unsigned char *cdata_out, uint32_t *datalen, uint32_t *cdatalen) |
Compress operation.
[in,out] | self | The compressor control. |
[in] | data_in | The uncompressed data. |
[out] | cdata_out | Pointer to buffer with the compressed data. |
[in,out] | datalen | On entry, the size in bytes of the uncompressed data. On exit, the size in bytes of uncompressed data which was actually compressed. |
[in,out] | cdatalen | On entry, the size in bytes available for compressed data. On exit, the size in bytes of the actually compressed data. |
typedef int(* rtems_jffs2_compressor_decompress) (rtems_jffs2_compressor_control *self, uint16_t comprtype, unsigned char *cdata_in, unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) |
Decompress operation.
[in,out] | self | The compressor control. |
[in] | comprtype | The compressor type. |
[in] | cdata_in | The compressed data. |
[out] | data_out | The uncompressed data. |
[in] | cdatalen | The size in bytes of the compressed data. |
[in] | datalen | The size in bytes of the uncompressed data. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef void(* rtems_jffs2_compressor_destroy) (rtems_jffs2_compressor_control *self) |
Compressor destroy operation.
The compressor destroy operation is called during unmount of the file system instance. It can be used to free the resources associated with the now unused compressor operations.
[in,out] | self | The compressor control. |
typedef struct rtems_jffs2_config rtems_jffs2_config |
JFFS2 configuration definition. See confdefs.h for support on using this structure.
typedef int(* rtems_jffs2_flash_block_is_bad) (rtems_jffs2_flash_control *self, uint32_t offset, bool *bad) |
Flash bad block check operation.
This operation checks whether a block is bad.
[in,out] | self | The flash control. |
[in] | offset | The offset in bytes of the block to check. |
[out] | The | result of the bad block check. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef int(* rtems_jffs2_flash_block_mark_bad) (rtems_jffs2_flash_control *self, uint32_t offset) |
Flash bad block mark operation.
This operation marks a block bad.
[in,out] | self | The flash control. |
[in] | offset | The offset in bytes of the block to mark bad. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef void(* rtems_jffs2_flash_destroy) (rtems_jffs2_flash_control *self) |
Flash destroy operation.
The flash destroy operation is called during unmount of the file system instance. It can be used to free the resources associated with the now unused flash control
[in,out] | self | The flash control. |
typedef int(* rtems_jffs2_flash_erase) (rtems_jffs2_flash_control *self, uint32_t offset) |
Flash erase operation.
This operation must erase one block specified by the offset.
[in,out] | self | The flash control. |
[in] | offset | The offset to erase from the flash begin in bytes. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef uint32_t(* rtems_jffs2_flash_get_oob_size) (rtems_jffs2_flash_control *self) |
Flash get oob size.
This operation gets the size of the out-of-band/spare bytes for each page.
[in,out] | self | The flash control. |
The | size of the OOB/spare area available to each page |
typedef int(* rtems_jffs2_flash_oob_read) (rtems_jffs2_flash_control *self, uint32_t offset, uint8_t *oobbuf, uint32_t obblen) |
Flash oob read.
This operation reads the out-of-band/spare bytes for the block matching the given offset in bytes.
[in,out] | self | The flash control. |
[in] | offset | The offset to erase from the flash begin in bytes. |
[out] | pointer | to the buffer which will have the oob/spare bytes data written to it. |
[in] | length | of the buffer which will hold the oob/spare bytes. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef int(* rtems_jffs2_flash_oob_write) (rtems_jffs2_flash_control *self, uint32_t offset, uint8_t *oobbuf, uint32_t obblen) |
Flash oob write.
This operation writes the out-of-band/spare bytes for the block matching the given offset in bytes.
[in,out] | self | The flash control. |
[in] | offset | The offset to erase from the flash begin in bytes. |
[in] | pointer | to the buffer which will be written to the oob/spare bytes. |
[in] | length | of the buffer which will be written to the oob/spare bytes. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef int(* rtems_jffs2_flash_read) (rtems_jffs2_flash_control *self, uint32_t offset, unsigned char *buffer, size_t size_of_buffer) |
Read from flash operation.
[in,out] | self | The flash control. |
[in] | offset | The offset to read from the flash begin in bytes. |
[out] | buffer | The buffer receiving the data. |
[in] | size_of_buffer | The size of the buffer in bytes. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef int(* rtems_jffs2_flash_write) (rtems_jffs2_flash_control *self, uint32_t offset, const unsigned char *buffer, size_t size_of_buffer) |
Write to flash operation.
[in,out] | self | The flash control. |
[in] | offset | The offset to write from the flash begin in bytes. |
[in] | buffer | The buffer containing the data to write. |
[in] | size_of_buffer | The size of the buffer in bytes. |
0 | Successful operation. |
-EIO | An error occurred. Please note that the value is negative. |
other | All other values are reserved and must not be used. |
typedef void(* rtems_jffs2_trigger_garbage_collection) (rtems_jffs2_flash_control *self) |
Trigger garbage collection operation.
An optional garbage collection thread may perform now a garbage collection using the RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION IO control.
The garbage collection must not run in the executing context.
[in] | self | The flash control. |
int rtems_jffs2_initialize | ( | rtems_filesystem_mount_table_entry_t * | mt_entry, |
const void * | data | ||
) |
Initialization handler of the JFFS2 file system.
[in,out] | mt_entry | The mount table entry. |
[in] | data | The mount options are mandatory for JFFS2 and data must point to a valid rtems_jffs2_mount_data structure used for this file system instance. |
0 | Successful operation. |
-1 | An error occurred. The errno indicates the error. |
|
extern |
External reference to the configuration.
The configuration is provided by the application.