12 #ifndef __JFFS2_NODELIST_H__ 13 #define __JFFS2_NODELIST_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 198 #define RAWNODE_CLASS_INODE_CACHE 0 199 #define RAWNODE_CLASS_XATTR_DATUM 1 200 #define RAWNODE_CLASS_XATTR_REF 2 202 #define INOCACHE_HASHSIZE_MIN 128 203 #define INOCACHE_HASHSIZE_MAX 1024 205 #define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size) 233 uint32_t partial_crc;
243 uint32_t highest_version;
244 uint32_t latest_mctime;
258 unsigned char name[0];
279 uint32_t unchecked_size;
282 uint32_t wasted_size;
285 uint32_t allocated_refs;
292 static inline int jffs2_blocks_use_vmalloc(
struct jffs2_sb_info *c)
294 return ((c->flash_size / c->sector_size) * sizeof (
struct jffs2_eraseblock)) > (128L * 1024L);
297 #define ref_totlen(a, b, c) __jffs2_ref_totlen((a), (b), (c)) 299 #define ALLOC_NORMAL 0 300 #define ALLOC_DELETION 1 302 #define ALLOC_NORETRY 3 305 #define VERYDIRTY(c, size) ((size) >= ((c)->sector_size / 2)) 308 #define ISDIRTY(size) ((size) > sizeof (struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN) 310 #define PAD(x) (((x)+3)&~3) 315 if (old_valid_dev(rdev)) {
316 jdev->old_id = cpu_to_je16(old_encode_dev(rdev));
317 return sizeof(jdev->old_id);
319 jdev->new_id = cpu_to_je32(new_encode_dev(rdev));
320 return sizeof(jdev->new_id);
327 struct rb_node *node = rb_first(root);
337 struct rb_node *node = rb_last(root);
345 #define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb) 346 #define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb) 347 #define frag_parent(frag) rb_entry(rb_parent(&(frag)->rb), struct jffs2_node_frag, rb) 348 #define frag_left(frag) rb_entry((frag)->rb.rb_left, struct jffs2_node_frag, rb) 349 #define frag_right(frag) rb_entry((frag)->rb.rb_right, struct jffs2_node_frag, rb) 350 #define frag_erase(frag, list) rb_erase(&frag->rb, list); 352 #define tn_next(tn) rb_entry(rb_next(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 353 #define tn_prev(tn) rb_entry(rb_prev(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 354 #define tn_parent(tn) rb_entry(rb_parent(&(tn)->rb), struct jffs2_tmp_dnode_info, rb) 355 #define tn_left(tn) rb_entry((tn)->rb.rb_left, struct jffs2_tmp_dnode_info, rb) 356 #define tn_right(tn) rb_entry((tn)->rb.rb_right, struct jffs2_tmp_dnode_info, rb) 357 #define tn_erase(tn, list) rb_erase(&tn->rb, list); 358 #define tn_last(list) rb_entry(rb_last(list), struct jffs2_tmp_dnode_info, rb) 359 #define tn_first(list) rb_entry(rb_first(list), struct jffs2_tmp_dnode_info, rb) 372 uint32_t jffs2_truncate_fragtree (
struct jffs2_sb_info *c,
struct rb_root *list, uint32_t size);
375 uint32_t ofs, uint32_t len,
383 int jffs2_reserve_space(
struct jffs2_sb_info *c, uint32_t minsize,
384 uint32_t *len,
int prio, uint32_t sumsize);
385 int jffs2_reserve_space_gc(
struct jffs2_sb_info *c, uint32_t minsize,
386 uint32_t *len, uint32_t sumsize);
388 uint32_t ofs, uint32_t len,
398 uint32_t datalen,
int alloc_mode);
401 uint32_t namelen,
int alloc_mode);
404 uint32_t offset, uint32_t writelen, uint32_t *retlen);
410 uint8_t type,
const char *name,
int namelen, uint32_t time);
420 int jffs2_create_slab_caches(
void);
421 void jffs2_destroy_slab_caches(
void);
440 #ifdef CONFIG_JFFS2_FS_XATTR 455 unsigned char *buf, uint32_t offset, uint32_t len);
469 int jffs2_erase_pending_blocks(
struct jffs2_sb_info *c,
int count);
472 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER 474 int jffs2_flush_wbuf_gc(
struct jffs2_sb_info *c, uint32_t ino);
Definition: nodelist.h:83
Definition: nodelist.h:159
Definition: nodelist.h:274
Definition: nodelist.h:213
Definition: nodelist.h:251
Definition: nodelist.h:266
Definition: jffs2_fs_sb.h:49
Definition: jffs2_fs_i.h:21
Definition: nodelist.h:240
struct jffs2_raw_node_ref * jffs2_add_physical_node_ref(struct jffs2_sb_info *c, uint32_t ofs, uint32_t len, struct jffs2_inode_cache *ic)
jffs2_add_physical_node_ref - add a physical node reference to the list : superblock info : new node ...
Definition: nodemgmt.c:495
Definition: nodelist.h:228