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: fs/ext2/acl.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)   (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/posix_acl_xattr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define EXT2_ACL_VERSION	0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	__le16		e_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	__le16		e_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	__le32		e_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) } ext2_acl_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	__le16		e_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	__le16		e_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) } ext2_acl_entry_short;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	__le32		a_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) } ext2_acl_header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static inline size_t ext2_acl_size(int count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	if (count <= 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		return sizeof(ext2_acl_header) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		       count * sizeof(ext2_acl_entry_short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		return sizeof(ext2_acl_header) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		       4 * sizeof(ext2_acl_entry_short) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		       (count - 4) * sizeof(ext2_acl_entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static inline int ext2_acl_count(size_t size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	ssize_t s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	size -= sizeof(ext2_acl_header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	s = size - 4 * sizeof(ext2_acl_entry_short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	if (s < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		if (size % sizeof(ext2_acl_entry_short))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 			return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		return size / sizeof(ext2_acl_entry_short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		if (s % sizeof(ext2_acl_entry))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 			return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		return s / sizeof(ext2_acl_entry) + 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #ifdef CONFIG_EXT2_FS_POSIX_ACL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /* acl.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) extern int ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern int ext2_init_acl (struct inode *, struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define ext2_get_acl	NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define ext2_set_acl	NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static inline int ext2_init_acl (struct inode *inode, struct inode *dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)