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