xattr_user.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 *dentry,
  10. const char *name, void *buffer, size_t size)
  11. {
  12. if (strlen(name) < sizeof(XATTR_USER_PREFIX))
  13. return -EINVAL;
  14. if (!reiserfs_xattrs_user(dentry->d_sb))
  15. return -EOPNOTSUPP;
  16. return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
  17. }
  18. static int
  19. user_set(const struct xattr_handler *handler, struct dentry *dentry,
  20. const char *name, const void *buffer, size_t size, int flags)
  21. {
  22. if (strlen(name) < sizeof(XATTR_USER_PREFIX))
  23. return -EINVAL;
  24. if (!reiserfs_xattrs_user(dentry->d_sb))
  25. return -EOPNOTSUPP;
  26. return reiserfs_xattr_set(d_inode(dentry), name, 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. };