You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs xattr updates from Al Viro:
"xattr stuff from Andreas
This completes the switch to xattr_handler ->get()/->set() from
->getxattr/->setxattr/->removexattr"
* 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vfs: Remove {get,set,remove}xattr inode operations
xattr: Stop calling {get,set,remove}xattr inode operations
vfs: Check for the IOP_XATTR flag in listxattr
xattr: Add __vfs_{get,set,remove}xattr helpers
libfs: Use IOP_XATTR flag for empty directory handling
vfs: Use IOP_XATTR flag for bad-inode handling
vfs: Add IOP_XATTR inode operations flag
vfs: Move xattr_resolve_name to the front of fs/xattr.c
ecryptfs: Switch to generic xattr handlers
sockfs: Get rid of getxattr iop
sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
kernfs: Switch to generic xattr handlers
hfs: Switch to generic xattr handlers
jffs2: Remove jffs2_{get,set,remove}xattr macros
xattr: Remove unnecessary NULL attribute name check
This commit is contained in:
@@ -61,10 +61,7 @@ prototypes:
|
||||
int (*get_acl)(struct inode *, int);
|
||||
int (*setattr) (struct dentry *, struct iattr *);
|
||||
int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
|
||||
int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
|
||||
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
|
||||
ssize_t (*listxattr) (struct dentry *, char *, size_t);
|
||||
int (*removexattr) (struct dentry *, const char *);
|
||||
int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
|
||||
void (*update_time)(struct inode *, struct timespec *, int);
|
||||
int (*atomic_open)(struct inode *, struct dentry *,
|
||||
@@ -91,15 +88,13 @@ setattr: yes
|
||||
permission: no (may not block if called in rcu-walk mode)
|
||||
get_acl: no
|
||||
getattr: no
|
||||
setxattr: yes
|
||||
getxattr: no
|
||||
listxattr: no
|
||||
removexattr: yes
|
||||
fiemap: no
|
||||
update_time: no
|
||||
atomic_open: yes
|
||||
tmpfile: no
|
||||
|
||||
|
||||
Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
|
||||
victim.
|
||||
cross-directory ->rename() and rename2() has (per-superblock)
|
||||
@@ -108,6 +103,23 @@ victim.
|
||||
See Documentation/filesystems/directory-locking for more detailed discussion
|
||||
of the locking scheme for directory operations.
|
||||
|
||||
----------------------- xattr_handler operations -----------------------
|
||||
prototypes:
|
||||
bool (*list)(struct dentry *dentry);
|
||||
int (*get)(const struct xattr_handler *handler, struct dentry *dentry,
|
||||
struct inode *inode, const char *name, void *buffer,
|
||||
size_t size);
|
||||
int (*set)(const struct xattr_handler *handler, struct dentry *dentry,
|
||||
struct inode *inode, const char *name, const void *buffer,
|
||||
size_t size, int flags);
|
||||
|
||||
locking rules:
|
||||
all may block
|
||||
i_mutex(inode)
|
||||
list: no
|
||||
get: no
|
||||
set: yes
|
||||
|
||||
--------------------------- super_operations ---------------------------
|
||||
prototypes:
|
||||
struct inode *(*alloc_inode)(struct super_block *sb);
|
||||
|
||||
@@ -323,6 +323,35 @@ Whoever sets up the inode is responsible for filling in the "i_op" field. This
|
||||
is a pointer to a "struct inode_operations" which describes the methods that
|
||||
can be performed on individual inodes.
|
||||
|
||||
struct xattr_handlers
|
||||
---------------------
|
||||
|
||||
On filesystems that support extended attributes (xattrs), the s_xattr
|
||||
superblock field points to a NULL-terminated array of xattr handlers. Extended
|
||||
attributes are name:value pairs.
|
||||
|
||||
name: Indicates that the handler matches attributes with the specified name
|
||||
(such as "system.posix_acl_access"); the prefix field must be NULL.
|
||||
|
||||
prefix: Indicates that the handler matches all attributes with the specified
|
||||
name prefix (such as "user."); the name field must be NULL.
|
||||
|
||||
list: Determine if attributes matching this xattr handler should be listed
|
||||
for a particular dentry. Used by some listxattr implementations like
|
||||
generic_listxattr.
|
||||
|
||||
get: Called by the VFS to get the value of a particular extended attribute.
|
||||
This method is called by the getxattr(2) system call.
|
||||
|
||||
set: Called by the VFS to set the value of a particular extended attribute.
|
||||
When the new value is NULL, called to remove a particular extended
|
||||
attribute. This method is called by the the setxattr(2) and
|
||||
removexattr(2) system calls.
|
||||
|
||||
When none of the xattr handlers of a filesystem match the specified attribute
|
||||
name or when a filesystem doesn't support extended attributes, the various
|
||||
*xattr(2) system calls return -EOPNOTSUPP.
|
||||
|
||||
|
||||
The Inode Object
|
||||
================
|
||||
@@ -356,10 +385,7 @@ struct inode_operations {
|
||||
int (*get_acl)(struct inode *, int);
|
||||
int (*setattr) (struct dentry *, struct iattr *);
|
||||
int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
|
||||
int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
|
||||
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
|
||||
ssize_t (*listxattr) (struct dentry *, char *, size_t);
|
||||
int (*removexattr) (struct dentry *, const char *);
|
||||
void (*update_time)(struct inode *, struct timespec *, int);
|
||||
int (*atomic_open)(struct inode *, struct dentry *, struct file *,
|
||||
unsigned open_flag, umode_t create_mode, int *opened);
|
||||
@@ -463,19 +489,8 @@ otherwise noted.
|
||||
getattr: called by the VFS to get attributes of a file. This method
|
||||
is called by stat(2) and related system calls.
|
||||
|
||||
setxattr: called by the VFS to set an extended attribute for a file.
|
||||
Extended attribute is a name:value pair associated with an
|
||||
inode. This method is called by setxattr(2) system call.
|
||||
|
||||
getxattr: called by the VFS to retrieve the value of an extended
|
||||
attribute name. This method is called by getxattr(2) function
|
||||
call.
|
||||
|
||||
listxattr: called by the VFS to list all extended attributes for a
|
||||
given file. This method is called by listxattr(2) system call.
|
||||
|
||||
removexattr: called by the VFS to remove an extended attribute from
|
||||
a file. This method is called by removexattr(2) system call.
|
||||
given file. This method is called by the listxattr(2) system call.
|
||||
|
||||
update_time: called by the VFS to update a specific time or the i_version of
|
||||
an inode. If this is not defined the VFS will update the inode itself
|
||||
|
||||
@@ -3268,10 +3268,7 @@ const struct inode_operations ll_file_inode_operations = {
|
||||
.setattr = ll_setattr,
|
||||
.getattr = ll_getattr,
|
||||
.permission = ll_inode_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ll_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.fiemap = ll_fiemap,
|
||||
.get_acl = ll_get_acl,
|
||||
};
|
||||
|
||||
@@ -1152,10 +1152,7 @@ const struct inode_operations ll_dir_inode_operations = {
|
||||
.setattr = ll_setattr,
|
||||
.getattr = ll_getattr,
|
||||
.permission = ll_inode_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ll_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.get_acl = ll_get_acl,
|
||||
};
|
||||
|
||||
@@ -1163,9 +1160,6 @@ const struct inode_operations ll_special_inode_operations = {
|
||||
.setattr = ll_setattr,
|
||||
.getattr = ll_getattr,
|
||||
.permission = ll_inode_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ll_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.get_acl = ll_get_acl,
|
||||
};
|
||||
|
||||
@@ -154,8 +154,5 @@ const struct inode_operations ll_fast_symlink_inode_operations = {
|
||||
.get_link = ll_get_link,
|
||||
.getattr = ll_getattr,
|
||||
.permission = ll_inode_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ll_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
};
|
||||
|
||||
@@ -967,9 +967,6 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = {
|
||||
.rename = v9fs_vfs_rename,
|
||||
.getattr = v9fs_vfs_getattr_dotl,
|
||||
.setattr = v9fs_vfs_setattr_dotl,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.listxattr = v9fs_listxattr,
|
||||
.get_acl = v9fs_iop_get_acl,
|
||||
};
|
||||
@@ -977,9 +974,6 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = {
|
||||
const struct inode_operations v9fs_file_inode_operations_dotl = {
|
||||
.getattr = v9fs_vfs_getattr_dotl,
|
||||
.setattr = v9fs_vfs_setattr_dotl,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.listxattr = v9fs_listxattr,
|
||||
.get_acl = v9fs_iop_get_acl,
|
||||
};
|
||||
@@ -989,8 +983,5 @@ const struct inode_operations v9fs_symlink_inode_operations_dotl = {
|
||||
.get_link = v9fs_vfs_get_link_dotl,
|
||||
.getattr = v9fs_vfs_getattr_dotl,
|
||||
.setattr = v9fs_vfs_setattr_dotl,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.listxattr = v9fs_listxattr,
|
||||
};
|
||||
|
||||
+1
-20
@@ -100,29 +100,12 @@ static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_setxattr(struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *value, size_t size, int flags)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static ssize_t bad_inode_getxattr(struct dentry *dentry, struct inode *inode,
|
||||
const char *name, void *buffer, size_t size)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static ssize_t bad_inode_listxattr(struct dentry *dentry, char *buffer,
|
||||
size_t buffer_size)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_removexattr(struct dentry *dentry, const char *name)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static const struct inode_operations bad_inode_ops =
|
||||
{
|
||||
.create = bad_inode_create,
|
||||
@@ -142,10 +125,7 @@ static const struct inode_operations bad_inode_ops =
|
||||
.permission = bad_inode_permission,
|
||||
.getattr = bad_inode_getattr,
|
||||
.setattr = bad_inode_setattr,
|
||||
.setxattr = bad_inode_setxattr,
|
||||
.getxattr = bad_inode_getxattr,
|
||||
.listxattr = bad_inode_listxattr,
|
||||
.removexattr = bad_inode_removexattr,
|
||||
};
|
||||
|
||||
|
||||
@@ -175,6 +155,7 @@ void make_bad_inode(struct inode *inode)
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime =
|
||||
current_fs_time(inode->i_sb);
|
||||
inode->i_op = &bad_inode_ops;
|
||||
inode->i_opflags &= ~IOP_XATTR;
|
||||
inode->i_fop = &bad_file_ops;
|
||||
}
|
||||
EXPORT_SYMBOL(make_bad_inode);
|
||||
|
||||
@@ -10556,10 +10556,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
|
||||
.symlink = btrfs_symlink,
|
||||
.setattr = btrfs_setattr,
|
||||
.mknod = btrfs_mknod,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = btrfs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.permission = btrfs_permission,
|
||||
.get_acl = btrfs_get_acl,
|
||||
.set_acl = btrfs_set_acl,
|
||||
@@ -10633,10 +10630,7 @@ static const struct address_space_operations btrfs_symlink_aops = {
|
||||
static const struct inode_operations btrfs_file_inode_operations = {
|
||||
.getattr = btrfs_getattr,
|
||||
.setattr = btrfs_setattr,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = btrfs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.permission = btrfs_permission,
|
||||
.fiemap = btrfs_fiemap,
|
||||
.get_acl = btrfs_get_acl,
|
||||
@@ -10647,10 +10641,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
|
||||
.getattr = btrfs_getattr,
|
||||
.setattr = btrfs_setattr,
|
||||
.permission = btrfs_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = btrfs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.get_acl = btrfs_get_acl,
|
||||
.set_acl = btrfs_set_acl,
|
||||
.update_time = btrfs_update_time,
|
||||
@@ -10661,10 +10652,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
|
||||
.getattr = btrfs_getattr,
|
||||
.setattr = btrfs_setattr,
|
||||
.permission = btrfs_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = btrfs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.update_time = btrfs_update_time,
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/mount.h>
|
||||
#include <linux/statfs.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/xattr.h>
|
||||
#include "internal.h"
|
||||
|
||||
static int cachefiles_daemon_add_cache(struct cachefiles_cache *caches);
|
||||
@@ -126,8 +127,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
|
||||
if (d_is_negative(root) ||
|
||||
!d_backing_inode(root)->i_op->lookup ||
|
||||
!d_backing_inode(root)->i_op->mkdir ||
|
||||
!d_backing_inode(root)->i_op->setxattr ||
|
||||
!d_backing_inode(root)->i_op->getxattr ||
|
||||
!(d_backing_inode(root)->i_opflags & IOP_XATTR) ||
|
||||
!root->d_sb->s_op->statfs ||
|
||||
!root->d_sb->s_op->sync_fs)
|
||||
goto error_unsupported;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <linux/namei.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/xattr.h>
|
||||
#include "internal.h"
|
||||
|
||||
#define CACHEFILES_KEYBUF_SIZE 512
|
||||
@@ -799,8 +800,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
|
||||
}
|
||||
|
||||
ret = -EPERM;
|
||||
if (!d_backing_inode(subdir)->i_op->setxattr ||
|
||||
!d_backing_inode(subdir)->i_op->getxattr ||
|
||||
if (!(d_backing_inode(subdir)->i_opflags & IOP_XATTR) ||
|
||||
!d_backing_inode(subdir)->i_op->lookup ||
|
||||
!d_backing_inode(subdir)->i_op->mkdir ||
|
||||
!d_backing_inode(subdir)->i_op->create ||
|
||||
|
||||
@@ -1486,10 +1486,7 @@ const struct inode_operations ceph_dir_iops = {
|
||||
.permission = ceph_permission,
|
||||
.getattr = ceph_getattr,
|
||||
.setattr = ceph_setattr,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ceph_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.get_acl = ceph_get_acl,
|
||||
.set_acl = ceph_set_acl,
|
||||
.mknod = ceph_mknod,
|
||||
|
||||
@@ -94,10 +94,7 @@ const struct inode_operations ceph_file_iops = {
|
||||
.permission = ceph_permission,
|
||||
.setattr = ceph_setattr,
|
||||
.getattr = ceph_getattr,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ceph_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
.get_acl = ceph_get_acl,
|
||||
.set_acl = ceph_set_acl,
|
||||
};
|
||||
@@ -1885,10 +1882,7 @@ static const struct inode_operations ceph_symlink_iops = {
|
||||
.get_link = simple_get_link,
|
||||
.setattr = ceph_setattr,
|
||||
.getattr = ceph_getattr,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ceph_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
};
|
||||
|
||||
int __ceph_setattr(struct inode *inode, struct iattr *attr)
|
||||
|
||||
@@ -901,30 +901,21 @@ const struct inode_operations cifs_dir_inode_ops = {
|
||||
.setattr = cifs_setattr,
|
||||
.symlink = cifs_symlink,
|
||||
.mknod = cifs_mknod,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = cifs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
};
|
||||
|
||||
const struct inode_operations cifs_file_inode_ops = {
|
||||
.setattr = cifs_setattr,
|
||||
.getattr = cifs_getattr,
|
||||
.permission = cifs_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = cifs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
};
|
||||
|
||||
const struct inode_operations cifs_symlink_inode_ops = {
|
||||
.readlink = generic_readlink,
|
||||
.get_link = cifs_get_link,
|
||||
.permission = cifs_permission,
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = cifs_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
};
|
||||
|
||||
static int cifs_clone_file_range(struct file *src_file, loff_t off,
|
||||
|
||||
@@ -715,4 +715,6 @@ int ecryptfs_set_f_namelen(long *namelen, long lower_namelen,
|
||||
int ecryptfs_derive_iv(char *iv, struct ecryptfs_crypt_stat *crypt_stat,
|
||||
loff_t offset);
|
||||
|
||||
extern const struct xattr_handler *ecryptfs_xattr_handlers[];
|
||||
|
||||
#endif /* #ifndef ECRYPTFS_KERNEL_H */
|
||||
|
||||
+45
-22
@@ -1005,15 +1005,14 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *value,
|
||||
size_t size, int flags)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc;
|
||||
struct dentry *lower_dentry;
|
||||
|
||||
lower_dentry = ecryptfs_dentry_to_lower(dentry);
|
||||
if (!d_inode(lower_dentry)->i_op->setxattr) {
|
||||
if (!(d_inode(lower_dentry)->i_opflags & IOP_XATTR)) {
|
||||
rc = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = vfs_setxattr(lower_dentry, name, value, size, flags);
|
||||
if (!rc && inode)
|
||||
fsstack_copy_attr_all(inode, d_inode(lower_dentry));
|
||||
@@ -1025,15 +1024,14 @@ ssize_t
|
||||
ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode,
|
||||
const char *name, void *value, size_t size)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc;
|
||||
|
||||
if (!lower_inode->i_op->getxattr) {
|
||||
if (!(lower_inode->i_opflags & IOP_XATTR)) {
|
||||
rc = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
inode_lock(lower_inode);
|
||||
rc = lower_inode->i_op->getxattr(lower_dentry, lower_inode,
|
||||
name, value, size);
|
||||
rc = __vfs_getxattr(lower_dentry, lower_inode, name, value, size);
|
||||
inode_unlock(lower_inode);
|
||||
out:
|
||||
return rc;
|
||||
@@ -1066,19 +1064,22 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ecryptfs_removexattr(struct dentry *dentry, const char *name)
|
||||
static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode,
|
||||
const char *name)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc;
|
||||
struct dentry *lower_dentry;
|
||||
struct inode *lower_inode;
|
||||
|
||||
lower_dentry = ecryptfs_dentry_to_lower(dentry);
|
||||
if (!d_inode(lower_dentry)->i_op->removexattr) {
|
||||
lower_inode = ecryptfs_inode_to_lower(inode);
|
||||
if (!(lower_inode->i_opflags & IOP_XATTR)) {
|
||||
rc = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
inode_lock(d_inode(lower_dentry));
|
||||
rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name);
|
||||
inode_unlock(d_inode(lower_dentry));
|
||||
inode_lock(lower_inode);
|
||||
rc = __vfs_removexattr(lower_dentry, name);
|
||||
inode_unlock(lower_inode);
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
@@ -1089,10 +1090,7 @@ const struct inode_operations ecryptfs_symlink_iops = {
|
||||
.permission = ecryptfs_permission,
|
||||
.setattr = ecryptfs_setattr,
|
||||
.getattr = ecryptfs_getattr_link,
|
||||
.setxattr = ecryptfs_setxattr,
|
||||
.getxattr = ecryptfs_getxattr,
|
||||
.listxattr = ecryptfs_listxattr,
|
||||
.removexattr = ecryptfs_removexattr
|
||||
};
|
||||
|
||||
const struct inode_operations ecryptfs_dir_iops = {
|
||||
@@ -1107,18 +1105,43 @@ const struct inode_operations ecryptfs_dir_iops = {
|
||||
.rename = ecryptfs_rename,
|
||||
.permission = ecryptfs_permission,
|
||||
.setattr = ecryptfs_setattr,
|
||||
.setxattr = ecryptfs_setxattr,
|
||||
.getxattr = ecryptfs_getxattr,
|
||||
.listxattr = ecryptfs_listxattr,
|
||||
.removexattr = ecryptfs_removexattr
|
||||
};
|
||||
|
||||
const struct inode_operations ecryptfs_main_iops = {
|
||||
.permission = ecryptfs_permission,
|
||||
.setattr = ecryptfs_setattr,
|
||||
.getattr = ecryptfs_getattr,
|
||||
.setxattr = ecryptfs_setxattr,
|
||||
.getxattr = ecryptfs_getxattr,
|
||||
.listxattr = ecryptfs_listxattr,
|
||||
.removexattr = ecryptfs_removexattr
|
||||
};
|
||||
|
||||
static int ecryptfs_xattr_get(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, void *buffer, size_t size)
|
||||
{
|
||||
return ecryptfs_getxattr(dentry, inode, name, buffer, size);
|
||||
}
|
||||
|
||||
static int ecryptfs_xattr_set(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *value, size_t size,
|
||||
int flags)
|
||||
{
|
||||
if (value)
|
||||
return ecryptfs_setxattr(dentry, inode, name, value, size, flags);
|
||||
else {
|
||||
BUG_ON(flags != XATTR_REPLACE);
|
||||
return ecryptfs_removexattr(dentry, inode, name);
|
||||
}
|
||||
}
|
||||
|
||||
const struct xattr_handler ecryptfs_xattr_handler = {
|
||||
.prefix = "", /* match anything */
|
||||
.get = ecryptfs_xattr_get,
|
||||
.set = ecryptfs_xattr_set,
|
||||
};
|
||||
|
||||
const struct xattr_handler *ecryptfs_xattr_handlers[] = {
|
||||
&ecryptfs_xattr_handler,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -529,6 +529,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
|
||||
/* ->kill_sb() will take care of sbi after that point */
|
||||
sbi = NULL;
|
||||
s->s_op = &ecryptfs_sops;
|
||||
s->s_xattr = ecryptfs_xattr_handlers;
|
||||
s->s_d_op = &ecryptfs_dops;
|
||||
|
||||
err = "Reading sb failed";
|
||||
|
||||
+6
-7
@@ -32,6 +32,7 @@
|
||||
#include <linux/file.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/xattr.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include "ecryptfs_kernel.h"
|
||||
|
||||
@@ -422,7 +423,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
|
||||
struct inode *lower_inode = d_inode(lower_dentry);
|
||||
int rc;
|
||||
|
||||
if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) {
|
||||
if (!(lower_inode->i_opflags & IOP_XATTR)) {
|
||||
printk(KERN_WARNING
|
||||
"No support for setting xattr in lower filesystem\n");
|
||||
rc = -ENOSYS;
|
||||
@@ -436,15 +437,13 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
|
||||
goto out;
|
||||
}
|
||||
inode_lock(lower_inode);
|
||||
size = lower_inode->i_op->getxattr(lower_dentry, lower_inode,
|
||||
ECRYPTFS_XATTR_NAME,
|
||||
xattr_virt, PAGE_SIZE);
|
||||
size = __vfs_getxattr(lower_dentry, lower_inode, ECRYPTFS_XATTR_NAME,
|
||||
xattr_virt, PAGE_SIZE);
|
||||
if (size < 0)
|
||||
size = 8;
|
||||
put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt);
|
||||
rc = lower_inode->i_op->setxattr(lower_dentry, lower_inode,
|
||||
ECRYPTFS_XATTR_NAME,
|
||||
xattr_virt, size, 0);
|
||||
rc = __vfs_setxattr(lower_dentry, lower_inode, ECRYPTFS_XATTR_NAME,
|
||||
xattr_virt, size, 0);
|
||||
inode_unlock(lower_inode);
|
||||
if (rc)
|
||||
printk(KERN_ERR "Error whilst attempting to write inode size "
|
||||
|
||||
@@ -241,10 +241,7 @@ const struct file_operations ext2_file_operations = {
|
||||
|
||||
const struct inode_operations ext2_file_inode_operations = {
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ext2_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.setattr = ext2_setattr,
|
||||
.get_acl = ext2_get_acl,
|
||||
|
||||
@@ -428,10 +428,7 @@ const struct inode_operations ext2_dir_inode_operations = {
|
||||
.mknod = ext2_mknod,
|
||||
.rename = ext2_rename,
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ext2_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.setattr = ext2_setattr,
|
||||
.get_acl = ext2_get_acl,
|
||||
@@ -441,10 +438,7 @@ const struct inode_operations ext2_dir_inode_operations = {
|
||||
|
||||
const struct inode_operations ext2_special_inode_operations = {
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ext2_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.setattr = ext2_setattr,
|
||||
.get_acl = ext2_get_acl,
|
||||
|
||||
@@ -25,10 +25,7 @@ const struct inode_operations ext2_symlink_inode_operations = {
|
||||
.get_link = page_get_link,
|
||||
.setattr = ext2_setattr,
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ext2_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -37,9 +34,6 @@ const struct inode_operations ext2_fast_symlink_inode_operations = {
|
||||
.get_link = simple_get_link,
|
||||
.setattr = ext2_setattr,
|
||||
#ifdef CONFIG_EXT2_FS_XATTR
|
||||
.setxattr = generic_setxattr,
|
||||
.getxattr = generic_getxattr,
|
||||
.listxattr = ext2_listxattr,
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user