blob: caad583086af0e326c3384117fe818d645f922dd [file] [log] [blame]
Al Virof466c6f2012-03-17 01:16:43 -04001#include "reiserfs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#include <linux/errno.h>
3#include <linux/fs.h>
4#include <linux/pagemap.h>
5#include <linux/xattr.h>
Al Viroc45ac882012-03-17 00:59:06 -04006#include "xattr.h"
Fabian Frederick170939912014-08-08 14:21:12 -07007#include <linux/uaccess.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
Linus Torvalds1da177e2005-04-16 15:20:36 -07009static int
Andreas Gruenbacherd9a82a02015-10-04 19:18:51 +020010user_get(const struct xattr_handler *handler, struct dentry *dentry,
11 const char *name, void *buffer, size_t size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070012{
Christoph Hellwig431547b2009-11-13 09:52:56 +000013 if (!reiserfs_xattrs_user(dentry->d_sb))
Linus Torvaldsbd4c6252005-07-12 20:21:28 -070014 return -EOPNOTSUPP;
Al Viro79a628d2016-04-10 18:50:48 -040015 return reiserfs_xattr_get(d_inode(dentry),
16 xattr_full_name(handler, name),
17 buffer, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070018}
19
20static int
Andreas Gruenbacherd9a82a02015-10-04 19:18:51 +020021user_set(const struct xattr_handler *handler, struct dentry *dentry,
22 const char *name, const void *buffer, size_t size, int flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023{
Christoph Hellwig431547b2009-11-13 09:52:56 +000024 if (!reiserfs_xattrs_user(dentry->d_sb))
Linus Torvaldsbd4c6252005-07-12 20:21:28 -070025 return -EOPNOTSUPP;
Al Viro79a628d2016-04-10 18:50:48 -040026 return reiserfs_xattr_set(d_inode(dentry),
27 xattr_full_name(handler, name),
28 buffer, size, flags);
Linus Torvaldsbd4c6252005-07-12 20:21:28 -070029}
30
Andreas Gruenbacher764a5c62015-12-02 14:44:43 +010031static bool user_list(struct dentry *dentry)
Linus Torvaldsbd4c6252005-07-12 20:21:28 -070032{
Andreas Gruenbacher764a5c62015-12-02 14:44:43 +010033 return reiserfs_xattrs_user(dentry->d_sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034}
35
Stephen Hemminger94d09a92010-05-13 17:53:19 -070036const struct xattr_handler reiserfs_xattr_user_handler = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 .prefix = XATTR_USER_PREFIX,
38 .get = user_get,
39 .set = user_set,
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 .list = user_list,
41};