aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/xattr.c')
-rw-r--r--fs/reiserfs/xattr.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 9623cfe2371c..c3b004ee627b 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -48,6 +48,7 @@
48#include <net/checksum.h> 48#include <net/checksum.h>
49#include <linux/stat.h> 49#include <linux/stat.h>
50#include <linux/quotaops.h> 50#include <linux/quotaops.h>
51#include <linux/security.h>
51 52
52#define PRIVROOT_NAME ".reiserfs_priv" 53#define PRIVROOT_NAME ".reiserfs_priv"
53#define XAROOT_NAME "xattrs" 54#define XAROOT_NAME "xattrs"
@@ -740,15 +741,14 @@ ssize_t
740reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, 741reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
741 size_t size) 742 size_t size)
742{ 743{
743 struct inode *inode = dentry->d_inode;
744 struct xattr_handler *handler; 744 struct xattr_handler *handler;
745 745
746 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 746 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
747 747
748 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 748 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
749 return -EOPNOTSUPP; 749 return -EOPNOTSUPP;
750 750
751 return handler->get(inode, name, buffer, size); 751 return handler->get(dentry, name, buffer, size, handler->flags);
752} 752}
753 753
754/* 754/*
@@ -760,15 +760,14 @@ int
760reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, 760reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
761 size_t size, int flags) 761 size_t size, int flags)
762{ 762{
763 struct inode *inode = dentry->d_inode;
764 struct xattr_handler *handler; 763 struct xattr_handler *handler;
765 764
766 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 765 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
767 766
768 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 767 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
769 return -EOPNOTSUPP; 768 return -EOPNOTSUPP;
770 769
771 return handler->set(inode, name, value, size, flags); 770 return handler->set(dentry, name, value, size, flags, handler->flags);
772} 771}
773 772
774/* 773/*
@@ -778,21 +777,20 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
778 */ 777 */
779int reiserfs_removexattr(struct dentry *dentry, const char *name) 778int reiserfs_removexattr(struct dentry *dentry, const char *name)
780{ 779{
781 struct inode *inode = dentry->d_inode;
782 struct xattr_handler *handler; 780 struct xattr_handler *handler;
783 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 781 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
784 782
785 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 783 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
786 return -EOPNOTSUPP; 784 return -EOPNOTSUPP;
787 785
788 return handler->set(inode, name, NULL, 0, XATTR_REPLACE); 786 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags);
789} 787}
790 788
791struct listxattr_buf { 789struct listxattr_buf {
792 size_t size; 790 size_t size;
793 size_t pos; 791 size_t pos;
794 char *buf; 792 char *buf;
795 struct inode *inode; 793 struct dentry *dentry;
796}; 794};
797 795
798static int listxattr_filler(void *buf, const char *name, int namelen, 796static int listxattr_filler(void *buf, const char *name, int namelen,
@@ -803,17 +801,19 @@ static int listxattr_filler(void *buf, const char *name, int namelen,
803 if (name[0] != '.' || 801 if (name[0] != '.' ||
804 (namelen != 1 && (name[1] != '.' || namelen != 2))) { 802 (namelen != 1 && (name[1] != '.' || namelen != 2))) {
805 struct xattr_handler *handler; 803 struct xattr_handler *handler;
806 handler = find_xattr_handler_prefix(b->inode->i_sb->s_xattr, 804 handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr,
807 name); 805 name);
808 if (!handler) /* Unsupported xattr name */ 806 if (!handler) /* Unsupported xattr name */
809 return 0; 807 return 0;
810 if (b->buf) { 808 if (b->buf) {
811 size = handler->list(b->inode, b->buf + b->pos, 809 size = handler->list(b->dentry, b->buf + b->pos,
812 b->size, name, namelen); 810 b->size, name, namelen,
811 handler->flags);
813 if (size > b->size) 812 if (size > b->size)
814 return -ERANGE; 813 return -ERANGE;
815 } else { 814 } else {
816 size = handler->list(b->inode, NULL, 0, name, namelen); 815 size = handler->list(b->dentry, NULL, 0, name,
816 namelen, handler->flags);
817 } 817 }
818 818
819 b->pos += size; 819 b->pos += size;
@@ -834,7 +834,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
834 int err = 0; 834 int err = 0;
835 loff_t pos = 0; 835 loff_t pos = 0;
836 struct listxattr_buf buf = { 836 struct listxattr_buf buf = {
837 .inode = dentry->d_inode, 837 .dentry = dentry,
838 .buf = buffer, 838 .buf = buffer,
839 .size = buffer ? size : 0, 839 .size = buffer ? size : 0,
840 }; 840 };