Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.19-rc8 93 lines 2.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 2 * 3 * linux/drivers/staging/erofs/xattr.h 4 * 5 * Copyright (C) 2017-2018 HUAWEI, Inc. 6 * http://www.huawei.com/ 7 * Created by Gao Xiang <gaoxiang25@huawei.com> 8 * 9 * This file is subject to the terms and conditions of the GNU General Public 10 * License. See the file COPYING in the main directory of the Linux 11 * distribution for more details. 12 */ 13#ifndef __EROFS_XATTR_H 14#define __EROFS_XATTR_H 15 16#include "internal.h" 17#include <linux/posix_acl_xattr.h> 18#include <linux/xattr.h> 19 20/* Attribute not found */ 21#define ENOATTR ENODATA 22 23static inline unsigned inlinexattr_header_size(struct inode *inode) 24{ 25 return sizeof(struct erofs_xattr_ibody_header) 26 + sizeof(u32) * EROFS_V(inode)->xattr_shared_count; 27} 28 29static inline erofs_blk_t 30xattrblock_addr(struct erofs_sb_info *sbi, unsigned xattr_id) 31{ 32#ifdef CONFIG_EROFS_FS_XATTR 33 return sbi->xattr_blkaddr + 34 xattr_id * sizeof(__u32) / EROFS_BLKSIZ; 35#else 36 return 0; 37#endif 38} 39 40static inline unsigned 41xattrblock_offset(struct erofs_sb_info *sbi, unsigned xattr_id) 42{ 43 return (xattr_id * sizeof(__u32)) % EROFS_BLKSIZ; 44} 45 46extern const struct xattr_handler erofs_xattr_user_handler; 47extern const struct xattr_handler erofs_xattr_trusted_handler; 48#ifdef CONFIG_EROFS_FS_SECURITY 49extern const struct xattr_handler erofs_xattr_security_handler; 50#endif 51 52static inline const struct xattr_handler *erofs_xattr_handler(unsigned index) 53{ 54static const struct xattr_handler *xattr_handler_map[] = { 55 [EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler, 56#ifdef CONFIG_EROFS_FS_POSIX_ACL 57 [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &posix_acl_access_xattr_handler, 58 [EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT] = 59 &posix_acl_default_xattr_handler, 60#endif 61 [EROFS_XATTR_INDEX_TRUSTED] = &erofs_xattr_trusted_handler, 62#ifdef CONFIG_EROFS_FS_SECURITY 63 [EROFS_XATTR_INDEX_SECURITY] = &erofs_xattr_security_handler, 64#endif 65}; 66 return index && index < ARRAY_SIZE(xattr_handler_map) ? 67 xattr_handler_map[index] : NULL; 68} 69 70#ifdef CONFIG_EROFS_FS_XATTR 71 72extern const struct inode_operations erofs_generic_xattr_iops; 73extern const struct inode_operations erofs_dir_xattr_iops; 74 75int erofs_getxattr(struct inode *, int, const char *, void *, size_t); 76ssize_t erofs_listxattr(struct dentry *, char *, size_t); 77#else 78static int __maybe_unused erofs_getxattr(struct inode *inode, int index, 79 const char *name, 80 void *buffer, size_t buffer_size) 81{ 82 return -ENOTSUPP; 83} 84 85static ssize_t __maybe_unused erofs_listxattr(struct dentry *dentry, 86 char *buffer, size_t buffer_size) 87{ 88 return -ENOTSUPP; 89} 90#endif 91 92#endif 93