mirror of
https://github.com/adulau/aha.git
synced 2024-12-05 00:17:23 +00:00
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (38 commits) direct I/O fallback sync simplification ocfs: stop using do_sync_mapping_range cleanup blockdev_direct_IO locking make generic_acl slightly more generic sanitize xattr handler prototypes libfs: move EXPORT_SYMBOL for d_alloc_name vfs: force reval of target when following LAST_BIND symlinks (try #7) ima: limit imbalance msg Untangling ima mess, part 3: kill dead code in ima Untangling ima mess, part 2: deal with counters Untangling ima mess, part 1: alloc_file() O_TRUNC open shouldn't fail after file truncation ima: call ima_inode_free ima_inode_free IMA: clean up the IMA counts updating code ima: only insert at inode creation time ima: valid return code from ima_inode_alloc fs: move get_empty_filp() deffinition to internal.h Sanitize exec_permission_lite() Kill cached_lookup() and real_lookup() Kill path_lookup_open() ... Trivial conflicts in fs/direct-io.c
This commit is contained in:
commit
bac5e54c29
81 changed files with 1173 additions and 1832 deletions
|
@ -2200,7 +2200,7 @@ pfm_alloc_file(pfm_context_t *ctx)
|
|||
{
|
||||
struct file *file;
|
||||
struct inode *inode;
|
||||
struct dentry *dentry;
|
||||
struct path path;
|
||||
char name[32];
|
||||
struct qstr this;
|
||||
|
||||
|
@ -2225,18 +2225,19 @@ pfm_alloc_file(pfm_context_t *ctx)
|
|||
/*
|
||||
* allocate a new dcache entry
|
||||
*/
|
||||
dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
|
||||
if (!dentry) {
|
||||
path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
|
||||
if (!path.dentry) {
|
||||
iput(inode);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
path.mnt = mntget(pfmfs_mnt);
|
||||
|
||||
dentry->d_op = &pfmfs_dentry_operations;
|
||||
d_add(dentry, inode);
|
||||
path.dentry->d_op = &pfmfs_dentry_operations;
|
||||
d_add(path.dentry, inode);
|
||||
|
||||
file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops);
|
||||
file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
|
||||
if (!file) {
|
||||
dput(dentry);
|
||||
path_put(&path);
|
||||
return ERR_PTR(-ENFILE);
|
||||
}
|
||||
|
||||
|
|
|
@ -445,12 +445,7 @@ done:
|
|||
|
||||
int hpux_pipe(int *kstack_fildes)
|
||||
{
|
||||
int error;
|
||||
|
||||
lock_kernel();
|
||||
error = do_pipe_flags(kstack_fildes, 0);
|
||||
unlock_kernel();
|
||||
return error;
|
||||
return do_pipe_flags(kstack_fildes, 0);
|
||||
}
|
||||
|
||||
/* lies - says it works, but it really didn't lock anything */
|
||||
|
|
|
@ -30,7 +30,6 @@ struct mmap_arg_struct;
|
|||
asmlinkage long sys32_mmap(struct mmap_arg_struct __user *);
|
||||
asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long);
|
||||
|
||||
asmlinkage long sys32_pipe(int __user *);
|
||||
struct sigaction32;
|
||||
struct old_sigaction32;
|
||||
asmlinkage long sys32_rt_sigaction(int, struct sigaction32 __user *,
|
||||
|
|
|
@ -12,7 +12,6 @@ struct pt_regs;
|
|||
struct sigaction;
|
||||
asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
|
||||
asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
|
||||
asmlinkage long xtensa_pipe(int __user *);
|
||||
asmlinkage long xtensa_ptrace(long, long, long, long);
|
||||
asmlinkage long xtensa_sigreturn(struct pt_regs*);
|
||||
asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
|
||||
|
|
|
@ -94,7 +94,7 @@ __SYSCALL( 35, sys_readlink, 3)
|
|||
#define __NR_mknod 36
|
||||
__SYSCALL( 36, sys_mknod, 3)
|
||||
#define __NR_pipe 37
|
||||
__SYSCALL( 37, xtensa_pipe, 1)
|
||||
__SYSCALL( 37, sys_pipe, 1)
|
||||
#define __NR_unlink 38
|
||||
__SYSCALL( 38, sys_unlink, 1)
|
||||
#define __NR_rmdir 39
|
||||
|
|
|
@ -39,24 +39,6 @@ syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
|
|||
#include <asm/unistd.h>
|
||||
};
|
||||
|
||||
/*
|
||||
* xtensa_pipe() is the normal C calling standard for creating a pipe. It's not
|
||||
* the way unix traditional does this, though.
|
||||
*/
|
||||
|
||||
asmlinkage long xtensa_pipe(int __user *userfds)
|
||||
{
|
||||
int fd[2];
|
||||
int error;
|
||||
|
||||
error = do_pipe_flags(fd, 0);
|
||||
if (!error) {
|
||||
if (copy_to_user(userfds, fd, 2 * sizeof(int)))
|
||||
error = -EFAULT;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
|
||||
{
|
||||
unsigned long ret;
|
||||
|
|
|
@ -492,6 +492,7 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
|
|||
int is_async, int *fd)
|
||||
{
|
||||
struct ib_uverbs_event_file *ev_file;
|
||||
struct path path;
|
||||
struct file *filp;
|
||||
int ret;
|
||||
|
||||
|
@ -519,8 +520,10 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
|
|||
* system call on a uverbs file, which will already have a
|
||||
* module reference.
|
||||
*/
|
||||
filp = alloc_file(uverbs_event_mnt, dget(uverbs_event_mnt->mnt_root),
|
||||
FMODE_READ, fops_get(&uverbs_event_fops));
|
||||
path.mnt = uverbs_event_mnt;
|
||||
path.dentry = uverbs_event_mnt->mnt_root;
|
||||
path_get(&path);
|
||||
filp = alloc_file(&path, FMODE_READ, fops_get(&uverbs_event_fops));
|
||||
if (!filp) {
|
||||
ret = -ENFILE;
|
||||
goto err_fd;
|
||||
|
@ -531,6 +534,8 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
|
|||
return filp;
|
||||
|
||||
err_fd:
|
||||
fops_put(&uverbs_event_fops);
|
||||
path_put(&path);
|
||||
put_unused_fd(*fd);
|
||||
|
||||
err:
|
||||
|
|
|
@ -403,7 +403,7 @@ static void dst_node_cleanup(struct dst_node *n)
|
|||
|
||||
if (n->bdev) {
|
||||
sync_blockdev(n->bdev);
|
||||
blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
|
||||
close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
|
||||
}
|
||||
|
||||
dst_state_lock(st);
|
||||
|
@ -463,37 +463,6 @@ void dst_node_put(struct dst_node *n)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function finds devices major/minor numbers for given pathname.
|
||||
*/
|
||||
static int dst_lookup_device(const char *path, dev_t *dev)
|
||||
{
|
||||
int err;
|
||||
struct nameidata nd;
|
||||
struct inode *inode;
|
||||
|
||||
err = path_lookup(path, LOOKUP_FOLLOW, &nd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
inode = nd.path.dentry->d_inode;
|
||||
if (!inode) {
|
||||
err = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!S_ISBLK(inode->i_mode)) {
|
||||
err = -ENOTBLK;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*dev = inode->i_rdev;
|
||||
|
||||
out:
|
||||
path_put(&nd.path);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setting up export device: lookup by the name, get its size
|
||||
* and setup listening socket, which will accept clients, which
|
||||
|
@ -503,17 +472,12 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
|
|||
struct dst_export_ctl *le)
|
||||
{
|
||||
int err;
|
||||
dev_t dev = 0; /* gcc likes to scream here */
|
||||
|
||||
snprintf(n->info->local, sizeof(n->info->local), "%s", le->device);
|
||||
|
||||
err = dst_lookup_device(le->device, &dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
n->bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
|
||||
if (!n->bdev)
|
||||
return -ENODEV;
|
||||
n->bdev = open_bdev_exclusive(le->device, FMODE_READ|FMODE_WRITE, NULL);
|
||||
if (IS_ERR(n->bdev))
|
||||
return PTR_ERR(n->bdev);
|
||||
|
||||
if (n->size != 0)
|
||||
n->size = min_t(loff_t, n->bdev->bd_inode->i_size, n->size);
|
||||
|
@ -528,7 +492,7 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
|
|||
return 0;
|
||||
|
||||
err_out_cleanup:
|
||||
blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
|
||||
close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
|
||||
n->bdev = NULL;
|
||||
|
||||
return err;
|
||||
|
|
|
@ -88,7 +88,7 @@ struct file *anon_inode_getfile(const char *name,
|
|||
void *priv, int flags)
|
||||
{
|
||||
struct qstr this;
|
||||
struct dentry *dentry;
|
||||
struct path path;
|
||||
struct file *file;
|
||||
int error;
|
||||
|
||||
|
@ -106,10 +106,11 @@ struct file *anon_inode_getfile(const char *name,
|
|||
this.name = name;
|
||||
this.len = strlen(name);
|
||||
this.hash = 0;
|
||||
dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
|
||||
if (!dentry)
|
||||
path.dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
|
||||
if (!path.dentry)
|
||||
goto err_module;
|
||||
|
||||
path.mnt = mntget(anon_inode_mnt);
|
||||
/*
|
||||
* We know the anon_inode inode count is always greater than zero,
|
||||
* so we can avoid doing an igrab() and we can use an open-coded
|
||||
|
@ -117,14 +118,13 @@ struct file *anon_inode_getfile(const char *name,
|
|||
*/
|
||||
atomic_inc(&anon_inode_inode->i_count);
|
||||
|
||||
dentry->d_op = &anon_inodefs_dentry_operations;
|
||||
path.dentry->d_op = &anon_inodefs_dentry_operations;
|
||||
/* Do not publish this dentry inside the global dentry hash table */
|
||||
dentry->d_flags &= ~DCACHE_UNHASHED;
|
||||
d_instantiate(dentry, anon_inode_inode);
|
||||
path.dentry->d_flags &= ~DCACHE_UNHASHED;
|
||||
d_instantiate(path.dentry, anon_inode_inode);
|
||||
|
||||
error = -ENFILE;
|
||||
file = alloc_file(anon_inode_mnt, dentry,
|
||||
FMODE_READ | FMODE_WRITE, fops);
|
||||
file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops);
|
||||
if (!file)
|
||||
goto err_dput;
|
||||
file->f_mapping = anon_inode_inode->i_mapping;
|
||||
|
@ -137,7 +137,7 @@ struct file *anon_inode_getfile(const char *name,
|
|||
return file;
|
||||
|
||||
err_dput:
|
||||
dput(dentry);
|
||||
path_put(&path);
|
||||
err_module:
|
||||
module_put(fops->owner);
|
||||
return ERR_PTR(error);
|
||||
|
|
|
@ -73,13 +73,13 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
|
|||
return acl;
|
||||
}
|
||||
|
||||
static int btrfs_xattr_get_acl(struct inode *inode, int type,
|
||||
void *value, size_t size)
|
||||
static int btrfs_xattr_acl_get(struct dentry *dentry, const char *name,
|
||||
void *value, size_t size, int type)
|
||||
{
|
||||
struct posix_acl *acl;
|
||||
int ret = 0;
|
||||
|
||||
acl = btrfs_get_acl(inode, type);
|
||||
acl = btrfs_get_acl(dentry->d_inode, type);
|
||||
|
||||
if (IS_ERR(acl))
|
||||
return PTR_ERR(acl);
|
||||
|
@ -151,8 +151,8 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int btrfs_xattr_set_acl(struct inode *inode, int type,
|
||||
const void *value, size_t size)
|
||||
static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
int ret = 0;
|
||||
struct posix_acl *acl = NULL;
|
||||
|
@ -167,38 +167,13 @@ static int btrfs_xattr_set_acl(struct inode *inode, int type,
|
|||
}
|
||||
}
|
||||
|
||||
ret = btrfs_set_acl(inode, acl, type);
|
||||
ret = btrfs_set_acl(dentry->d_inode, acl, type);
|
||||
|
||||
posix_acl_release(acl);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int btrfs_xattr_acl_access_get(struct inode *inode, const char *name,
|
||||
void *value, size_t size)
|
||||
{
|
||||
return btrfs_xattr_get_acl(inode, ACL_TYPE_ACCESS, value, size);
|
||||
}
|
||||
|
||||
static int btrfs_xattr_acl_access_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
return btrfs_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
|
||||
}
|
||||
|
||||
static int btrfs_xattr_acl_default_get(struct inode *inode, const char *name,
|
||||
void *value, size_t size)
|
||||
{
|
||||
return btrfs_xattr_get_acl(inode, ACL_TYPE_DEFAULT, value, size);
|
||||
}
|
||||
|
||||
static int btrfs_xattr_acl_default_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
return btrfs_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
|
||||
}
|
||||
|
||||
int btrfs_check_acl(struct inode *inode, int mask)
|
||||
{
|
||||
struct posix_acl *acl;
|
||||
|
@ -303,14 +278,16 @@ int btrfs_acl_chmod(struct inode *inode)
|
|||
|
||||
struct xattr_handler btrfs_xattr_acl_default_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_DEFAULT,
|
||||
.get = btrfs_xattr_acl_default_get,
|
||||
.set = btrfs_xattr_acl_default_set,
|
||||
.flags = ACL_TYPE_DEFAULT,
|
||||
.get = btrfs_xattr_acl_get,
|
||||
.set = btrfs_xattr_acl_set,
|
||||
};
|
||||
|
||||
struct xattr_handler btrfs_xattr_acl_access_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_ACCESS,
|
||||
.get = btrfs_xattr_acl_access_get,
|
||||
.set = btrfs_xattr_acl_access_set,
|
||||
.flags = ACL_TYPE_ACCESS,
|
||||
.get = btrfs_xattr_acl_get,
|
||||
.set = btrfs_xattr_acl_set,
|
||||
};
|
||||
|
||||
#else /* CONFIG_BTRFS_FS_POSIX_ACL */
|
||||
|
|
|
@ -84,7 +84,7 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args)
|
|||
static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
|
||||
{
|
||||
struct cachefiles_object *fsdef;
|
||||
struct nameidata nd;
|
||||
struct path path;
|
||||
struct kstatfs stats;
|
||||
struct dentry *graveyard, *cachedir, *root;
|
||||
const struct cred *saved_cred;
|
||||
|
@ -114,15 +114,12 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
|
|||
_debug("- fsdef %p", fsdef);
|
||||
|
||||
/* look up the directory at the root of the cache */
|
||||
memset(&nd, 0, sizeof(nd));
|
||||
|
||||
ret = path_lookup(cache->rootdirname, LOOKUP_DIRECTORY, &nd);
|
||||
ret = kern_path(cache->rootdirname, LOOKUP_DIRECTORY, &path);
|
||||
if (ret < 0)
|
||||
goto error_open_root;
|
||||
|
||||
cache->mnt = mntget(nd.path.mnt);
|
||||
root = dget(nd.path.dentry);
|
||||
path_put(&nd.path);
|
||||
cache->mnt = path.mnt;
|
||||
root = path.dentry;
|
||||
|
||||
/* check parameters */
|
||||
ret = -EOPNOTSUPP;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include <linux/mount.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/ima.h>
|
||||
#include "internal.h"
|
||||
|
||||
/*
|
||||
|
@ -923,7 +922,6 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
|
|||
if (IS_ERR(file)) {
|
||||
ret = PTR_ERR(file);
|
||||
} else {
|
||||
ima_counts_get(file);
|
||||
ret = -EIO;
|
||||
if (file->f_op->write) {
|
||||
pos = (loff_t) page->index << PAGE_SHIFT;
|
||||
|
|
|
@ -978,6 +978,7 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name)
|
|||
q.hash = full_name_hash(q.name, q.len);
|
||||
return d_alloc(parent, &q);
|
||||
}
|
||||
EXPORT_SYMBOL(d_alloc_name);
|
||||
|
||||
/* the caller must hold dcache_lock */
|
||||
static void __d_instantiate(struct dentry *dentry, struct inode *inode)
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <linux/key.h>
|
||||
#include <linux/parser.h>
|
||||
#include <linux/fs_stack.h>
|
||||
#include <linux/ima.h>
|
||||
#include "ecryptfs_kernel.h"
|
||||
|
||||
/**
|
||||
|
@ -119,7 +118,6 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
|
|||
const struct cred *cred = current_cred();
|
||||
struct ecryptfs_inode_info *inode_info =
|
||||
ecryptfs_inode_to_private(ecryptfs_dentry->d_inode);
|
||||
int opened_lower_file = 0;
|
||||
int rc = 0;
|
||||
|
||||
mutex_lock(&inode_info->lower_file_mutex);
|
||||
|
@ -136,12 +134,9 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
|
|||
"for lower_dentry [0x%p] and lower_mnt [0x%p]; "
|
||||
"rc = [%d]\n", lower_dentry, lower_mnt, rc);
|
||||
inode_info->lower_file = NULL;
|
||||
} else
|
||||
opened_lower_file = 1;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&inode_info->lower_file_mutex);
|
||||
if (opened_lower_file)
|
||||
ima_counts_get(inode_info->lower_file);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -339,12 +339,12 @@ ext2_acl_chmod(struct inode *inode)
|
|||
* Extended attribut handlers
|
||||
*/
|
||||
static size_t
|
||||
ext2_xattr_list_acl_access(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext2_xattr_list_acl_access(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_size)
|
||||
memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
|
||||
|
@ -352,12 +352,12 @@ ext2_xattr_list_acl_access(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static size_t
|
||||
ext2_xattr_list_acl_default(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext2_xattr_list_acl_default(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_size)
|
||||
memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
|
||||
|
@ -365,15 +365,18 @@ ext2_xattr_list_acl_default(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
|
||||
ext2_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer,
|
||||
size_t size, int type)
|
||||
{
|
||||
struct posix_acl *acl;
|
||||
int error;
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
acl = ext2_get_acl(inode, type);
|
||||
acl = ext2_get_acl(dentry->d_inode, type);
|
||||
if (IS_ERR(acl))
|
||||
return PTR_ERR(acl);
|
||||
if (acl == NULL)
|
||||
|
@ -385,33 +388,17 @@ ext2_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_get_acl_access(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_get_acl_default(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_set_acl(struct inode *inode, int type, const void *value,
|
||||
size_t size)
|
||||
ext2_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
|
||||
size_t size, int flags, int type)
|
||||
{
|
||||
struct posix_acl *acl;
|
||||
int error;
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return -EOPNOTSUPP;
|
||||
if (!is_owner_or_cap(inode))
|
||||
if (!is_owner_or_cap(dentry->d_inode))
|
||||
return -EPERM;
|
||||
|
||||
if (value) {
|
||||
|
@ -426,41 +413,25 @@ ext2_xattr_set_acl(struct inode *inode, int type, const void *value,
|
|||
} else
|
||||
acl = NULL;
|
||||
|
||||
error = ext2_set_acl(inode, type, acl);
|
||||
error = ext2_set_acl(dentry->d_inode, type, acl);
|
||||
|
||||
release_and_out:
|
||||
posix_acl_release(acl);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_set_acl_access(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_set_acl_default(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
|
||||
}
|
||||
|
||||
struct xattr_handler ext2_xattr_acl_access_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_ACCESS,
|
||||
.flags = ACL_TYPE_ACCESS,
|
||||
.list = ext2_xattr_list_acl_access,
|
||||
.get = ext2_xattr_get_acl_access,
|
||||
.set = ext2_xattr_set_acl_access,
|
||||
.get = ext2_xattr_get_acl,
|
||||
.set = ext2_xattr_set_acl,
|
||||
};
|
||||
|
||||
struct xattr_handler ext2_xattr_acl_default_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_DEFAULT,
|
||||
.flags = ACL_TYPE_DEFAULT,
|
||||
.list = ext2_xattr_list_acl_default,
|
||||
.get = ext2_xattr_get_acl_default,
|
||||
.set = ext2_xattr_set_acl_default,
|
||||
.get = ext2_xattr_get_acl,
|
||||
.set = ext2_xattr_set_acl,
|
||||
};
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <linux/mbcache.h>
|
||||
#include <linux/quotaops.h>
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/security.h>
|
||||
#include "ext2.h"
|
||||
#include "xattr.h"
|
||||
#include "acl.h"
|
||||
|
@ -249,8 +250,9 @@ cleanup:
|
|||
* used / required on success.
|
||||
*/
|
||||
static int
|
||||
ext2_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
|
||||
ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct buffer_head *bh = NULL;
|
||||
struct ext2_xattr_entry *entry;
|
||||
char *end;
|
||||
|
@ -300,9 +302,10 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
|
|||
ext2_xattr_handler(entry->e_name_index);
|
||||
|
||||
if (handler) {
|
||||
size_t size = handler->list(inode, buffer, rest,
|
||||
size_t size = handler->list(dentry, buffer, rest,
|
||||
entry->e_name,
|
||||
entry->e_name_len);
|
||||
entry->e_name_len,
|
||||
handler->flags);
|
||||
if (buffer) {
|
||||
if (size > rest) {
|
||||
error = -ERANGE;
|
||||
|
@ -330,7 +333,7 @@ cleanup:
|
|||
ssize_t
|
||||
ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
||||
{
|
||||
return ext2_xattr_list(dentry->d_inode, buffer, size);
|
||||
return ext2_xattr_list(dentry, buffer, size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext2_xattr_security_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const int prefix_len = XATTR_SECURITY_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
@ -26,22 +26,22 @@ ext2_xattr_security_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_security_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext2_xattr_security_get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name,
|
||||
return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name,
|
||||
buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_security_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext2_xattr_security_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_SECURITY, name,
|
||||
return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name,
|
||||
value, size, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext2_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const int prefix_len = XATTR_TRUSTED_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
@ -31,22 +31,22 @@ ext2_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_trusted_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
|
||||
return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name,
|
||||
buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_trusted_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext2_xattr_trusted_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
|
||||
return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name,
|
||||
value, size, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext2_xattr_user_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return 0;
|
||||
|
||||
if (list && total_len <= list_size) {
|
||||
|
@ -30,27 +30,28 @@ ext2_xattr_user_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_user_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext2_xattr_user_get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return -EOPNOTSUPP;
|
||||
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size);
|
||||
return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_USER,
|
||||
name, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_xattr_user_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext2_xattr_user_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name,
|
||||
value, size, flags);
|
||||
return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_USER,
|
||||
name, value, size, flags);
|
||||
}
|
||||
|
||||
struct xattr_handler ext2_xattr_user_handler = {
|
||||
|
|
|
@ -366,12 +366,12 @@ out:
|
|||
* Extended attribute handlers
|
||||
*/
|
||||
static size_t
|
||||
ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
|
||||
const char *name, size_t name_len)
|
||||
ext3_xattr_list_acl_access(struct dentry *dentry, char *list, size_t list_len,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_len)
|
||||
memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
|
||||
|
@ -379,12 +379,12 @@ ext3_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
|
|||
}
|
||||
|
||||
static size_t
|
||||
ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
|
||||
const char *name, size_t name_len)
|
||||
ext3_xattr_list_acl_default(struct dentry *dentry, char *list, size_t list_len,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_len)
|
||||
memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
|
||||
|
@ -392,15 +392,18 @@ ext3_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
|
||||
ext3_xattr_get_acl(struct dentry *dentry, const char *name, void *buffer,
|
||||
size_t size, int type)
|
||||
{
|
||||
struct posix_acl *acl;
|
||||
int error;
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
acl = ext3_get_acl(inode, type);
|
||||
acl = ext3_get_acl(dentry->d_inode, type);
|
||||
if (IS_ERR(acl))
|
||||
return PTR_ERR(acl);
|
||||
if (acl == NULL)
|
||||
|
@ -412,31 +415,16 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_get_acl_access(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_get_acl_default(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_set_acl(struct inode *inode, int type, const void *value,
|
||||
size_t size)
|
||||
ext3_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
|
||||
size_t size, int flags, int type)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
handle_t *handle;
|
||||
struct posix_acl *acl;
|
||||
int error, retries = 0;
|
||||
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
return -EOPNOTSUPP;
|
||||
if (!is_owner_or_cap(inode))
|
||||
|
@ -468,34 +456,18 @@ release_and_out:
|
|||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_set_acl_access(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_set_acl_default(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
{
|
||||
if (strcmp(name, "") != 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
|
||||
}
|
||||
|
||||
struct xattr_handler ext3_xattr_acl_access_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_ACCESS,
|
||||
.flags = ACL_TYPE_ACCESS,
|
||||
.list = ext3_xattr_list_acl_access,
|
||||
.get = ext3_xattr_get_acl_access,
|
||||
.set = ext3_xattr_set_acl_access,
|
||||
.get = ext3_xattr_get_acl,
|
||||
.set = ext3_xattr_set_acl,
|
||||
};
|
||||
|
||||
struct xattr_handler ext3_xattr_acl_default_handler = {
|
||||
.prefix = POSIX_ACL_XATTR_DEFAULT,
|
||||
.flags = ACL_TYPE_DEFAULT,
|
||||
.list = ext3_xattr_list_acl_default,
|
||||
.get = ext3_xattr_get_acl_default,
|
||||
.set = ext3_xattr_set_acl_default,
|
||||
.get = ext3_xattr_get_acl,
|
||||
.set = ext3_xattr_set_acl,
|
||||
};
|
||||
|
|
|
@ -99,7 +99,7 @@ static struct buffer_head *ext3_xattr_cache_find(struct inode *,
|
|||
struct mb_cache_entry **);
|
||||
static void ext3_xattr_rehash(struct ext3_xattr_header *,
|
||||
struct ext3_xattr_entry *);
|
||||
static int ext3_xattr_list(struct inode *inode, char *buffer,
|
||||
static int ext3_xattr_list(struct dentry *dentry, char *buffer,
|
||||
size_t buffer_size);
|
||||
|
||||
static struct mb_cache *ext3_xattr_cache;
|
||||
|
@ -147,7 +147,7 @@ ext3_xattr_handler(int name_index)
|
|||
ssize_t
|
||||
ext3_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
||||
{
|
||||
return ext3_xattr_list(dentry->d_inode, buffer, size);
|
||||
return ext3_xattr_list(dentry, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -332,7 +332,7 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry,
|
||||
ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry,
|
||||
char *buffer, size_t buffer_size)
|
||||
{
|
||||
size_t rest = buffer_size;
|
||||
|
@ -342,9 +342,10 @@ ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry,
|
|||
ext3_xattr_handler(entry->e_name_index);
|
||||
|
||||
if (handler) {
|
||||
size_t size = handler->list(inode, buffer, rest,
|
||||
size_t size = handler->list(dentry, buffer, rest,
|
||||
entry->e_name,
|
||||
entry->e_name_len);
|
||||
entry->e_name_len,
|
||||
handler->flags);
|
||||
if (buffer) {
|
||||
if (size > rest)
|
||||
return -ERANGE;
|
||||
|
@ -357,8 +358,9 @@ ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
|
||||
ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct buffer_head *bh = NULL;
|
||||
int error;
|
||||
|
||||
|
@ -383,7 +385,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
|
|||
goto cleanup;
|
||||
}
|
||||
ext3_xattr_cache_insert(bh);
|
||||
error = ext3_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
|
||||
error = ext3_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
|
||||
|
||||
cleanup:
|
||||
brelse(bh);
|
||||
|
@ -392,8 +394,9 @@ cleanup:
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
|
||||
ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct ext3_xattr_ibody_header *header;
|
||||
struct ext3_inode *raw_inode;
|
||||
struct ext3_iloc iloc;
|
||||
|
@ -411,7 +414,7 @@ ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
|
|||
error = ext3_xattr_check_names(IFIRST(header), end);
|
||||
if (error)
|
||||
goto cleanup;
|
||||
error = ext3_xattr_list_entries(inode, IFIRST(header),
|
||||
error = ext3_xattr_list_entries(dentry, IFIRST(header),
|
||||
buffer, buffer_size);
|
||||
|
||||
cleanup:
|
||||
|
@ -430,12 +433,12 @@ cleanup:
|
|||
* used / required on success.
|
||||
*/
|
||||
static int
|
||||
ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
|
||||
ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
{
|
||||
int i_error, b_error;
|
||||
|
||||
down_read(&EXT3_I(inode)->xattr_sem);
|
||||
i_error = ext3_xattr_ibody_list(inode, buffer, buffer_size);
|
||||
down_read(&EXT3_I(dentry->d_inode)->xattr_sem);
|
||||
i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size);
|
||||
if (i_error < 0) {
|
||||
b_error = 0;
|
||||
} else {
|
||||
|
@ -443,11 +446,11 @@ ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
|
|||
buffer += i_error;
|
||||
buffer_size -= i_error;
|
||||
}
|
||||
b_error = ext3_xattr_block_list(inode, buffer, buffer_size);
|
||||
b_error = ext3_xattr_block_list(dentry, buffer, buffer_size);
|
||||
if (b_error < 0)
|
||||
i_error = 0;
|
||||
}
|
||||
up_read(&EXT3_I(inode)->xattr_sem);
|
||||
up_read(&EXT3_I(dentry->d_inode)->xattr_sem);
|
||||
return i_error + b_error;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
@ -28,23 +28,23 @@ ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_security_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext3_xattr_security_get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY, name,
|
||||
buffer, size);
|
||||
return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY,
|
||||
name, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_security_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext3_xattr_security_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY, name,
|
||||
value, size, flags);
|
||||
return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY,
|
||||
name, value, size, flags);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
@ -32,22 +32,22 @@ ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_trusted_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext3_xattr_trusted_get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
|
||||
buffer, size);
|
||||
return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED,
|
||||
name, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_trusted_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext3_xattr_trusted_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
|
||||
return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, name,
|
||||
value, size, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
#include "xattr.h"
|
||||
|
||||
static size_t
|
||||
ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size,
|
||||
const char *name, size_t name_len)
|
||||
ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
|
||||
const size_t total_len = prefix_len + name_len + 1;
|
||||
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return 0;
|
||||
|
||||
if (list && total_len <= list_size) {
|
||||
|
@ -31,26 +31,27 @@ ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size,
|
|||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_user_get(struct inode *inode, const char *name,
|
||||
void *buffer, size_t size)
|
||||
ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer,
|
||||
size_t size, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return -EOPNOTSUPP;
|
||||
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
|
||||
return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_USER,
|
||||
name, buffer, size);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_xattr_user_set(struct inode *inode, const char *name,
|
||||
const void *value, size_t size, int flags)
|
||||
ext3_xattr_user_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t size, int flags, int type)
|
||||
{
|
||||
if (strcmp(name, "") == 0)
|
||||
return -EINVAL;
|
||||
if (!test_opt(inode->i_sb, XATTR_USER))
|
||||
if (!test_opt(dentry->d_sb, XATTR_USER))
|
||||
return -EOPNOTSUPP;
|
||||
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
|
||||
value, size, flags);
|
||||
return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_USER,
|
||||
name, value, size, flags);
|
||||
}
|
||||
|
||||
struct xattr_handler ext3_xattr_user_handler = {
|
||||
|
|
|
@ -364,12 +364,12 @@ out:
|
|||
* Extended attribute handlers
|
||||
*/
|
||||
static size_t
|
||||
ext4_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
|
||||
const char *name, size_t name_len)
|
||||
ext4_xattr_list_acl_access(struct dentry *dentry, char *list, size_t list_len,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_len)
|
||||
memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
|
||||
|
@ -377,12 +377,12 @@ ext4_xattr_list_acl_access(struct inode *inode, char *list, size_t list_len,
|
|||
}
|
||||
|
||||
static size_t
|
||||
ext4_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
|
||||
const char *name, size_t name_len)
|
||||
ext4_xattr_list_acl_default(struct dentry *dentry, char *list, size_t list_len,
|
||||
const char *name, size_t name_len, int type)
|
||||
{
|
||||
const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
|
||||
|
||||
if (!test_opt(inode->i_sb, POSIX_ACL))
|
||||
if (!test_opt(dentry->d_sb, POSIX_ACL))
|
||||
return 0;
|
||||
if (list && size <= list_len)
|
||||
memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
|
||||
|
@ -390,15 +390,18 @@ ext4_xattr_list_acl_default(struct inode *inode, char *list, size_t list_len,
|
|||
}
|
||||
|
||||
static int
|
||||
ext4_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
|
||||
|