Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)   File: linux/ext2_xattr.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)   On-disk format of extended attributes for the ext2 filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)   (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/xattr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) /* Magic value in attribute blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define EXT2_XATTR_MAGIC		0xEA020000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /* Maximum number of references to one attribute block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define EXT2_XATTR_REFCOUNT_MAX		1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) /* Name indexes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define EXT2_XATTR_INDEX_USER			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define EXT2_XATTR_INDEX_POSIX_ACL_ACCESS	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define EXT2_XATTR_INDEX_TRUSTED		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define	EXT2_XATTR_INDEX_LUSTRE			5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define EXT2_XATTR_INDEX_SECURITY	        6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) struct ext2_xattr_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	__le32	h_magic;	/* magic number for identification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	__le32	h_refcount;	/* reference count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	__le32	h_blocks;	/* number of disk blocks used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	__le32	h_hash;		/* hash value of all attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	__u32	h_reserved[4];	/* zero right now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) struct ext2_xattr_entry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	__u8	e_name_len;	/* length of name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	__u8	e_name_index;	/* attribute name index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	__le16	e_value_offs;	/* offset in disk block of value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	__le32	e_value_block;	/* disk block attribute is stored on (n/i) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	__le32	e_value_size;	/* size of attribute value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	__le32	e_hash;		/* hash value of name and value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	char	e_name[];	/* attribute name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define EXT2_XATTR_PAD_BITS		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define EXT2_XATTR_PAD		(1<<EXT2_XATTR_PAD_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define EXT2_XATTR_ROUND		(EXT2_XATTR_PAD-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define EXT2_XATTR_LEN(name_len) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	(((name_len) + EXT2_XATTR_ROUND + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	sizeof(struct ext2_xattr_entry)) & ~EXT2_XATTR_ROUND)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define EXT2_XATTR_NEXT(entry) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	( (struct ext2_xattr_entry *)( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	  (char *)(entry) + EXT2_XATTR_LEN((entry)->e_name_len)) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define EXT2_XATTR_SIZE(size) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	(((size) + EXT2_XATTR_ROUND) & ~EXT2_XATTR_ROUND)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) struct mb_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) # ifdef CONFIG_EXT2_FS_XATTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) extern const struct xattr_handler ext2_xattr_user_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) extern const struct xattr_handler ext2_xattr_trusted_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) extern const struct xattr_handler ext2_xattr_security_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) extern ssize_t ext2_listxattr(struct dentry *, char *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) extern int ext2_xattr_get(struct inode *, int, const char *, void *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) extern int ext2_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) extern void ext2_xattr_delete_inode(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) extern struct mb_cache *ext2_xattr_create_cache(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) extern void ext2_xattr_destroy_cache(struct mb_cache *cache);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) extern const struct xattr_handler *ext2_xattr_handlers[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) # else  /* CONFIG_EXT2_FS_XATTR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) ext2_xattr_get(struct inode *inode, int name_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	       const char *name, void *buffer, size_t size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) ext2_xattr_set(struct inode *inode, int name_index, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	       const void *value, size_t size, int flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) ext2_xattr_delete_inode(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline void ext2_xattr_destroy_cache(struct mb_cache *cache)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define ext2_xattr_handlers NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define ext2_listxattr NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) # endif  /* CONFIG_EXT2_FS_XATTR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #ifdef CONFIG_EXT2_FS_SECURITY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) extern int ext2_init_security(struct inode *inode, struct inode *dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			      const struct qstr *qstr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static inline int ext2_init_security(struct inode *inode, struct inode *dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 				     const struct qstr *qstr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #endif