aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodelist.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/nodelist.h')
-rw-r--r--fs/jffs2/nodelist.h44
1 files changed, 27 insertions, 17 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index ee5aedcffc12..1e1c39da6da4 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -77,9 +77,9 @@
77struct jffs2_raw_node_ref 77struct jffs2_raw_node_ref
78{ 78{
79 struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref 79 struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref
80 for this inode. If this is the last, it points to the inode_cache 80 for this object. If this _is_ the last, it points to the inode_cache,
81 for this inode instead. The inode_cache will have NULL in the first 81 xattr_ref or xattr_datum instead. The common part of those structures
82 word so you know when you've got there :) */ 82 has NULL in the first word. See jffs2_raw_ref_to_ic() below */
83 struct jffs2_raw_node_ref *next_phys; 83 struct jffs2_raw_node_ref *next_phys;
84 uint32_t flash_offset; 84 uint32_t flash_offset;
85#define TEST_TOTLEN 85#define TEST_TOTLEN
@@ -88,6 +88,18 @@ struct jffs2_raw_node_ref
88#endif 88#endif
89}; 89};
90 90
91static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw)
92{
93 while(raw->next_in_ino) {
94 raw = raw->next_in_ino;
95 }
96
97 /* NB. This can be a jffs2_xattr_datum or jffs2_xattr_ref and
98 not actually a jffs2_inode_cache. Check ->class */
99 return ((struct jffs2_inode_cache *)raw);
100}
101
102
91 /* flash_offset & 3 always has to be zero, because nodes are 103 /* flash_offset & 3 always has to be zero, because nodes are
92 always aligned at 4 bytes. So we have a couple of extra bits 104 always aligned at 4 bytes. So we have a couple of extra bits
93 to play with, which indicate the node's status; see below: */ 105 to play with, which indicate the node's status; see below: */
@@ -113,20 +125,27 @@ struct jffs2_raw_node_ref
113 a pointer to the first physical node which is part of this inode, too. 125 a pointer to the first physical node which is part of this inode, too.
114*/ 126*/
115struct jffs2_inode_cache { 127struct jffs2_inode_cache {
128 /* First part of structure is shared with other objects which
129 can terminate the raw node refs' next_in_ino list -- which
130 currently struct jffs2_xattr_datum and struct jffs2_xattr_ref. */
131
116 struct jffs2_full_dirent *scan_dents; /* Used during scan to hold 132 struct jffs2_full_dirent *scan_dents; /* Used during scan to hold
117 temporary lists of dirents, and later must be set to 133 temporary lists of dirents, and later must be set to
118 NULL to mark the end of the raw_node_ref->next_in_ino 134 NULL to mark the end of the raw_node_ref->next_in_ino
119 chain. */ 135 chain. */
120 u8 class; /* It's used for identification */
121 u8 flags;
122 uint16_t state;
123 struct jffs2_inode_cache *next;
124 struct jffs2_raw_node_ref *nodes; 136 struct jffs2_raw_node_ref *nodes;
137 uint8_t class; /* It's used for identification */
138
139 /* end of shared structure */
140
141 uint8_t flags;
142 uint16_t state;
125 uint32_t ino; 143 uint32_t ino;
126 int nlink; 144 struct jffs2_inode_cache *next;
127#ifdef CONFIG_JFFS2_FS_XATTR 145#ifdef CONFIG_JFFS2_FS_XATTR
128 struct jffs2_xattr_ref *xref; 146 struct jffs2_xattr_ref *xref;
129#endif 147#endif
148 int nlink;
130}; 149};
131 150
132/* Inode states for 'state' above. We need the 'GC' state to prevent 151/* Inode states for 'state' above. We need the 'GC' state to prevent
@@ -250,15 +269,6 @@ static inline int jffs2_encode_dev(union jffs2_device_node *jdev, dev_t rdev)
250 } 269 }
251} 270}
252 271
253static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw)
254{
255 while(raw->next_in_ino) {
256 raw = raw->next_in_ino;
257 }
258
259 return ((struct jffs2_inode_cache *)raw);
260}
261
262static inline struct jffs2_node_frag *frag_first(struct rb_root *root) 272static inline struct jffs2_node_frag *frag_first(struct rb_root *root)
263{ 273{
264 struct rb_node *node = root->rb_node; 274 struct rb_node *node = root->rb_node;