forked from luck/tmp_suning_uos_patched
47e4937a4a
EROFS filesystem has been merged into linux-staging for a year. EROFS is designed to be a better solution of saving extra storage space with guaranteed end-to-end performance for read-only files with the help of reduced metadata, fixed-sized output compression and decompression inplace technologies. In the past year, EROFS was greatly improved by many people as a staging driver, self-tested, betaed by a large number of our internal users, successfully applied to almost all in-service HUAWEI smartphones as the part of EMUI 9.1 and proven to be stable enough to be moved out of staging. EROFS is a self-contained filesystem driver. Although there are still some TODOs to be more generic, we have a dedicated team actively keeping on working on EROFS in order to make it better with the evolution of Linux kernel as the other in-kernel filesystems. As Pavel suggested, it's better to do as one commit since git can do moves and all histories will be saved in this way. Let's promote it from staging and enhance it more actively as a "real" part of kernel for more wider scenarios! Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Pavel Machek <pavel@denx.de> Cc: David Sterba <dsterba@suse.cz> Cc: Amir Goldstein <amir73il@gmail.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Darrick J . Wong <darrick.wong@oracle.com> Cc: Dave Chinner <david@fromorbit.com> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Richard Weinberger <richard@nod.at> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Chao Yu <yuchao0@huawei.com> Cc: Miao Xie <miaoxie@huawei.com> Cc: Li Guifu <bluce.liguifu@huawei.com> Cc: Fang Wei <fangwei1@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Link: https://lore.kernel.org/r/20190822213659.5501-1-hsiangkao@aol.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
93 lines
2.4 KiB
C
93 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2017-2018 HUAWEI, Inc.
|
|
* http://www.huawei.com/
|
|
* Created by Gao Xiang <gaoxiang25@huawei.com>
|
|
*/
|
|
#ifndef __EROFS_XATTR_H
|
|
#define __EROFS_XATTR_H
|
|
|
|
#include "internal.h"
|
|
#include <linux/posix_acl_xattr.h>
|
|
#include <linux/xattr.h>
|
|
|
|
/* Attribute not found */
|
|
#define ENOATTR ENODATA
|
|
|
|
static inline unsigned int inlinexattr_header_size(struct inode *inode)
|
|
{
|
|
return sizeof(struct erofs_xattr_ibody_header)
|
|
+ sizeof(u32) * EROFS_V(inode)->xattr_shared_count;
|
|
}
|
|
|
|
static inline erofs_blk_t xattrblock_addr(struct erofs_sb_info *sbi,
|
|
unsigned int xattr_id)
|
|
{
|
|
#ifdef CONFIG_EROFS_FS_XATTR
|
|
return sbi->xattr_blkaddr +
|
|
xattr_id * sizeof(__u32) / EROFS_BLKSIZ;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
static inline unsigned int xattrblock_offset(struct erofs_sb_info *sbi,
|
|
unsigned int xattr_id)
|
|
{
|
|
return (xattr_id * sizeof(__u32)) % EROFS_BLKSIZ;
|
|
}
|
|
|
|
#ifdef CONFIG_EROFS_FS_XATTR
|
|
extern const struct xattr_handler erofs_xattr_user_handler;
|
|
extern const struct xattr_handler erofs_xattr_trusted_handler;
|
|
#ifdef CONFIG_EROFS_FS_SECURITY
|
|
extern const struct xattr_handler erofs_xattr_security_handler;
|
|
#endif
|
|
|
|
static inline const struct xattr_handler *erofs_xattr_handler(unsigned int idx)
|
|
{
|
|
static const struct xattr_handler *xattr_handler_map[] = {
|
|
[EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler,
|
|
#ifdef CONFIG_EROFS_FS_POSIX_ACL
|
|
[EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &posix_acl_access_xattr_handler,
|
|
[EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT] =
|
|
&posix_acl_default_xattr_handler,
|
|
#endif
|
|
[EROFS_XATTR_INDEX_TRUSTED] = &erofs_xattr_trusted_handler,
|
|
#ifdef CONFIG_EROFS_FS_SECURITY
|
|
[EROFS_XATTR_INDEX_SECURITY] = &erofs_xattr_security_handler,
|
|
#endif
|
|
};
|
|
|
|
return idx && idx < ARRAY_SIZE(xattr_handler_map) ?
|
|
xattr_handler_map[idx] : NULL;
|
|
}
|
|
|
|
extern const struct xattr_handler *erofs_xattr_handlers[];
|
|
|
|
int erofs_getxattr(struct inode *, int, const char *, void *, size_t);
|
|
ssize_t erofs_listxattr(struct dentry *, char *, size_t);
|
|
#else
|
|
static inline int erofs_getxattr(struct inode *inode, int index,
|
|
const char *name, void *buffer,
|
|
size_t buffer_size)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
static inline ssize_t erofs_listxattr(struct dentry *dentry,
|
|
char *buffer, size_t buffer_size)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
#endif /* !CONFIG_EROFS_FS_XATTR */
|
|
|
|
#ifdef CONFIG_EROFS_FS_POSIX_ACL
|
|
struct posix_acl *erofs_get_acl(struct inode *inode, int type);
|
|
#else
|
|
#define erofs_get_acl (NULL)
|
|
#endif
|
|
|
|
#endif
|
|
|