12 #ifndef __JFFS2_NODELIST_H__ 13 #define __JFFS2_NODELIST_H__ 16 #include <linux/types.h> 17 #include <linux/jffs2.h> 18 #include "jffs2_fs_sb.h" 19 #include "jffs2_fs_i.h" 30 #define JFFS2_NATIVE_ENDIAN 35 #if defined(JFFS2_NATIVE_ENDIAN) 36 #define cpu_to_je16(x) ((jint16_t){x}) 37 #define cpu_to_je32(x) ((jint32_t){x}) 38 #define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)}) 40 #define constant_cpu_to_je16(x) ((jint16_t){x}) 41 #define constant_cpu_to_je32(x) ((jint32_t){x}) 43 #define je16_to_cpu(x) ((x).v16) 44 #define je32_to_cpu(x) ((x).v32) 45 #define jemode_to_cpu(x) (jffs2_to_os_mode((x).m)) 46 #elif defined(JFFS2_BIG_ENDIAN) 47 #define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)}) 48 #define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)}) 49 #define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))}) 51 #define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_be16(x)}) 52 #define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_be32(x)}) 54 #define je16_to_cpu(x) (be16_to_cpu(x.v16)) 55 #define je32_to_cpu(x) (be32_to_cpu(x.v32)) 56 #define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m))) 57 #elif defined(JFFS2_LITTLE_ENDIAN) 58 #define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)}) 59 #define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)}) 60 #define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))}) 62 #define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_le16(x)}) 63 #define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_le32(x)}) 65 #define je16_to_cpu(x) (le16_to_cpu(x.v16)) 66 #define je32_to_cpu(x) (le32_to_cpu(x.v32)) 67 #define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m))) 73 #define JFFS2_MIN_NODE_HEADER sizeof(struct jffs2_raw_dirent) 88 uint32_t flash_offset;
95 #define REF_LINK_NODE ((int32_t)-1) 96 #define REF_EMPTY_NODE ((int32_t)-2) 99 #define REFS_PER_BLOCK ((255/sizeof(struct jffs2_raw_node_ref))-1) 106 if (ref->flash_offset == REF_LINK_NODE) {
107 ref = ref->next_in_ino;
113 if (ref->flash_offset == REF_EMPTY_NODE)
121 while(raw->next_in_ino)
122 raw = raw->next_in_ino;
132 #define REF_UNCHECKED 0 133 #define REF_OBSOLETE 1 134 #define REF_PRISTINE 2 136 #define ref_flags(ref) ((ref)->flash_offset & 3) 137 #define ref_offset(ref) ((ref)->flash_offset & ~3) 138 #define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE) 139 #define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0) 144 #define dirent_node_state(rd) ( (je32_to_cpu((rd)->ino)?REF_PRISTINE:REF_NORMAL) ) 176 #ifdef CONFIG_JFFS2_FS_XATTR 188 #define INO_STATE_UNCHECKED 0 189 #define INO_STATE_CHECKING 1 190 #define INO_STATE_PRESENT 2 191 #define INO_STATE_CHECKEDABSENT 3 192 #define INO_STATE_GC 4 193 #define INO_STATE_READING 5 194 #define INO_STATE_CLEARING 6 196 #define INO_FLAGS_XATTR_CHECKED 0x01 197 #define INO_FLAGS_IS_DIR 0x02 199 #define RAWNODE_CLASS_INODE_CACHE 0 200 #define RAWNODE_CLASS_XATTR_DATUM 1 201 #define RAWNODE_CLASS_XATTR_REF 2 203 #define INOCACHE_HASHSIZE_MIN 128 204 #define INOCACHE_HASHSIZE_MAX 1024 206 #define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size) 234 uint32_t partial_crc;
244 uint32_t highest_version;
245 uint32_t latest_mctime;
262 unsigned char name[0];
283 uint32_t unchecked_size;
286 uint32_t wasted_size;
289 uint32_t allocated_refs;
296 static inline int jffs2_blocks_use_vmalloc(
struct jffs2_sb_info *c)
298 return ((c->flash_size / c->sector_size) * sizeof (
struct jffs2_eraseblock)) > (128L * 1024L);
301 #define ref_totlen(a, b, c) __jffs2_ref_totlen((a), (b), (c)) 303 #define ALLOC_NORMAL 0 304 #define ALLOC_DELETION 1 306 #define ALLOC_NORETRY 3 309 #define VERYDIRTY(c, size) ((size) >= ((c)->sector_size / 2)) 312 #define ISDIRTY(size) ((size) > sizeof (struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN) 314 #define PAD(x) (((x)+3)&~3) 319 if (old_valid_dev(rdev)) {
320 jdev->old_id = cpu_to_je16(old_encode_dev(rdev));
321 return sizeof(jdev->old_id);
323 jdev->new_id = cpu_to_je32(new_encode_dev(rdev));
324 return sizeof(jdev->new_id);
331 struct rb_node *node = rb_first(root);
341 struct rb_node *node = rb_last(root);
349 #define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb) 350 #define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb) 351 #define frag_parent(frag) rb_entry(rb_parent(&(frag)->rb), struct jffs2_node_frag, rb) 352 #define frag_left(frag) rb_entry((frag)->rb.rb_left, struct jffs2_node_frag, rb) 353 #define frag_right(frag) rb_entry((frag)->rb.rb_right, struct jffs2_node_frag, rb) 354 #define frag_erase(frag, list) rb_erase(&frag->rb, list); 356 #define tn_next(tn) rb_entry(rb_next(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 357 #define tn_prev(tn) rb_entry(rb_prev(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 358 #define tn_parent(tn) rb_entry(rb_parent(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 359 #define tn_left(tn) rb_entry((tn)->rb.rb_left, struct jffs2_tmp_dnode_info, rb) 360 #define tn_right(tn) rb_entry((tn)->rb.rb_right, struct jffs2_tmp_dnode_info, rb) 361 #define tn_erase(tn, list) rb_erase(&tn->rb, list); 362 #define tn_last(list) rb_entry(rb_last(list), struct jffs2_tmp_dnode_info, rb) 363 #define tn_first(list) rb_entry(rb_first(list), struct jffs2_tmp_dnode_info, rb) 379 uint32_t ofs, uint32_t len,
387 int jffs2_reserve_space(
struct jffs2_sb_info *c, uint32_t minsize,
388 uint32_t *len,
int prio, uint32_t sumsize);
389 int jffs2_reserve_space_gc(
struct jffs2_sb_info *c, uint32_t minsize,
390 uint32_t *len, uint32_t sumsize);
392 uint32_t ofs, uint32_t len,
402 uint32_t datalen,
int alloc_mode);
405 uint32_t namelen,
int alloc_mode);
408 uint32_t offset, uint32_t writelen, uint32_t *retlen);
414 uint8_t type,
const char *name,
int namelen, uint32_t time);
424 int jffs2_create_slab_caches(
void);
425 void jffs2_destroy_slab_caches(
void);
444 #ifdef CONFIG_JFFS2_FS_XATTR 459 unsigned char *buf, uint32_t offset, uint32_t len);
473 int jffs2_erase_pending_blocks(
struct jffs2_sb_info *c,
int count);
476 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER 478 int jffs2_flush_wbuf_gc(
struct jffs2_sb_info *c, uint32_t ino);
Definition: nodelist.h:82
Definition: nodelist.h:158
Definition: nodelist.h:277
Definition: nodelist.h:213
Definition: nodelist.h:251
Definition: nodelist.h:269
Definition: jffs2_fs_sb.h:48
Definition: jffs2_fs_i.h:20
unsigned size
Definition: tte.h:74
Definition: nodelist.h:240
Definition: nodelist.h:228
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77