/src/barebox/fs/jffs2/xattr.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | /* |
3 | | * JFFS2 -- Journalling Flash File System, Version 2. |
4 | | * |
5 | | * Copyright © 2006 NEC Corporation |
6 | | * |
7 | | * Created by KaiGai Kohei <kaigai@ak.jp.nec.com> |
8 | | */ |
9 | | |
10 | | #ifndef _JFFS2_FS_XATTR_H_ |
11 | | #define _JFFS2_FS_XATTR_H_ |
12 | | |
13 | | #include <linux/list.h> |
14 | | |
15 | | #define JFFS2_XFLAGS_HOT (0x01) /* This datum is HOT */ |
16 | | #define JFFS2_XFLAGS_BIND (0x02) /* This datum is not reclaimed */ |
17 | | #define JFFS2_XFLAGS_DEAD (0x40) /* This datum is already dead */ |
18 | | #define JFFS2_XFLAGS_INVALID (0x80) /* This datum contains crc error */ |
19 | | |
20 | | struct jffs2_xattr_datum |
21 | | { |
22 | | void *always_null; |
23 | | struct jffs2_raw_node_ref *node; |
24 | | uint8_t class; |
25 | | uint8_t flags; |
26 | | uint16_t xprefix; /* see JFFS2_XATTR_PREFIX_* */ |
27 | | |
28 | | struct list_head xindex; /* chained from c->xattrindex[n] */ |
29 | | uint32_t refcnt; /* # of xattr_ref refers this */ |
30 | | uint32_t xid; |
31 | | uint32_t version; |
32 | | |
33 | | uint32_t data_crc; |
34 | | uint32_t hashkey; |
35 | | char *xname; /* XATTR name without prefix */ |
36 | | uint32_t name_len; /* length of xname */ |
37 | | char *xvalue; /* XATTR value */ |
38 | | uint32_t value_len; /* length of xvalue */ |
39 | | }; |
40 | | |
41 | | struct jffs2_inode_cache; |
42 | | struct jffs2_xattr_ref |
43 | | { |
44 | | void *always_null; |
45 | | struct jffs2_raw_node_ref *node; |
46 | | uint8_t class; |
47 | | uint8_t flags; /* Currently unused */ |
48 | | u16 unused; |
49 | | |
50 | | uint32_t xseqno; |
51 | | union { |
52 | | struct jffs2_inode_cache *ic; /* reference to jffs2_inode_cache */ |
53 | | uint32_t ino; /* only used in scanning/building */ |
54 | | }; |
55 | | union { |
56 | | struct jffs2_xattr_datum *xd; /* reference to jffs2_xattr_datum */ |
57 | | uint32_t xid; /* only used in sccanning/building */ |
58 | | }; |
59 | | struct jffs2_xattr_ref *next; /* chained from ic->xref_list */ |
60 | | }; |
61 | | |
62 | | #define XREF_DELETE_MARKER (0x00000001) |
63 | | static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref) |
64 | 0 | { |
65 | 0 | return ((ref->xseqno & XREF_DELETE_MARKER) != 0); |
66 | 0 | } Unexecuted instantiation: compr.c:is_xattr_ref_dead Unexecuted instantiation: dir.c:is_xattr_ref_dead Unexecuted instantiation: nodelist.c:is_xattr_ref_dead Unexecuted instantiation: malloc.c:is_xattr_ref_dead Unexecuted instantiation: read.c:is_xattr_ref_dead Unexecuted instantiation: readinode.c:is_xattr_ref_dead Unexecuted instantiation: scan.c:is_xattr_ref_dead Unexecuted instantiation: build.c:is_xattr_ref_dead Unexecuted instantiation: fs.c:is_xattr_ref_dead Unexecuted instantiation: super.c:is_xattr_ref_dead Unexecuted instantiation: debug.c:is_xattr_ref_dead |
67 | | |
68 | | #ifdef CONFIG_JFFS2_FS_XATTR |
69 | | |
70 | | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); |
71 | | extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c); |
72 | | extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c); |
73 | | |
74 | | extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, |
75 | | uint32_t xid, uint32_t version); |
76 | | |
77 | | extern void jffs2_xattr_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
78 | | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
79 | | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); |
80 | | |
81 | | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd, |
82 | | struct jffs2_raw_node_ref *raw); |
83 | | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, |
84 | | struct jffs2_raw_node_ref *raw); |
85 | | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); |
86 | | extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); |
87 | | extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); |
88 | | |
89 | | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, |
90 | | char *buffer, size_t size); |
91 | | extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, |
92 | | const char *buffer, size_t size, int flags); |
93 | | |
94 | | extern const struct xattr_handler *jffs2_xattr_handlers[]; |
95 | | extern const struct xattr_handler jffs2_user_xattr_handler; |
96 | | extern const struct xattr_handler jffs2_trusted_xattr_handler; |
97 | | |
98 | | extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t); |
99 | | |
100 | | #else |
101 | | |
102 | | #define jffs2_init_xattr_subsystem(c) |
103 | | #define jffs2_build_xattr_subsystem(c) |
104 | | #define jffs2_clear_xattr_subsystem(c) |
105 | | |
106 | | #define jffs2_xattr_do_crccheck_inode(c, ic) |
107 | | #define jffs2_xattr_delete_inode(c, ic) |
108 | | #define jffs2_xattr_free_inode(c, ic) |
109 | | #define jffs2_verify_xattr(c) (1) |
110 | | |
111 | 0 | #define jffs2_xattr_handlers NULL |
112 | | #define jffs2_listxattr NULL |
113 | | |
114 | | #endif /* CONFIG_JFFS2_FS_XATTR */ |
115 | | |
116 | | #ifdef CONFIG_JFFS2_FS_SECURITY |
117 | | extern int jffs2_init_security(struct inode *inode, struct inode *dir, |
118 | | const struct qstr *qstr); |
119 | | extern const struct xattr_handler jffs2_security_xattr_handler; |
120 | | #else |
121 | | #define jffs2_init_security(inode,dir,qstr) (0) |
122 | | #endif /* CONFIG_JFFS2_FS_SECURITY */ |
123 | | |
124 | | #endif /* _JFFS2_FS_XATTR_H_ */ |