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 58aa8e75f7f5..8c7033a8b67e 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"
@@ -726,15 +727,14 @@ ssize_t
726reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, 727reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
727 size_t size) 728 size_t size)
728{ 729{
729 struct inode *inode = dentry->d_inode;
730 struct xattr_handler *handler; 730 struct xattr_handler *handler;
731 731
732 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 732 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
733 733
734 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 734 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
735 return -EOPNOTSUPP; 735 return -EOPNOTSUPP;
736 736
737 return handler->get(inode, name, buffer, size); 737 return handler->get(dentry, name, buffer, size, handler->flags);
738} 738}
739 739
740/* 740/*
@@ -746,15 +746,14 @@ int
746reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, 746reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
747 size_t size, int flags) 747 size_t size, int flags)
748{ 748{
749 struct inode *inode = dentry->d_inode;
750 struct xattr_handler *handler; 749 struct xattr_handler *handler;
751 750
752 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 751 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
753 752
754 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 753 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
755 return -EOPNOTSUPP; 754 return -EOPNOTSUPP;
756 755
757 return handler->set(inode, name, value, size, flags); 756 return handler->set(dentry, name, value, size, flags, handler->flags);
758} 757}
759 758
760/* 759/*
@@ -764,21 +763,20 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
764 */ 763 */
765int reiserfs_removexattr(struct dentry *dentry, const char *name) 764int reiserfs_removexattr(struct dentry *dentry, const char *name)
766{ 765{
767 struct inode *inode = dentry->d_inode;
768 struct xattr_handler *handler; 766 struct xattr_handler *handler;
769 handler = find_xattr_handler_prefix(inode->i_sb->s_xattr, name); 767 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
770 768
771 if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1) 769 if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
772 return -EOPNOTSUPP; 770 return -EOPNOTSUPP;
773 771
774 return handler->set(inode, name, NULL, 0, XATTR_REPLACE); 772 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags);
775} 773}
776 774
777struct listxattr_buf { 775struct listxattr_buf {
778 size_t size; 776 size_t size;
779 size_t pos; 777 size_t pos;
780 char *buf; 778 char *buf;
781 struct inode *inode; 779 struct dentry *dentry;
782}; 780};
783 781
784static int listxattr_filler(void *buf, const char *name, int namelen, 782static int listxattr_filler(void *buf, const char *name, int namelen,
@@ -789,17 +787,19 @@ static int listxattr_filler(void *buf, const char *name, int namelen,
789 if (name[0] != '.' || 787 if (name[0] != '.' ||
790 (namelen != 1 && (name[1] != '.' || namelen != 2))) { 788 (namelen != 1 && (name[1] != '.' || namelen != 2))) {
791 struct xattr_handler *handler; 789 struct xattr_handler *handler;
792 handler = find_xattr_handler_prefix(b->inode->i_sb->s_xattr, 790 handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr,
793 name); 791 name);
794 if (!handler) /* Unsupported xattr name */ 792 if (!handler) /* Unsupported xattr name */
795 return 0; 793 return 0;
796 if (b->buf) { 794 if (b->buf) {
797 size = handler->list(b->inode, b->buf + b->pos, 795 size = handler->list(b->dentry, b->buf + b->pos,
798 b->size, name, namelen); 796 b->size, name, namelen,
797 handler->flags);
799 if (size > b->size) 798 if (size > b->size)
800 return -ERANGE; 799 return -ERANGE;
801 } else { 800 } else {
802 size = handler->list(b->inode, NULL, 0, name, namelen); 801 size = handler->list(b->dentry, NULL, 0, name,
802 namelen, handler->flags);
803 } 803 }
804 804
805 b->pos += size; 805 b->pos += size;
@@ -820,7 +820,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
820 int err = 0; 820 int err = 0;
821 loff_t pos = 0; 821 loff_t pos = 0;
822 struct listxattr_buf buf = { 822 struct listxattr_buf buf = {
823 .inode = dentry->d_inode, 823 .dentry = dentry,
824 .buf = buffer, 824 .buf = buffer,
825 .size = buffer ? size : 0, 825 .size = buffer ? size : 0,
826 }; 826 };