xattr_user.c 1.0 KB

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