Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * Copyright (C) 2013, 2016 embedded brains GmbH & Co. KG
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  *
0015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0016  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0018  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0019  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0020  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0021  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0024  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0025  * POSSIBILITY OF SUCH DAMAGE.
0026  */
0027 
0028 #ifndef RTEMS_JFFS2_H
0029 #define RTEMS_JFFS2_H
0030 
0031 #include <rtems/fs.h>
0032 #include <sys/param.h>
0033 #include <sys/ioccom.h>
0034 #include <zlib.h>
0035 
0036 #ifdef __cplusplus
0037 extern "C" {
0038 #endif /* __cplusplus */
0039 
0040 typedef struct rtems_jffs2_flash_control rtems_jffs2_flash_control;
0041 
0042 /**
0043  * @defgroup JFFS2 Journalling Flash File System Version 2 (JFFS2) Support
0044  *
0045  * @ingroup FileSystemTypesAndMount
0046  *
0047  * @brief Mount options for the Journalling Flash File System, Version 2
0048  * (JFFS2).
0049  *
0050  * The application must provide flash device geometry information and flash
0051  * device operations in the flash control structure
0052  * @ref rtems_jffs2_flash_control.
0053  *
0054  * The application can optionally provide a compressor control structure to
0055  * enable data compression using the selected compression algorithm.
0056  *
0057  * The application must enable JFFS2 support with rtems_filesystem_register()
0058  * or CONFIGURE_FILESYSTEM_JFFS2 via <rtems/confdefs.h>.
0059  *
0060  * An example mount with a simple memory based flash device simulation follows.
0061  * The zlib is used for as the compressor.
0062  *
0063  * @code
0064  * #include <string.h>
0065  *
0066  * #include <rtems/jffs2.h>
0067  * #include <rtems/libio.h>
0068  *
0069  * #define BLOCK_SIZE (32UL * 1024UL)
0070  *
0071  * #define FLASH_SIZE (32UL * BLOCK_SIZE)
0072  *
0073  * typedef struct {
0074  *   rtems_jffs2_flash_control super;
0075  *   unsigned char area[FLASH_SIZE];
0076  * } flash_control;
0077  *
0078  * static flash_control *get_flash_control(rtems_jffs2_flash_control *super)
0079  * {
0080  *   return (flash_control *) super;
0081  * }
0082  *
0083  * static int flash_read(
0084  *   rtems_jffs2_flash_control *super,
0085  *   uint32_t offset,
0086  *   unsigned char *buffer,
0087  *   size_t size_of_buffer
0088  * )
0089  * {
0090  *   flash_control *self = get_flash_control(super);
0091  *   unsigned char *chunk = &self->area[offset];
0092  *
0093  *   memcpy(buffer, chunk, size_of_buffer);
0094  *
0095  *   return 0;
0096  * }
0097  *
0098  * static int flash_write(
0099  *   rtems_jffs2_flash_control *super,
0100  *   uint32_t offset,
0101  *   const unsigned char *buffer,
0102  *   size_t size_of_buffer
0103  * )
0104  * {
0105  *   flash_control *self = get_flash_control(super);
0106  *   unsigned char *chunk = &self->area[offset];
0107  *   size_t i;
0108  *
0109  *   for (i = 0; i < size_of_buffer; ++i) {
0110  *     chunk[i] &= buffer[i];
0111  *   }
0112  *
0113  *   return 0;
0114  * }
0115  *
0116  * static int flash_erase(
0117  *   rtems_jffs2_flash_control *super,
0118  *   uint32_t offset
0119  * )
0120  * {
0121  *   flash_control *self = get_flash_control(super);
0122  *   unsigned char *chunk = &self->area[offset];
0123  *
0124  *   memset(chunk, 0xff, BLOCK_SIZE);
0125  *
0126  *   return 0;
0127  * }
0128  *
0129  * static flash_control flash_instance = {
0130  *   .super = {
0131  *     .block_size = BLOCK_SIZE,
0132  *     .flash_size = FLASH_SIZE,
0133  *     .read = flash_read,
0134  *     .write = flash_write,
0135  *     .erase = flash_erase,
0136  *     .device_identifier = 0xc01dc0fe
0137  *   }
0138  * };
0139  *
0140  * static rtems_jffs2_compressor_zlib_control compressor_instance = {
0141  *   .super = {
0142  *     .compress = rtems_jffs2_compressor_zlib_compress,
0143  *     .decompress = rtems_jffs2_compressor_zlib_decompress
0144  *   }
0145  * };
0146  *
0147  * static const rtems_jffs2_mount_data mount_data = {
0148  *   .flash_control = &flash_instance.super,
0149  *   .compressor_control = &compressor_instance.super
0150  * };
0151  *
0152  * static void erase_all(void)
0153  * {
0154  *   memset(&flash_instance.area[0], 0xff, FLASH_SIZE);
0155  * }
0156  *
0157  * void example_jffs2_mount(const char *mount_dir)
0158  * {
0159  *   int rv;
0160  *
0161  *   erase_all();
0162  *
0163  *   rv = mount_and_make_target_path(
0164  *     NULL,
0165  *     mount_dir,
0166  *     RTEMS_FILESYSTEM_TYPE_JFFS2,
0167  *     RTEMS_FILESYSTEM_READ_WRITE,
0168  *     &mount_data
0169  *   );
0170  *   assert(rv == 0);
0171  * }
0172  * @endcode
0173  *
0174  * @{
0175  */
0176 
0177 /**
0178  * @brief Read from flash operation.
0179  *
0180  * @param[in, out] self The flash control.
0181  * @param[in] offset The offset to read from the flash begin in bytes.
0182  * @param[out] buffer The buffer receiving the data.
0183  * @param[in] size_of_buffer The size of the buffer in bytes.
0184  *
0185  * @retval 0 Successful operation.
0186  * @retval -EIO An error occurred.  Please note that the value is negative.
0187  * @retval other All other values are reserved and must not be used.
0188  */
0189 typedef int (*rtems_jffs2_flash_read)(
0190   rtems_jffs2_flash_control *self,
0191   uint32_t offset,
0192   unsigned char *buffer,
0193   size_t size_of_buffer
0194 );
0195 
0196 /**
0197  * @brief Write to flash operation.
0198  *
0199  * @param[in, out] self The flash control.
0200  * @param[in] offset The offset to write from the flash begin in bytes.
0201  * @param[in] buffer The buffer containing the data to write.
0202  * @param[in] size_of_buffer The size of the buffer in bytes.
0203  *
0204  * @retval 0 Successful operation.
0205  * @retval -EIO An error occurred.  Please note that the value is negative.
0206  * @retval other All other values are reserved and must not be used.
0207  */
0208 typedef int (*rtems_jffs2_flash_write)(
0209   rtems_jffs2_flash_control *self,
0210   uint32_t offset,
0211   const unsigned char *buffer,
0212   size_t size_of_buffer
0213 );
0214 
0215 /**
0216  * @brief Flash erase operation.
0217  *
0218  * This operation must erase one block specified by the offset.
0219  *
0220  * @param[in, out] self The flash control.
0221  * @param[in] offset The offset to erase from the flash begin in bytes.
0222  *
0223  * @retval 0 Successful operation.
0224  * @retval -EIO An error occurred.  Please note that the value is negative.
0225  * @retval other All other values are reserved and must not be used.
0226  */
0227 typedef int (*rtems_jffs2_flash_erase)(
0228   rtems_jffs2_flash_control *self,
0229   uint32_t offset
0230 );
0231 
0232 /**
0233  * @brief Flash bad block check operation.
0234  *
0235  * This operation checks whether a block is bad.
0236  *
0237  * @param[in, out] self The flash control.
0238  * @param[in] offset The offset in bytes of the block to check.
0239  * @param[out] The result of the bad block check.
0240  *
0241  * @retval 0 Successful operation.
0242  * @retval -EIO An error occurred.  Please note that the value is negative.
0243  * @retval other All other values are reserved and must not be used.
0244  */
0245 typedef int (*rtems_jffs2_flash_block_is_bad)(
0246   rtems_jffs2_flash_control *self,
0247   uint32_t offset,
0248   bool *bad
0249 );
0250 
0251 /**
0252  * @brief Flash bad block mark operation.
0253  *
0254  * This operation marks a block bad.
0255  *
0256  * @param[in, out] self The flash control.
0257  * @param[in] offset The offset in bytes of the block to mark bad.
0258  *
0259  * @retval 0 Successful operation.
0260  * @retval -EIO An error occurred.  Please note that the value is negative.
0261  * @retval other All other values are reserved and must not be used.
0262  */
0263 typedef int (*rtems_jffs2_flash_block_mark_bad)(
0264   rtems_jffs2_flash_control *self,
0265   uint32_t offset
0266 );
0267 
0268 /**
0269  * @brief Flash oob write.
0270  *
0271  * This operation writes the out-of-band/spare bytes for the block matching
0272  * the given offset in bytes.
0273  *
0274  * @param[in, out] self The flash control.
0275  * @param[in] offset The offset to erase from the flash begin in bytes.
0276  * @param[in] pointer to the buffer which will be written to the oob/spare bytes.
0277  * @param[in] length of the buffer which will be written to the oob/spare bytes.
0278  *
0279  * @retval 0 Successful operation.
0280  * @retval -EIO An error occurred.  Please note that the value is negative.
0281  * @retval other All other values are reserved and must not be used.
0282  */
0283 typedef int (*rtems_jffs2_flash_oob_write)(
0284   rtems_jffs2_flash_control *self,
0285   uint32_t offset,
0286   uint8_t *oobbuf,
0287   uint32_t obblen
0288 );
0289 
0290 /**
0291  * @brief Flash oob read.
0292  *
0293  * This operation reads the out-of-band/spare bytes for the block matching
0294  * the given offset in bytes.
0295  *
0296  * @param[in, out] self The flash control.
0297  * @param[in] offset The offset to erase from the flash begin in bytes.
0298  * @param[out] pointer to the buffer which will have the oob/spare bytes data written to it.
0299  * @param[in] length of the buffer which will hold the oob/spare bytes.
0300  *
0301  * @retval 0 Successful operation.
0302  * @retval -EIO An error occurred.  Please note that the value is negative.
0303  * @retval other All other values are reserved and must not be used.
0304  */
0305 typedef int (*rtems_jffs2_flash_oob_read)(
0306   rtems_jffs2_flash_control *self,
0307   uint32_t offset,
0308   uint8_t *oobbuf,
0309   uint32_t obblen
0310 );
0311 
0312 /**
0313  * @brief Flash get oob size.
0314  *
0315  * This operation gets the size of the out-of-band/spare bytes for each page.
0316  *
0317  * @param[in, out] self The flash control.
0318  *
0319  * @retval The size of the OOB/spare area available to each page
0320  */
0321 typedef uint32_t (*rtems_jffs2_flash_get_oob_size)(
0322   rtems_jffs2_flash_control *self
0323 );
0324 
0325 /**
0326  * @brief Flash destroy operation.
0327  *
0328  * The flash destroy operation is called during unmount of the file system
0329  * instance.  It can be used to free the resources associated with the now
0330  * unused flash control
0331  *
0332  * @param[in, out] self The flash control.
0333  */
0334 typedef void (*rtems_jffs2_flash_destroy)(
0335   rtems_jffs2_flash_control *self
0336 );
0337 
0338 /**
0339  * @brief Trigger garbage collection operation.
0340  *
0341  * An optional garbage collection thread may perform now a garbage collection
0342  * using the RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION IO control.
0343  *
0344  * The garbage collection must not run in the executing context.
0345  *
0346  * @param[in] self The flash control.
0347  */
0348 typedef void (*rtems_jffs2_trigger_garbage_collection)(
0349   rtems_jffs2_flash_control *self
0350 );
0351 
0352 /**
0353  * @brief JFFS2 flash device control.
0354  */
0355 struct rtems_jffs2_flash_control {
0356   /**
0357    * @brief The size in bytes of the erasable unit of the flash device.
0358    */
0359   uint32_t block_size;
0360 
0361   /**
0362    * @brief The size in bytes of the flash device.
0363    *
0364    * It must be an integral multiple of the block size.  The flash device must
0365    * have at least five blocks.
0366    */
0367   uint32_t flash_size;
0368 
0369   /**
0370    * @brief The size in bytes of the minimum write size for the flash device.
0371    *
0372    * It must be an integral divisor into the block size. This is only applicable
0373    * for NAND devices.
0374    */
0375   uint32_t write_size;
0376 
0377   /**
0378    * @brief Read from flash operation.
0379    */
0380   rtems_jffs2_flash_read read;
0381 
0382   /**
0383    * @brief Write to flash operation.
0384    */
0385   rtems_jffs2_flash_write write;
0386 
0387   /**
0388    * @brief Flash erase operation.
0389    */
0390   rtems_jffs2_flash_erase erase;
0391 
0392   /**
0393    * @brief Flash bad block check operation.
0394    */
0395   rtems_jffs2_flash_block_is_bad block_is_bad;
0396 
0397   /**
0398    * @brief Flash bad block mark operation.
0399    */
0400   rtems_jffs2_flash_block_mark_bad block_mark_bad;
0401 
0402   /**
0403    * @brief Flash oob bytes write operation.
0404    */
0405   rtems_jffs2_flash_oob_write oob_write;
0406 
0407   /**
0408    * @brief Flash oob bytes read operation.
0409    */
0410   rtems_jffs2_flash_oob_read oob_read;
0411 
0412   /**
0413    * @brief Flash get oob bytes per page operation.
0414    */
0415   rtems_jffs2_flash_get_oob_size get_oob_size;
0416 
0417   /**
0418    * @brief Flash destroy operation.
0419    *
0420    * This operation is optional and the pointer may be @c NULL.
0421    */
0422   rtems_jffs2_flash_destroy destroy;
0423 
0424   /**
0425    * @brief The device identifier of the flash device.
0426    *
0427    * It is used in combination with the inode number to uniquely identify a
0428    * file system node in the system.
0429    */
0430   dev_t device_identifier;
0431 
0432   /**
0433    * @brief Trigger garbage collection operation.
0434    *
0435    * This operation is optional and may be NULL.  This operation should wake up
0436    * a garbage collection thread.  The garbage collection thread should use the
0437    * RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION IO control to carry out the work.
0438    */
0439   rtems_jffs2_trigger_garbage_collection trigger_garbage_collection;
0440 };
0441 
0442 typedef struct rtems_jffs2_compressor_control rtems_jffs2_compressor_control;
0443 
0444 /**
0445  * @brief Compress operation.
0446  *
0447  * @param[in, out] self The compressor control.
0448  * @param[in] data_in The uncompressed data.
0449  * @param[out] cdata_out Pointer to buffer with the compressed data.
0450  * @param[in, out] datalen On entry, the size in bytes of the uncompressed
0451  * data.  On exit, the size in bytes of uncompressed data which was actually
0452  * compressed.
0453  * @param[in, out] cdatalen On entry, the size in bytes available for
0454  * compressed data.  On exit, the size in bytes of the actually compressed
0455  * data.
0456  *
0457  * @return The compressor type.
0458  */
0459 typedef uint16_t (*rtems_jffs2_compressor_compress)(
0460   rtems_jffs2_compressor_control *self,
0461   unsigned char *data_in,
0462   unsigned char *cdata_out,
0463   uint32_t *datalen,
0464   uint32_t *cdatalen
0465 );
0466 
0467 /**
0468  * @brief Decompress operation.
0469  *
0470  * @param[in, out] self The compressor control.
0471  * @param[in] comprtype The compressor type.
0472  * @param[in] cdata_in The compressed data.
0473  * @param[out] data_out The uncompressed data.
0474  * @param[in] cdatalen The size in bytes of the compressed data.
0475  * @param[in] datalen The size in bytes of the uncompressed data.
0476  *
0477  * @retval 0 Successful operation.
0478  * @retval -EIO An error occurred.  Please note that the value is negative.
0479  * @retval other All other values are reserved and must not be used.
0480  */
0481 typedef int (*rtems_jffs2_compressor_decompress)(
0482   rtems_jffs2_compressor_control *self,
0483   uint16_t comprtype,
0484   unsigned char *cdata_in,
0485   unsigned char *data_out,
0486   uint32_t cdatalen,
0487   uint32_t datalen
0488 );
0489 
0490 /**
0491  * @brief Compressor destroy operation.
0492  *
0493  * The compressor destroy operation is called during unmount of the file system
0494  * instance.  It can be used to free the resources associated with the now
0495  * unused compressor operations.
0496  *
0497  * @param[in, out] self The compressor control.
0498  */
0499 typedef void (*rtems_jffs2_compressor_destroy)(
0500   rtems_jffs2_compressor_control *self
0501 );
0502 
0503 /**
0504  * @brief JFFS2 compressor control.
0505  */
0506 struct rtems_jffs2_compressor_control {
0507   /**
0508    * @brief Compress operation.
0509    */
0510   rtems_jffs2_compressor_compress compress;
0511 
0512   /**
0513    * @brief Decompress operation.
0514    */
0515   rtems_jffs2_compressor_decompress decompress;
0516 
0517   /**
0518    * @brief Compressor destroy operation.
0519    *
0520    * This operation is optional and the pointer may be @c NULL.
0521    */
0522   rtems_jffs2_compressor_destroy destroy;
0523 
0524   /**
0525    * @brief Compression buffer.
0526    */
0527   unsigned char buffer[PAGE_SIZE];
0528 };
0529 
0530 /**
0531  * @brief RTIME compressor compress operation.
0532  */
0533 uint16_t rtems_jffs2_compressor_rtime_compress(
0534   rtems_jffs2_compressor_control *self,
0535   unsigned char *data_in,
0536   unsigned char *cdata_out,
0537   uint32_t *datalen,
0538   uint32_t *cdatalen
0539 );
0540 
0541 /**
0542  * @brief RTIME compressor decompress operation.
0543  */
0544 int rtems_jffs2_compressor_rtime_decompress(
0545   rtems_jffs2_compressor_control *self,
0546   uint16_t comprtype,
0547   unsigned char *cdata_in,
0548   unsigned char *data_out,
0549   uint32_t cdatalen,
0550   uint32_t datalen
0551 );
0552 
0553 /**
0554  * @brief ZLIB compressor control structure.
0555  */
0556 typedef struct {
0557   rtems_jffs2_compressor_control super;
0558   z_stream stream;
0559 } rtems_jffs2_compressor_zlib_control;
0560 
0561 /**
0562  * @brief ZLIB compressor compress operation.
0563  */
0564 uint16_t rtems_jffs2_compressor_zlib_compress(
0565   rtems_jffs2_compressor_control *self,
0566   unsigned char *data_in,
0567   unsigned char *cdata_out,
0568   uint32_t *datalen,
0569   uint32_t *cdatalen
0570 );
0571 
0572 /**
0573  * @brief ZLIB compressor decompress operation.
0574  */
0575 int rtems_jffs2_compressor_zlib_decompress(
0576   rtems_jffs2_compressor_control *self,
0577   uint16_t comprtype,
0578   unsigned char *cdata_in,
0579   unsigned char *data_out,
0580   uint32_t cdatalen,
0581   uint32_t datalen
0582 );
0583 
0584 /**
0585  * @brief JFFS2 mount options.
0586  *
0587  * For JFFS2 the mount options are mandatory.
0588  */
0589 typedef struct {
0590   /**
0591    * @brief Flash control.
0592    */
0593   rtems_jffs2_flash_control *flash_control;
0594 
0595   /**
0596    * @brief Compressor control.
0597    *
0598    * The compressor is optional and this pointer may be @c NULL.
0599    */
0600   rtems_jffs2_compressor_control *compressor_control;
0601 } rtems_jffs2_mount_data;
0602 
0603 /**
0604  * @brief Initialization handler of the JFFS2 file system.
0605  *
0606  * @param[in, out] mt_entry The mount table entry.
0607  * @param[in] data The mount options are mandatory for JFFS2 and data must
0608  * point to a valid @ref rtems_jffs2_mount_data structure used for this file
0609  * system instance.
0610  *
0611  * @retval 0 Successful operation.
0612  * @retval -1 An error occurred.  The @c errno indicates the error.
0613  *
0614  * @see mount().
0615  */
0616 int rtems_jffs2_initialize(
0617   rtems_filesystem_mount_table_entry_t *mt_entry,
0618   const void *data
0619 );
0620 
0621 /**
0622  * @brief JFFS2 filesystem instance information.
0623  *
0624  * @see RTEMS_JFFS2_GET_INFO.
0625  */
0626 typedef struct {
0627   /**
0628    * @brief Flash size in bytes.
0629    */
0630   uint32_t flash_size;
0631 
0632   /**
0633    * @brief Count of flash blocks (erasable units).
0634    */
0635   uint32_t flash_blocks;
0636 
0637   /**
0638    * @brief Size of a flash block in bytes.
0639    */
0640   uint32_t flash_block_size;
0641 
0642   /**
0643    * @brief Used size in bytes.
0644    *
0645    * Used areas contain valid data.
0646    */
0647   uint32_t used_size;
0648 
0649   /**
0650    * @brief Dirty size in bytes.
0651    *
0652    * Used areas contain no longer used data.
0653    */
0654   uint32_t dirty_size;
0655 
0656   /**
0657    * @brief Wasted size in bytes.
0658    *
0659    * Wasted areas are unusable.
0660    */
0661   uint32_t wasted_size;
0662 
0663   /**
0664    * @brief Free size in bytes.
0665    *
0666    * Free areas may be used to store new data.
0667    */
0668   uint32_t free_size;
0669 
0670   /**
0671    * @brief Bad size in bytes.
0672    *
0673    * Bad areas indicate damaged flash blocks.
0674    */
0675   uint32_t bad_size;
0676 
0677   /**
0678    * @brief Count of clean blocks.
0679    *
0680    * Clean blocks contain only used areas.
0681    */
0682   uint32_t clean_blocks;
0683 
0684   /**
0685    * @brief Count of dirty blocks.
0686    *
0687    * Dirty blocks contain dirty and used areas.
0688    */
0689   uint32_t dirty_blocks;
0690 
0691   /**
0692    * @brief Count of erasable blocks.
0693    *
0694    * Erase blocks contain only dirty or wasted areas.
0695    */
0696   uint32_t erasable_blocks;
0697 
0698   /**
0699    * @brief Count of free blocks.
0700    *
0701    * Free blocks contain a free area.
0702    */
0703   uint32_t free_blocks;
0704 
0705   /**
0706    * @brief Count of bad blocks.
0707    *
0708    * Bad blocks are damaged.
0709    */
0710   uint32_t bad_blocks;
0711 } rtems_jffs2_info;
0712 
0713 /**
0714  * @brief IO control to get the JFFS2 filesystem instance information.
0715  *
0716  * @see rtems_jffs2_info.
0717  */
0718 #define RTEMS_JFFS2_GET_INFO _IOR('F', 1, rtems_jffs2_info)
0719 
0720 /**
0721  * @brief IO control to perform an on demand garbage collection in a JFFS2
0722  * filesystem instance.
0723  *
0724  * This operation is intended to be used by an optional garbage collection
0725  * thread.  See rtems_jffs2_flash_control::trigger_garbage_collection.
0726  */
0727 #define RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION _IO('F', 2)
0728 
0729 /**
0730  * @brief IO control to force a garbage collection in a JFFS2 filesystem
0731  * instance.
0732  *
0733  * Use this operation with care since it may wear out your flash.
0734  */
0735 #define RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION _IO('F', 3)
0736 
0737 /**
0738  * Default delayed-write servicing task priority.
0739  */
0740 #define RTEMS_JFFS2_DELAYED_WRITE_TASK_PRIORITY_DEFAULT 15
0741 
0742 /**
0743  * JFFS2 configuration definition. See confdefs.h for support on using this
0744  * structure.
0745  */
0746 typedef struct rtems_jffs2_config {
0747   rtems_task_priority delayed_write_priority; /**< Priority of the delayed write
0748                                                * task. */
0749 } rtems_jffs2_config;
0750 
0751 /**
0752  * External reference to the configuration.
0753  *
0754  * The configuration is provided by the application.
0755  */
0756 extern const rtems_jffs2_config jffs2_config;
0757 
0758 /** @} */
0759 
0760 #ifdef __cplusplus
0761 }
0762 #endif /* __cplusplus */
0763 
0764 #endif /* RTEMS_JFFS2_H */