| 
									
										
										
										
											2006-05-13 15:18:27 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * JFFS2 -- Journalling Flash File System, Version 2. | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2007-04-25 14:16:47 +01:00
										 |  |  |  * Copyright © 2006  NEC Corporation | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-05-13 15:18:27 +09:00
										 |  |  |  * Created by KaiGai Kohei <kaigai@ak.jp.nec.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * For licensing information, see the file 'LICENCE' in this directory. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-04-25 14:16:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | #ifndef _JFFS2_FS_XATTR_H_
 | 
					
						
							|  |  |  | #define _JFFS2_FS_XATTR_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/xattr.h>
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:17:11 +09:00
										 |  |  | #include <linux/list.h>
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define JFFS2_XFLAGS_HOT	(0x01)	/* This datum is HOT */
 | 
					
						
							|  |  |  | #define JFFS2_XFLAGS_BIND	(0x02)	/* This datum is not reclaimed */
 | 
					
						
							| 
									
										
										
										
											2006-06-24 09:14:13 +09:00
										 |  |  | #define JFFS2_XFLAGS_DEAD	(0x40)	/* This datum is already dead */
 | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | #define JFFS2_XFLAGS_INVALID	(0x80)	/* This datum contains crc error */
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct jffs2_xattr_datum | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	void *always_null; | 
					
						
							|  |  |  | 	struct jffs2_raw_node_ref *node; | 
					
						
							| 
									
										
										
										
											2006-05-22 16:32:05 +01:00
										 |  |  | 	uint8_t class; | 
					
						
							|  |  |  | 	uint8_t flags; | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | 	uint16_t xprefix;		/* see JFFS2_XATTR_PREFIX_* */ | 
					
						
							| 
									
										
										
										
											2006-05-22 16:32:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 	struct list_head xindex;	/* chained from c->xattrindex[n] */ | 
					
						
							| 
									
										
										
										
											2006-06-24 09:16:50 +09:00
										 |  |  | 	atomic_t refcnt;		/* # of xattr_ref refers this */ | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 	uint32_t xid; | 
					
						
							|  |  |  | 	uint32_t version; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	uint32_t data_crc; | 
					
						
							|  |  |  | 	uint32_t hashkey; | 
					
						
							|  |  |  | 	char *xname;		/* XATTR name without prefix */ | 
					
						
							|  |  |  | 	uint32_t name_len;	/* length of xname */ | 
					
						
							|  |  |  | 	char *xvalue;		/* XATTR value */ | 
					
						
							|  |  |  | 	uint32_t value_len;	/* length of xvalue */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:19:03 +09:00
										 |  |  | struct jffs2_inode_cache; | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | struct jffs2_xattr_ref | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	void *always_null; | 
					
						
							| 
									
										
										
										
											2006-05-22 16:32:05 +01:00
										 |  |  | 	struct jffs2_raw_node_ref *node; | 
					
						
							|  |  |  | 	uint8_t class; | 
					
						
							|  |  |  | 	uint8_t flags;		/* Currently unused */ | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 	u16 unused; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | 	uint32_t xseqno; | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 	union { | 
					
						
							|  |  |  | 		struct jffs2_inode_cache *ic;	/* reference to jffs2_inode_cache */ | 
					
						
							|  |  |  | 		uint32_t ino;			/* only used in scanning/building  */ | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 	union { | 
					
						
							|  |  |  | 		struct jffs2_xattr_datum *xd;	/* reference to jffs2_xattr_datum */ | 
					
						
							|  |  |  | 		uint32_t xid;			/* only used in sccanning/building */ | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2006-05-13 15:15:07 +09:00
										 |  |  | 	struct jffs2_xattr_ref *next;		/* chained from ic->xref_list */ | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | #define XREF_DELETE_MARKER	(0x00000001)
 | 
					
						
							|  |  |  | static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return ((ref->xseqno & XREF_DELETE_MARKER) != 0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | #ifdef CONFIG_JFFS2_FS_XATTR
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c); | 
					
						
							|  |  |  | extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c); | 
					
						
							|  |  |  | extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, | 
					
						
							| 
									
										
										
										
											2007-07-10 10:01:22 +01:00
										 |  |  | 							 uint32_t xid, uint32_t version); | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 
					
						
							|  |  |  | extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | extern int jffs2_garbage_collect_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd, | 
					
						
							|  |  |  | 					     struct jffs2_raw_node_ref *raw); | 
					
						
							|  |  |  | extern int jffs2_garbage_collect_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | 
					
						
							|  |  |  | 					   struct jffs2_raw_node_ref *raw); | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | extern int jffs2_verify_xattr(struct jffs2_sb_info *c); | 
					
						
							| 
									
										
										
										
											2006-06-11 10:35:15 +09:00
										 |  |  | extern void jffs2_release_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *xd); | 
					
						
							|  |  |  | extern void jffs2_release_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref); | 
					
						
							| 
									
										
										
										
											2006-05-13 15:09:47 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname, | 
					
						
							|  |  |  | 			     char *buffer, size_t size); | 
					
						
							|  |  |  | extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, | 
					
						
							|  |  |  | 			     const char *buffer, size_t size, int flags); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern struct xattr_handler *jffs2_xattr_handlers[]; | 
					
						
							|  |  |  | extern struct xattr_handler jffs2_user_xattr_handler; | 
					
						
							|  |  |  | extern struct xattr_handler jffs2_trusted_xattr_handler; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t); | 
					
						
							|  |  |  | #define jffs2_getxattr		generic_getxattr
 | 
					
						
							|  |  |  | #define jffs2_setxattr		generic_setxattr
 | 
					
						
							|  |  |  | #define jffs2_removexattr	generic_removexattr
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define jffs2_init_xattr_subsystem(c)
 | 
					
						
							|  |  |  | #define jffs2_build_xattr_subsystem(c)
 | 
					
						
							|  |  |  | #define jffs2_clear_xattr_subsystem(c)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define jffs2_xattr_delete_inode(c, ic)
 | 
					
						
							|  |  |  | #define jffs2_xattr_free_inode(c, ic)
 | 
					
						
							|  |  |  | #define jffs2_verify_xattr(c)			(1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define jffs2_xattr_handlers	NULL
 | 
					
						
							|  |  |  | #define jffs2_listxattr		NULL
 | 
					
						
							|  |  |  | #define jffs2_getxattr		NULL
 | 
					
						
							|  |  |  | #define jffs2_setxattr		NULL
 | 
					
						
							|  |  |  | #define jffs2_removexattr	NULL
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* CONFIG_JFFS2_FS_XATTR */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_JFFS2_FS_SECURITY
 | 
					
						
							|  |  |  | extern int jffs2_init_security(struct inode *inode, struct inode *dir); | 
					
						
							|  |  |  | extern struct xattr_handler jffs2_security_xattr_handler; | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define jffs2_init_security(inode,dir)	(0)
 | 
					
						
							|  |  |  | #endif /* CONFIG_JFFS2_FS_SECURITY */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* _JFFS2_FS_XATTR_H_ */
 |