diff options
Diffstat (limited to 'fs/jffs2/xattr.h')
-rw-r--r-- | fs/jffs2/xattr.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h index 2c199856c582..06ab7b880212 100644 --- a/fs/jffs2/xattr.h +++ b/fs/jffs2/xattr.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */ | 17 | #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */ |
18 | #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */ | 18 | #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */ |
19 | #define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */ | ||
19 | 20 | ||
20 | struct jffs2_xattr_datum | 21 | struct jffs2_xattr_datum |
21 | { | 22 | { |
@@ -23,7 +24,7 @@ struct jffs2_xattr_datum | |||
23 | struct jffs2_raw_node_ref *node; | 24 | struct jffs2_raw_node_ref *node; |
24 | uint8_t class; | 25 | uint8_t class; |
25 | uint8_t flags; | 26 | uint8_t flags; |
26 | uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */ | 27 | uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */ |
27 | 28 | ||
28 | struct list_head xindex; /* chained from c->xattrindex[n] */ | 29 | struct list_head xindex; /* chained from c->xattrindex[n] */ |
29 | uint32_t refcnt; /* # of xattr_ref refers this */ | 30 | uint32_t refcnt; /* # of xattr_ref refers this */ |
@@ -47,6 +48,7 @@ struct jffs2_xattr_ref | |||
47 | uint8_t flags; /* Currently unused */ | 48 | uint8_t flags; /* Currently unused */ |
48 | u16 unused; | 49 | u16 unused; |
49 | 50 | ||
51 | uint32_t xseqno; | ||
50 | union { | 52 | union { |
51 | struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ | 53 | struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ |
52 | uint32_t ino; /* only used in scanning/building */ | 54 | uint32_t ino; /* only used in scanning/building */ |
@@ -58,6 +60,34 @@ struct jffs2_xattr_ref | |||
58 | struct jffs2_xattr_ref *next; /* chained from ic->xref_list */ | 60 | struct jffs2_xattr_ref *next; /* chained from ic->xref_list */ |
59 | }; | 61 | }; |
60 | 62 | ||
63 | #define XDATUM_DELETE_MARKER (0xffffffff) | ||
64 | #define XREF_DELETE_MARKER (0x00000001) | ||
65 | static inline int is_xattr_datum_dead(struct jffs2_xattr_datum *xd) | ||
66 | { | ||
67 | return (xd->version == XDATUM_DELETE_MARKER); | ||
68 | } | ||
69 | |||
70 | static inline void set_xattr_datum_dead(struct jffs2_xattr_datum *xd) | ||
71 | { | ||
72 | xd->version = XDATUM_DELETE_MARKER; | ||
73 | } | ||
74 | |||
75 | static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
76 | { | ||
77 | return ((ref->xseqno & XREF_DELETE_MARKER) != 0); | ||
78 | } | ||
79 | |||
80 | static inline void set_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
81 | { | ||
82 | ref->xseqno |= XREF_DELETE_MARKER; | ||
83 | } | ||
84 | |||
85 | static inline void clr_xattr_ref_dead(struct jffs2_xattr_ref *ref) | ||
86 | { | ||
87 | ref->xseqno &= ~XREF_DELETE_MARKER; | ||
88 | } | ||
89 | |||
90 | |||
61 | #ifdef CONFIG_JFFS2_FS_XATTR | 91 | #ifdef CONFIG_JFFS2_FS_XATTR |
62 | 92 | ||
63 | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); | 93 | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); |
@@ -70,9 +100,13 @@ extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c | |||
70 | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 100 | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
71 | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 101 | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
72 | 102 | ||
73 | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); | 103 | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd, |
74 | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); | 104 | struct jffs2_raw_node_ref *raw); |
105 | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | ||
106 | struct jffs2_raw_node_ref *raw); | ||
75 | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); | 107 | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); |
108 | extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); | ||
109 | extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); | ||
76 | 110 | ||
77 | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, | 111 | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, |
78 | char *buffer, size_t size); | 112 | char *buffer, size_t size); |