~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/erofs/xattr.h

Version: ~ [ linux-5.10-rc5 ] ~ [ linux-5.9.10 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.79 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.159 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.208 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.245 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.245 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2017-2018 HUAWEI, Inc.
  4  *             https://www.huawei.com/
  5  * Created by Gao Xiang <gaoxiang25@huawei.com>
  6  */
  7 #ifndef __EROFS_XATTR_H
  8 #define __EROFS_XATTR_H
  9 
 10 #include "internal.h"
 11 #include <linux/posix_acl_xattr.h>
 12 #include <linux/xattr.h>
 13 
 14 /* Attribute not found */
 15 #define ENOATTR         ENODATA
 16 
 17 static inline unsigned int inlinexattr_header_size(struct inode *inode)
 18 {
 19         return sizeof(struct erofs_xattr_ibody_header) +
 20                 sizeof(u32) * EROFS_I(inode)->xattr_shared_count;
 21 }
 22 
 23 static inline erofs_blk_t xattrblock_addr(struct erofs_sb_info *sbi,
 24                                           unsigned int xattr_id)
 25 {
 26 #ifdef CONFIG_EROFS_FS_XATTR
 27         return sbi->xattr_blkaddr +
 28                 xattr_id * sizeof(__u32) / EROFS_BLKSIZ;
 29 #else
 30         return 0;
 31 #endif
 32 }
 33 
 34 static inline unsigned int xattrblock_offset(struct erofs_sb_info *sbi,
 35                                              unsigned int xattr_id)
 36 {
 37         return (xattr_id * sizeof(__u32)) % EROFS_BLKSIZ;
 38 }
 39 
 40 #ifdef CONFIG_EROFS_FS_XATTR
 41 extern const struct xattr_handler erofs_xattr_user_handler;
 42 extern const struct xattr_handler erofs_xattr_trusted_handler;
 43 #ifdef CONFIG_EROFS_FS_SECURITY
 44 extern const struct xattr_handler erofs_xattr_security_handler;
 45 #endif
 46 
 47 static inline const struct xattr_handler *erofs_xattr_handler(unsigned int idx)
 48 {
 49         static const struct xattr_handler *xattr_handler_map[] = {
 50                 [EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler,
 51 #ifdef CONFIG_EROFS_FS_POSIX_ACL
 52                 [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] =
 53                         &posix_acl_access_xattr_handler,
 54                 [EROFS_XATTR_INDEX_POSIX_ACL_DEFAULT] =
 55                         &posix_acl_default_xattr_handler,
 56 #endif
 57                 [EROFS_XATTR_INDEX_TRUSTED] = &erofs_xattr_trusted_handler,
 58 #ifdef CONFIG_EROFS_FS_SECURITY
 59                 [EROFS_XATTR_INDEX_SECURITY] = &erofs_xattr_security_handler,
 60 #endif
 61         };
 62 
 63         return idx && idx < ARRAY_SIZE(xattr_handler_map) ?
 64                 xattr_handler_map[idx] : NULL;
 65 }
 66 
 67 extern const struct xattr_handler *erofs_xattr_handlers[];
 68 
 69 int erofs_getxattr(struct inode *, int, const char *, void *, size_t);
 70 ssize_t erofs_listxattr(struct dentry *, char *, size_t);
 71 #else
 72 static inline int erofs_getxattr(struct inode *inode, int index,
 73                                  const char *name, void *buffer,
 74                                  size_t buffer_size)
 75 {
 76         return -EOPNOTSUPP;
 77 }
 78 
 79 #define erofs_listxattr (NULL)
 80 #define erofs_xattr_handlers (NULL)
 81 #endif  /* !CONFIG_EROFS_FS_XATTR */
 82 
 83 #ifdef CONFIG_EROFS_FS_POSIX_ACL
 84 struct posix_acl *erofs_get_acl(struct inode *inode, int type);
 85 #else
 86 #define erofs_get_acl   (NULL)
 87 #endif
 88 
 89 #endif
 90 
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp