2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/reiserfs_fs.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <linux/xattr.h>
|
|
|
|
#include <linux/reiserfs_xattr.h>
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
|
|
|
|
static int
|
2005-07-13 11:21:28 +08:00
|
|
|
user_get(struct inode *inode, const char *name, void *buffer, size_t size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
|
|
|
|
return -EINVAL;
|
|
|
|
if (!reiserfs_xattrs_user(inode->i_sb))
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
return reiserfs_xattr_get(inode, name, buffer, size);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-07-13 11:21:28 +08:00
|
|
|
user_set(struct inode *inode, const char *name, const void *buffer,
|
|
|
|
size_t size, int flags)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-07-13 11:21:28 +08:00
|
|
|
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
if (!reiserfs_xattrs_user(inode->i_sb))
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
return reiserfs_xattr_set(inode, name, buffer, size, flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-03-31 02:02:38 +08:00
|
|
|
static size_t user_list(struct inode *inode, char *list, size_t list_size,
|
|
|
|
const char *name, size_t name_len)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2009-03-31 02:02:38 +08:00
|
|
|
const size_t len = name_len + 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-13 11:21:28 +08:00
|
|
|
if (!reiserfs_xattrs_user(inode->i_sb))
|
|
|
|
return 0;
|
2009-03-31 02:02:38 +08:00
|
|
|
if (list && len <= list_size) {
|
|
|
|
memcpy(list, name, name_len);
|
|
|
|
list[name_len] = '\0';
|
|
|
|
}
|
2005-07-13 11:21:28 +08:00
|
|
|
return len;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2009-03-31 02:02:38 +08:00
|
|
|
struct xattr_handler reiserfs_xattr_user_handler = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.prefix = XATTR_USER_PREFIX,
|
|
|
|
.get = user_get,
|
|
|
|
.set = user_set,
|
|
|
|
.list = user_list,
|
|
|
|
};
|