2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
File: linux/reiserfs_xattr.h
|
|
|
|
*/
|
|
|
|
|
2007-02-10 17:46:24 +08:00
|
|
|
#ifndef _LINUX_REISERFS_XATTR_H
|
|
|
|
#define _LINUX_REISERFS_XATTR_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Magic value in header */
|
2005-07-13 11:21:28 +08:00
|
|
|
#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct reiserfs_xattr_header {
|
2005-07-13 11:21:28 +08:00
|
|
|
__le32 h_magic; /* magic number for identification */
|
|
|
|
__le32 h_hash; /* hash of the value */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
2007-02-10 17:46:24 +08:00
|
|
|
|
2006-04-25 21:52:51 +08:00
|
|
|
#include <linux/init.h>
|
2007-02-10 17:46:24 +08:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/rwsem.h>
|
|
|
|
#include <linux/reiserfs_fs_i.h>
|
|
|
|
#include <linux/reiserfs_fs.h>
|
|
|
|
|
|
|
|
struct inode;
|
|
|
|
struct dentry;
|
|
|
|
struct iattr;
|
|
|
|
struct super_block;
|
|
|
|
struct nameidata;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct reiserfs_xattr_handler {
|
|
|
|
char *prefix;
|
2005-07-13 11:21:28 +08:00
|
|
|
int (*init) (void);
|
|
|
|
void (*exit) (void);
|
|
|
|
int (*get) (struct inode * inode, const char *name, void *buffer,
|
|
|
|
size_t size);
|
|
|
|
int (*set) (struct inode * inode, const char *name, const void *buffer,
|
|
|
|
size_t size, int flags);
|
|
|
|
int (*del) (struct inode * inode, const char *name);
|
|
|
|
int (*list) (struct inode * inode, const char *name, int namelen,
|
|
|
|
char *out);
|
|
|
|
struct list_head handlers;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_REISERFS_FS_XATTR
|
|
|
|
#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
|
|
|
|
#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
|
2005-07-13 11:21:28 +08:00
|
|
|
ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
|
|
|
|
void *buffer, size_t size);
|
|
|
|
int reiserfs_setxattr(struct dentry *dentry, const char *name,
|
|
|
|
const void *value, size_t size, int flags);
|
|
|
|
ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
|
|
|
|
int reiserfs_removexattr(struct dentry *dentry, const char *name);
|
|
|
|
int reiserfs_delete_xattrs(struct inode *inode);
|
|
|
|
int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
|
|
|
|
int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
|
2008-07-16 09:03:57 +08:00
|
|
|
int reiserfs_permission(struct inode *inode, int mask);
|
2005-07-13 11:21:28 +08:00
|
|
|
|
|
|
|
int reiserfs_xattr_del(struct inode *, const char *);
|
|
|
|
int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
|
|
|
|
int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
extern struct reiserfs_xattr_handler user_handler;
|
|
|
|
extern struct reiserfs_xattr_handler trusted_handler;
|
|
|
|
extern struct reiserfs_xattr_handler security_handler;
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
int reiserfs_xattr_register_handlers(void) __init;
|
|
|
|
void reiserfs_xattr_unregister_handlers(void);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
down_write(&REISERFS_XATTR_DIR_SEM(sb));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
up_write(&REISERFS_XATTR_DIR_SEM(sb));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
down_read(&REISERFS_XATTR_DIR_SEM(sb));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
up_read(&REISERFS_XATTR_DIR_SEM(sb));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
down_write(&REISERFS_I(inode)->xattr_sem);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
up_write(&REISERFS_I(inode)->xattr_sem);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
down_read(&REISERFS_I(inode)->xattr_sem);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
up_read(&REISERFS_I(inode)->xattr_sem);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline void reiserfs_mark_inode_private(struct inode *inode)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
inode->i_flags |= S_PRIVATE;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-09-29 16:59:58 +08:00
|
|
|
static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
|
|
|
|
{
|
|
|
|
init_rwsem(&REISERFS_I(inode)->xattr_sem);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
#define is_reiserfs_priv_object(inode) 0
|
2006-03-25 19:07:15 +08:00
|
|
|
#define reiserfs_mark_inode_private(inode) do {;} while(0)
|
2005-04-17 06:20:36 +08:00
|
|
|
#define reiserfs_getxattr NULL
|
|
|
|
#define reiserfs_setxattr NULL
|
|
|
|
#define reiserfs_listxattr NULL
|
|
|
|
#define reiserfs_removexattr NULL
|
2006-03-25 19:07:15 +08:00
|
|
|
#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
|
|
|
|
#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
|
2005-04-17 06:20:36 +08:00
|
|
|
#define reiserfs_read_lock_xattrs(sb)
|
|
|
|
#define reiserfs_read_unlock_xattrs(sb)
|
|
|
|
|
|
|
|
#define reiserfs_permission NULL
|
|
|
|
|
|
|
|
#define reiserfs_xattr_register_handlers() 0
|
|
|
|
#define reiserfs_xattr_unregister_handlers()
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
static inline int reiserfs_delete_xattrs(struct inode *inode)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
static inline int reiserfs_chown_xattrs(struct inode *inode,
|
|
|
|
struct iattr *attrs)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
2006-09-29 16:59:58 +08:00
|
|
|
static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
|
|
|
|
{
|
|
|
|
}
|
2007-02-10 17:46:24 +08:00
|
|
|
#endif /* CONFIG_REISERFS_FS_XATTR */
|
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-10 17:46:24 +08:00
|
|
|
#endif /* _LINUX_REISERFS_XATTR_H */
|