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)  * Copyright (c) 1999 Al Smith
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Portions derived from IRIX header files (c) 1988 Silicon Graphics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef _EFS_EFS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define _EFS_EFS_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #ifdef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #undef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define EFS_VERSION "1.0a"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) /* 1 block is 512 bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define	EFS_BLOCKSIZE_BITS	9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define	EFS_BLOCKSIZE		(1 << EFS_BLOCKSIZE_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) typedef	int32_t		efs_block_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) typedef uint32_t	efs_ino_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define	EFS_DIRECTEXTENTS	12
^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)  * layout of an extent, in memory and on disk. 8 bytes exactly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) typedef union extent_u {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	unsigned char raw[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct extent_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		unsigned int	ex_magic:8;	/* magic # (zero) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		unsigned int	ex_bn:24;	/* basic block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		unsigned int	ex_length:8;	/* numblocks in this extent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		unsigned int	ex_offset:24;	/* logical offset into file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	} cooked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) } efs_extent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) typedef struct edevs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	__be16		odev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	__be32		ndev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) } efs_devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * extent based filesystem inode as it appears on disk.  The efs inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * is exactly 128 bytes long.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) struct	efs_dinode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	__be16		di_mode;	/* mode and type of file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	__be16		di_nlink;	/* number of links to file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	__be16		di_uid;		/* owner's user id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	__be16		di_gid;		/* owner's group id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	__be32		di_size;	/* number of bytes in file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	__be32		di_atime;	/* time last accessed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	__be32		di_mtime;	/* time last modified */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	__be32		di_ctime;	/* time created */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	__be32		di_gen;		/* generation number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	__be16		di_numextents;	/* # of extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u_char		di_version;	/* version of inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u_char		di_spare;	/* spare - used by AFS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	union di_addr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		efs_extent	di_extents[EFS_DIRECTEXTENTS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		efs_devs	di_dev;	/* device for IFCHR/IFBLK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	} di_u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /* efs inode storage in memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) struct efs_inode_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	int		numextents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	int		lastextent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	efs_extent	extents[EFS_DIRECTEXTENTS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	struct inode	vfs_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #include <linux/efs_fs_sb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define EFS_DIRBSIZE_BITS	EFS_BLOCKSIZE_BITS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define EFS_DIRBSIZE		(1 << EFS_DIRBSIZE_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) struct efs_dentry {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	__be32		inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	unsigned char	namelen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	char		name[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define EFS_DENTSIZE	(sizeof(struct efs_dentry) - 3 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define EFS_MAXNAMELEN  ((1 << (sizeof(char) * 8)) - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define EFS_DIRBLK_HEADERSIZE	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define EFS_DIRBLK_MAGIC	0xbeef	/* moo */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct efs_dir {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	__be16	magic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	unsigned char	firstused;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	unsigned char	slots;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	unsigned char	space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define EFS_MAXENTS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	 (EFS_DENTSIZE + sizeof(char)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define EFS_REALOFF(offset) ((offset << 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) static inline struct efs_inode_info *INODE_INFO(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	return container_of(inode, struct efs_inode_info, vfs_inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	return sb->s_fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct statfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct fid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) extern const struct inode_operations efs_dir_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) extern const struct file_operations efs_dir_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) extern const struct address_space_operations efs_symlink_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern struct inode *efs_iget(struct super_block *, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) extern efs_block_t efs_map_block(struct inode *, efs_block_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) extern struct dentry *efs_lookup(struct inode *, struct dentry *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		int fh_len, int fh_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) extern struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		int fh_len, int fh_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) extern struct dentry *efs_get_parent(struct dentry *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) extern int efs_bmap(struct inode *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #endif /* _EFS_EFS_H_ */