aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodelist.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-04-29 22:38:01 -0400
committerPaul Mackerras <paulus@samba.org>2007-04-29 22:38:01 -0400
commit49e1900d4cc2e7bcecb681fe60f0990bec2dcce8 (patch)
tree253801ebf57e0a23856a2c7be129c2c178f62fdf /fs/jffs2/nodelist.h
parent34f6d749c0a328817d5e36274e53121c1db734dc (diff)
parentb9099ff63c75216d6ca10bce5a1abcd9293c27e6 (diff)
Merge branch 'linux-2.6' into for-2.6.22
Diffstat (limited to 'fs/jffs2/nodelist.h')
-rw-r--r--fs/jffs2/nodelist.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 4178b4b55948..25126a062cae 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -1,14 +1,12 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * 5 *
6 * Created by David Woodhouse <dwmw2@infradead.org> 6 * Created by David Woodhouse <dwmw2@infradead.org>
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.h,v 1.140 2005/09/07 08:34:54 havasi Exp $
11 *
12 */ 10 */
13 11
14#ifndef __JFFS2_NODELIST_H__ 12#ifndef __JFFS2_NODELIST_H__
@@ -40,6 +38,9 @@
40#define cpu_to_je32(x) ((jint32_t){x}) 38#define cpu_to_je32(x) ((jint32_t){x})
41#define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)}) 39#define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)})
42 40
41#define constant_cpu_to_je16(x) ((jint16_t){x})
42#define constant_cpu_to_je32(x) ((jint32_t){x})
43
43#define je16_to_cpu(x) ((x).v16) 44#define je16_to_cpu(x) ((x).v16)
44#define je32_to_cpu(x) ((x).v32) 45#define je32_to_cpu(x) ((x).v32)
45#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m)) 46#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m))
@@ -48,6 +49,9 @@
48#define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)}) 49#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))}) 50#define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))})
50 51
52#define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_be16(x)})
53#define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_be32(x)})
54
51#define je16_to_cpu(x) (be16_to_cpu(x.v16)) 55#define je16_to_cpu(x) (be16_to_cpu(x.v16))
52#define je32_to_cpu(x) (be32_to_cpu(x.v32)) 56#define je32_to_cpu(x) (be32_to_cpu(x.v32))
53#define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m))) 57#define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m)))
@@ -56,6 +60,9 @@
56#define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)}) 60#define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
57#define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))}) 61#define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))})
58 62
63#define constant_cpu_to_je16(x) ((jint16_t){__constant_cpu_to_le16(x)})
64#define constant_cpu_to_je32(x) ((jint32_t){__constant_cpu_to_le32(x)})
65
59#define je16_to_cpu(x) (le16_to_cpu(x.v16)) 66#define je16_to_cpu(x) (le16_to_cpu(x.v16))
60#define je32_to_cpu(x) (le32_to_cpu(x.v32)) 67#define je32_to_cpu(x) (le32_to_cpu(x.v32))
61#define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m))) 68#define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m)))
@@ -216,7 +223,20 @@ struct jffs2_tmp_dnode_info
216 uint32_t version; 223 uint32_t version;
217 uint32_t data_crc; 224 uint32_t data_crc;
218 uint32_t partial_crc; 225 uint32_t partial_crc;
219 uint32_t csize; 226 uint16_t csize;
227 uint16_t overlapped;
228};
229
230/* Temporary data structure used during readinode. */
231struct jffs2_readinode_info
232{
233 struct rb_root tn_root;
234 struct jffs2_tmp_dnode_info *mdata_tn;
235 uint32_t highest_version;
236 uint32_t latest_mctime;
237 uint32_t mctime_ver;
238 struct jffs2_full_dirent *fds;
239 struct jffs2_raw_node_ref *latest_ref;
220}; 240};
221 241
222struct jffs2_full_dirent 242struct jffs2_full_dirent
@@ -319,6 +339,15 @@ static inline struct jffs2_node_frag *frag_last(struct rb_root *root)
319#define frag_right(frag) rb_entry((frag)->rb.rb_right, struct jffs2_node_frag, rb) 339#define frag_right(frag) rb_entry((frag)->rb.rb_right, struct jffs2_node_frag, rb)
320#define frag_erase(frag, list) rb_erase(&frag->rb, list); 340#define frag_erase(frag, list) rb_erase(&frag->rb, list);
321 341
342#define tn_next(tn) rb_entry(rb_next(&(tn)->rb), struct jffs2_tmp_dnode_info, rb)
343#define tn_prev(tn) rb_entry(rb_prev(&(tn)->rb), struct jffs2_tmp_dnode_info, rb)
344#define tn_parent(tn) rb_entry(rb_parent(&(tn)->rb), struct jffs2_tmp_dnode_info, rb)
345#define tn_left(tn) rb_entry((tn)->rb.rb_left, struct jffs2_tmp_dnode_info, rb)
346#define tn_right(tn) rb_entry((tn)->rb.rb_right, struct jffs2_tmp_dnode_info, rb)
347#define tn_erase(tn, list) rb_erase(&tn->rb, list);
348#define tn_last(list) rb_entry(rb_last(list), struct jffs2_tmp_dnode_info, rb)
349#define tn_first(list) rb_entry(rb_first(list), struct jffs2_tmp_dnode_info, rb)
350
322/* nodelist.c */ 351/* nodelist.c */
323void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list); 352void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list);
324void jffs2_set_inocache_state(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, int state); 353void jffs2_set_inocache_state(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, int state);
@@ -333,8 +362,7 @@ struct rb_node *rb_next(struct rb_node *);
333struct rb_node *rb_prev(struct rb_node *); 362struct rb_node *rb_prev(struct rb_node *);
334void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root); 363void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root);
335int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); 364int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn);
336void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size); 365uint32_t jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size);
337int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn);
338struct jffs2_raw_node_ref *jffs2_link_node_ref(struct jffs2_sb_info *c, 366struct jffs2_raw_node_ref *jffs2_link_node_ref(struct jffs2_sb_info *c,
339 struct jffs2_eraseblock *jeb, 367 struct jffs2_eraseblock *jeb,
340 uint32_t ofs, uint32_t len, 368 uint32_t ofs, uint32_t len,