RTEMS  5.1
jffs2.h
1 /*
2  * Copyright (c) 2013, 2016 embedded brains GmbH. All rights reserved.
3  *
4  * embedded brains GmbH
5  * Dornierstr. 4
6  * 82178 Puchheim
7  * Germany
8  * <rtems@embedded-brains.de>
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifndef RTEMS_JFFS2_H
16 #define RTEMS_JFFS2_H
17 
18 #include <rtems/fs.h>
19 #include <sys/param.h>
20 #include <sys/ioccom.h>
21 #include <zlib.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
28 
176 typedef int (*rtems_jffs2_flash_read)(
178  uint32_t offset,
179  unsigned char *buffer,
180  size_t size_of_buffer
181 );
182 
195 typedef int (*rtems_jffs2_flash_write)(
197  uint32_t offset,
198  const unsigned char *buffer,
199  size_t size_of_buffer
200 );
201 
214 typedef int (*rtems_jffs2_flash_erase)(
216  uint32_t offset
217 );
218 
230 );
231 
244 );
245 
253  uint32_t block_size;
254 
261  uint32_t flash_size;
262 
267 
272 
277 
284 
292 
301 };
302 
304 
322  unsigned char *data_in,
323  unsigned char *cdata_out,
324  uint32_t *datalen,
325  uint32_t *cdatalen
326 );
327 
344  uint16_t comprtype,
345  unsigned char *cdata_in,
346  unsigned char *data_out,
347  uint32_t cdatalen,
348  uint32_t datalen
349 );
350 
362 );
363 
372 
377 
384 
388  unsigned char buffer[PAGE_SIZE];
389 };
390 
396  unsigned char *data_in,
397  unsigned char *cdata_out,
398  uint32_t *datalen,
399  uint32_t *cdatalen
400 );
401 
407  uint16_t comprtype,
408  unsigned char *cdata_in,
409  unsigned char *data_out,
410  uint32_t cdatalen,
411  uint32_t datalen
412 );
413 
417 typedef struct {
419  z_stream stream;
421 
427  unsigned char *data_in,
428  unsigned char *cdata_out,
429  uint32_t *datalen,
430  uint32_t *cdatalen
431 );
432 
438  uint16_t comprtype,
439  unsigned char *cdata_in,
440  unsigned char *data_out,
441  uint32_t cdatalen,
442  uint32_t datalen
443 );
444 
450 typedef struct {
455 
463 
479  const void *data
480 );
481 
487 typedef struct {
491  uint32_t flash_size;
492 
496  uint32_t flash_blocks;
497 
502 
508  uint32_t used_size;
509 
515  uint32_t dirty_size;
516 
522  uint32_t wasted_size;
523 
529  uint32_t free_size;
530 
536  uint32_t bad_size;
537 
543  uint32_t clean_blocks;
544 
550  uint32_t dirty_blocks;
551 
557  uint32_t erasable_blocks;
558 
564  uint32_t free_blocks;
565 
571  uint32_t bad_blocks;
573 
579 #define RTEMS_JFFS2_GET_INFO _IOR('F', 1, rtems_jffs2_info)
580 
588 #define RTEMS_JFFS2_ON_DEMAND_GARBAGE_COLLECTION _IO('F', 2)
589 
596 #define RTEMS_JFFS2_FORCE_GARBAGE_COLLECTION _IO('F', 3)
597 
600 #ifdef __cplusplus
601 }
602 #endif /* __cplusplus */
603 
604 #endif /* RTEMS_JFFS2_H */
void(* rtems_jffs2_flash_destroy)(rtems_jffs2_flash_control *self)
Flash destroy operation.
Definition: jffs2.h:228
ZLIB compressor control structure.
Definition: jffs2.h:417
uint32_t used_size
Used size in bytes.
Definition: jffs2.h:508
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.
Definition: compr_zlib.c:121
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.
Definition: jffs2.h:320
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.
Definition: jffs2.h:176
rtems_jffs2_flash_erase erase
Flash erase operation.
Definition: jffs2.h:276
uint32_t free_blocks
Count of free blocks.
Definition: jffs2.h:564
rtems_jffs2_flash_control * flash_control
Flash control.
Definition: jffs2.h:454
void(* rtems_jffs2_trigger_garbage_collection)(rtems_jffs2_flash_control *self)
Trigger garbage collection operation.
Definition: jffs2.h:242
JFFS2 filesystem instance information.
Definition: jffs2.h:487
uint32_t block_size
The size in bytes of the erasable unit of the flash device.
Definition: jffs2.h:253
rtems_jffs2_flash_read read
Read from flash operation.
Definition: jffs2.h:266
int(* rtems_jffs2_flash_erase)(rtems_jffs2_flash_control *self, uint32_t offset)
Flash erase operation.
Definition: jffs2.h:214
rtems_jffs2_compressor_decompress decompress
Decompress operation.
Definition: jffs2.h:376
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.
Definition: compr_zlib.c:46
rtems_jffs2_compressor_control * compressor_control
Compressor control.
Definition: jffs2.h:461
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.
Definition: jffs2.h:195
rtems_jffs2_compressor_destroy destroy
Compressor destroy operation.
Definition: jffs2.h:383
rtems_jffs2_trigger_garbage_collection trigger_garbage_collection
Trigger garbage collection operation.
Definition: jffs2.h:300
unsigned char buffer[PAGE_SIZE]
Compression buffer.
Definition: jffs2.h:388
uint32_t dirty_size
Dirty size in bytes.
Definition: jffs2.h:515
rtems_jffs2_compressor_compress compress
Compress operation.
Definition: jffs2.h:371
uint32_t free_size
Free size in bytes.
Definition: jffs2.h:529
uint32_t flash_blocks
Count of flash blocks (erasable units).
Definition: jffs2.h:496
rtems_jffs2_flash_write write
Write to flash operation.
Definition: jffs2.h:271
uint32_t flash_size
The size in bytes of the flash device.
Definition: jffs2.h:261
uint32_t flash_size
Flash size in bytes.
Definition: jffs2.h:491
Mount table entry.
Definition: libio.h:1604
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.
Definition: compr_rtime.c:33
Basic Filesystem Types.
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.
Definition: jffs2.h:342
uint32_t erasable_blocks
Count of erasable blocks.
Definition: jffs2.h:557
dev_t device_identifier
The device identifier of the flash device.
Definition: jffs2.h:291
uint32_t clean_blocks
Count of clean blocks.
Definition: jffs2.h:543
uint32_t dirty_blocks
Count of dirty blocks.
Definition: jffs2.h:550
rtems_jffs2_flash_destroy destroy
Flash destroy operation.
Definition: jffs2.h:283
void(* rtems_jffs2_compressor_destroy)(rtems_jffs2_compressor_control *self)
Compressor destroy operation.
Definition: jffs2.h:360
JFFS2 compressor control.
Definition: jffs2.h:367
uint32_t bad_blocks
Count of bad blocks.
Definition: jffs2.h:571
uint32_t wasted_size
Wasted size in bytes.
Definition: jffs2.h:522
JFFS2 mount options.
Definition: jffs2.h:450
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.
Definition: compr_rtime.c:80
JFFS2 flash device control.
Definition: jffs2.h:249
Definition: zlib.h:170
uint32_t bad_size
Bad size in bytes.
Definition: jffs2.h:536
uint32_t flash_block_size
Size of a flash block in bytes.
Definition: jffs2.h:501
int rtems_jffs2_initialize(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
Initialization handler of the JFFS2 file system.
Definition: fs-rtems.c:1216