2012-03-17 12:16:43 +07:00
|
|
|
#include "reiserfs.h"
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <linux/xattr.h>
|
2012-03-17 11:59:06 +07:00
|
|
|
#include "xattr.h"
|
2014-08-09 04:21:12 +07:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
static int
|
2015-10-05 00:18:51 +07:00
|
|
|
user_get(const struct xattr_handler *handler, struct dentry *dentry,
|
|
|
|
const char *name, void *buffer, size_t size)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
|
2005-07-13 10:21:28 +07:00
|
|
|
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
|
|
|
|
return -EINVAL;
|
2009-11-13 16:52:56 +07:00
|
|
|
if (!reiserfs_xattrs_user(dentry->d_sb))
|
2005-07-13 10:21:28 +07:00
|
|
|
return -EOPNOTSUPP;
|
2015-03-18 05:25:59 +07:00
|
|
|
return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2015-10-05 00:18:51 +07:00
|
|
|
user_set(const struct xattr_handler *handler, struct dentry *dentry,
|
|
|
|
const char *name, const void *buffer, size_t size, int flags)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-07-13 10:21:28 +07:00
|
|
|
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
|
|
|
|
return -EINVAL;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2009-11-13 16:52:56 +07:00
|
|
|
if (!reiserfs_xattrs_user(dentry->d_sb))
|
2005-07-13 10:21:28 +07:00
|
|
|
return -EOPNOTSUPP;
|
2015-03-18 05:25:59 +07:00
|
|
|
return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2015-12-02 20:44:43 +07:00
|
|
|
static bool user_list(struct dentry *dentry)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2015-12-02 20:44:43 +07:00
|
|
|
return reiserfs_xattrs_user(dentry->d_sb);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2010-05-14 07:53:19 +07:00
|
|
|
const struct xattr_handler reiserfs_xattr_user_handler = {
|
2005-04-17 05:20:36 +07:00
|
|
|
.prefix = XATTR_USER_PREFIX,
|
|
|
|
.get = user_get,
|
|
|
|
.set = user_set,
|
|
|
|
.list = user_list,
|
|
|
|
};
|