linux/fs/jffs2/xattr.h

/*
 * JFFS2 -- Journalling Flash File System, Version 2.
 *
 * Copyright © 2006  NEC Corporation
 *
 * Created by KaiGai Kohei <[email protected]>
 *
 * For licensing information, see the file 'LICENCE' in this directory.
 *
 */

#ifndef _JFFS2_FS_XATTR_H_
#define _JFFS2_FS_XATTR_H_

#include <linux/xattr.h>
#include <linux/list.h>

#define JFFS2_XFLAGS_HOT
#define JFFS2_XFLAGS_BIND
#define JFFS2_XFLAGS_DEAD
#define JFFS2_XFLAGS_INVALID

struct jffs2_xattr_datum
{};

struct jffs2_inode_cache;
struct jffs2_xattr_ref
{};

#define XREF_DELETE_MARKER
static inline int is_xattr_ref_dead(struct jffs2_xattr_ref *ref)
{}

#ifdef CONFIG_JFFS2_FS_XATTR

extern void jffs2_init_xattr_subsystem(struct jffs2_sb_info *c);
extern int 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,
							 uint32_t xid, uint32_t version);

extern void jffs2_xattr_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
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);

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);
extern int jffs2_verify_xattr(struct jffs2_sb_info *c);
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);

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 const struct xattr_handler * const jffs2_xattr_handlers[];
extern const struct xattr_handler jffs2_user_xattr_handler;
extern const struct xattr_handler jffs2_trusted_xattr_handler;

extern ssize_t jffs2_listxattr(struct dentry *, char *, size_t);

#else

#define jffs2_init_xattr_subsystem
#define jffs2_build_xattr_subsystem
#define jffs2_clear_xattr_subsystem

#define jffs2_xattr_do_crccheck_inode
#define jffs2_xattr_delete_inode
#define jffs2_xattr_free_inode
#define jffs2_verify_xattr

#define jffs2_xattr_handlers
#define jffs2_listxattr

#endif /* CONFIG_JFFS2_FS_XATTR */

#ifdef CONFIG_JFFS2_FS_SECURITY
extern int jffs2_init_security(struct inode *inode, struct inode *dir,
			       const struct qstr *qstr);
extern const struct xattr_handler jffs2_security_xattr_handler;
#else
#define jffs2_init_security
#endif /* CONFIG_JFFS2_FS_SECURITY */

#endif /* _JFFS2_FS_XATTR_H_ */