RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
libfs
src
jffs2
src
jffs2_fs_sb.h
1
#include "
rtems-jffs2-config.h
"
2
3
/*
4
* JFFS2 -- Journalling Flash File System, Version 2.
5
*
6
* Copyright © 2001-2007 Red Hat, Inc.
7
* Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
8
*
9
* Created by David Woodhouse <dwmw2@infradead.org>
10
*
11
* For licensing information, see the file 'LICENCE' in this directory.
12
*
13
*/
14
15
#ifndef _JFFS2_FS_SB
16
#define _JFFS2_FS_SB
17
18
#include <linux/types.h>
19
#include <linux/spinlock.h>
20
#include <linux/workqueue.h>
21
#include <linux/completion.h>
22
#include <linux/mutex.h>
23
#include <linux/timer.h>
24
#include <linux/wait.h>
25
#include <linux/list.h>
26
#include <linux/rwsem.h>
27
28
#define JFFS2_SB_FLAG_RO 1
29
#define JFFS2_SB_FLAG_SCANNING 2
/* Flash scanning is in progress */
30
#define JFFS2_SB_FLAG_BUILDING 4
/* File system building is in progress */
31
32
struct
jffs2_inodirty
;
33
34
struct
jffs2_mount_opts
{
35
bool
override_compr;
36
unsigned
int
compr;
37
38
/* The size of the reserved pool. The reserved pool is the JFFS2 flash
39
* space which may only be used by root cannot be used by the other
40
* users. This is implemented simply by means of not allowing the
41
* latter users to write to the file system if the amount if the
42
* available space is less then 'rp_size'. */
43
bool
set_rp_size;
44
unsigned
int
rp_size;
45
};
46
47
/* A struct for the overall file system control. Pointers to
48
jffs2_sb_info structs are named `c' in the source code.
49
Nee jffs_control
50
*/
51
struct
jffs2_sb_info
{
52
struct
mtd_info
*mtd;
53
54
uint32_t highest_ino;
55
uint32_t check_ino;
/* *NEXT* inode to be checked */
56
57
unsigned
int
flags;
58
59
struct
task_struct *gc_task;
/* GC task struct */
60
struct
completion
gc_thread_start;
/* GC thread start completion */
61
struct
completion
gc_thread_exit;
/* GC thread exit completion port */
62
63
struct
mutex
alloc_sem;
/* Used to protect all the following
64
fields, and also to protect against
65
out-of-order writing of nodes. And GC. */
66
uint32_t cleanmarker_size;
/* Size of an _inline_ CLEANMARKER
67
(i.e. zero for OOB CLEANMARKER */
68
69
uint32_t flash_size;
70
uint32_t used_size;
71
uint32_t dirty_size;
72
uint32_t wasted_size;
73
uint32_t free_size;
74
uint32_t erasing_size;
75
uint32_t bad_size;
76
uint32_t sector_size;
77
uint32_t unchecked_size;
78
#ifdef __rtems__
79
uint32_t obsolete_size;
80
#endif
81
82
uint32_t nr_free_blocks;
83
uint32_t nr_erasing_blocks;
84
85
/* Number of free blocks there must be before we... */
86
uint8_t resv_blocks_write;
/* ... allow a normal filesystem write */
87
uint8_t resv_blocks_deletion;
/* ... allow a normal filesystem deletion */
88
uint8_t resv_blocks_gctrigger;
/* ... wake up the GC thread */
89
uint8_t resv_blocks_gcbad;
/* ... pick a block from the bad_list to GC */
90
uint8_t resv_blocks_gcmerge;
/* ... merge pages when garbage collecting */
91
/* Number of 'very dirty' blocks before we trigger immediate GC */
92
uint8_t vdirty_blocks_gctrigger;
93
94
uint32_t nospc_dirty_size;
95
96
uint32_t nr_blocks;
97
struct
jffs2_eraseblock
*blocks;
/* The whole array of blocks. Used for getting blocks
98
* from the offset (blocks[ofs / sector_size]) */
99
struct
jffs2_eraseblock
*nextblock;
/* The block we're currently filling */
100
101
struct
jffs2_eraseblock
*gcblock;
/* The block we're currently garbage-collecting */
102
103
struct
list_head
clean_list;
/* Blocks 100% full of clean data */
104
struct
list_head
very_dirty_list;
/* Blocks with lots of dirty space */
105
struct
list_head
dirty_list;
/* Blocks with some dirty space */
106
struct
list_head
erasable_list;
/* Blocks which are completely dirty, and need erasing */
107
struct
list_head
erasable_pending_wbuf_list;
/* Blocks which need erasing but only after the current wbuf is flushed */
108
struct
list_head
erasing_list;
/* Blocks which are currently erasing */
109
struct
list_head
erase_checking_list;
/* Blocks which are being checked and marked */
110
struct
list_head
erase_pending_list;
/* Blocks which need erasing now */
111
struct
list_head
erase_complete_list;
/* Blocks which are erased and need the clean marker written to them */
112
struct
list_head
free_list;
/* Blocks which are free and ready to be used */
113
struct
list_head
bad_list;
/* Bad blocks. */
114
struct
list_head
bad_used_list;
/* Bad blocks with valid data in. */
115
116
spinlock_t
erase_completion_lock;
/* Protect free_list and erasing_list
117
against erase completion handler */
118
wait_queue_head_t
erase_wait;
/* For waiting for erases to complete */
119
120
wait_queue_head_t
inocache_wq;
121
int
inocache_hashsize;
122
struct
jffs2_inode_cache
**inocache_list;
123
spinlock_t
inocache_lock;
124
125
/* Sem to allow jffs2_garbage_collect_deletion_dirent to
126
drop the erase_completion_lock while it's holding a pointer
127
to an obsoleted node. I don't like this. Alternatives welcomed. */
128
struct
mutex
erase_free_sem;
129
130
uint32_t wbuf_pagesize;
/* 0 for NOR and other flashes with no wbuf */
131
132
#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
133
unsigned
char
*wbuf_verify;
/* read-back buffer for verification */
134
#endif
135
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
136
unsigned
char
*wbuf;
/* Write-behind buffer for NAND flash */
137
uint32_t wbuf_ofs;
138
uint32_t wbuf_len;
139
struct
jffs2_inodirty
*wbuf_inodes;
140
struct
rw_semaphore
wbuf_sem;
/* Protects the write buffer */
141
142
struct
delayed_work
wbuf_dwork;
/* write-buffer write-out work */
143
144
unsigned
char
*oobbuf;
145
int
oobavail;
/* How many bytes are available for JFFS2 in OOB */
146
#endif
147
148
struct
jffs2_summary
*summary;
/* Summary information */
149
struct
jffs2_mount_opts
mount_opts;
150
151
#ifdef CONFIG_JFFS2_FS_XATTR
152
#define XATTRINDEX_HASHSIZE (57)
153
uint32_t highest_xid;
154
uint32_t highest_xseqno;
155
struct
list_head
xattrindex[XATTRINDEX_HASHSIZE];
156
struct
list_head
xattr_unchecked;
157
struct
list_head
xattr_dead_list;
158
struct
jffs2_xattr_ref
*xref_dead_list;
159
struct
jffs2_xattr_ref
*xref_temp;
160
struct
rw_semaphore
xattr_sem;
161
uint32_t xdatum_mem_usage;
162
uint32_t xdatum_mem_threshold;
163
#endif
164
/* OS-private pointer for getting back to master superblock info */
165
void
*os_priv;
166
};
167
168
#endif
/* _JFFS2_FS_SB */
rtems-jffs2-config.h
completion
Definition
completion.h:4
delayed_work
Definition
workqueue.h:21
jffs2_eraseblock
Definition
nodelist.h:278
jffs2_inode_cache
Definition
nodelist.h:158
jffs2_inodirty
Definition
wbuf.c:43
jffs2_mount_opts
Definition
jffs2_fs_sb.h:34
jffs2_sb_info
Definition
jffs2_fs_sb.h:51
jffs2_summary
Definition
summary.h:161
jffs2_xattr_ref
Definition
xattr.h:46
list_head
Definition
list.h:57
mtd_info
Definition
mtd.h:9
mutex
Definition
mutex.h:4
rw_semaphore
Definition
rwsem.h:4
spinlock_t
Definition
spinlock.h:5
wait_queue_head_t
Definition
wait.h:5
Generated by
1.18.0