xattr_user.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include "reiserfs.h"
  3. #include <linux/errno.h>
  4. #include <linux/fs.h>
  5. #include <linux/pagemap.h>
  6. #include <linux/xattr.h>
  7. #include "xattr.h"
  8. #include <linux/uaccess.h>
  9. static int
  10. user_get(const struct xattr_handler *handler, struct dentry *unused,
  11. struct inode *inode, const char *name, void *buffer, size_t size)
  12. {
  13. if (!reiserfs_xattrs_user(inode->i_sb))
  14. return -EOPNOTSUPP;
  15. return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
  16. buffer, size);
  17. }
  18. static int
  19. user_set(const struct xattr_handler *handler, struct dentry *unused,
  20. struct inode *inode, const char *name, const void *buffer,
  21. size_t size, int flags)
  22. {
  23. if (!reiserfs_xattrs_user(inode->i_sb))
  24. return -EOPNOTSUPP;
  25. return reiserfs_xattr_set(inode,
  26. xattr_full_name(handler, name),
  27. buffer, size, flags);
  28. }
  29. static bool user_list(struct dentry *dentry)
  30. {
  31. return reiserfs_xattrs_user(dentry->d_sb);
  32. }
  33. const struct xattr_handler reiserfs_xattr_user_handler = {
  34. .prefix = XATTR_USER_PREFIX,
  35. .get = user_get,
  36. .set = user_set,
  37. .list = user_list,
  38. };