aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ext2_fs.h
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2012-03-23 05:27:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-31 16:03:15 -0400
commit4a165d25f63a989d0aabe9d8eed5b3a5d5da1862 (patch)
tree472b3fd4b2432d325d427e28b148676e9790c6fe /include/linux/ext2_fs.h
parent00292bbf769620dea923dbd906afd88955f7ea19 (diff)
ext2: No longer export ext2_fs.h to user space
Since the on-disk format has been stable for quite some time, users should either use the headers provided by libext2fs or keep a private copy of this header. For the full discussion, see this thread: https://lkml.org/lkml/2012/3/21/516 While at it, this commit removes all __KERNEL__ guards, which are now unnecessary. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Jan Kara <jack@suse.cz> Cc: Ted Ts'o <tytso@mit.edu> Cc: Artem Bityutskiy <dedekind1@gmail.com> Cc: Andreas Dilger <aedilger@gmail.com> Cc: linux-ext4@vger.kernel.org
Diffstat (limited to 'include/linux/ext2_fs.h')
-rw-r--r--include/linux/ext2_fs.h72
1 files changed, 10 insertions, 62 deletions
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index ce1b719e8bd4..f28dba518a4a 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -20,6 +20,8 @@
20#include <linux/magic.h> 20#include <linux/magic.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22 22
23#include <linux/ext2_fs_sb.h>
24
23/* 25/*
24 * The second extended filesystem constants/structures 26 * The second extended filesystem constants/structures
25 */ 27 */
@@ -66,18 +68,10 @@
66/* First non-reserved inode for old ext2 filesystems */ 68/* First non-reserved inode for old ext2 filesystems */
67#define EXT2_GOOD_OLD_FIRST_INO 11 69#define EXT2_GOOD_OLD_FIRST_INO 11
68 70
69#ifdef __KERNEL__
70#include <linux/ext2_fs_sb.h>
71static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) 71static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
72{ 72{
73 return sb->s_fs_info; 73 return sb->s_fs_info;
74} 74}
75#else
76/* Assume that user mode programs are passing in an ext2fs superblock, not
77 * a kernel struct super_block. This will allow us to call the feature-test
78 * macros from user land. */
79#define EXT2_SB(sb) (sb)
80#endif
81 75
82/* 76/*
83 * Maximal count of links to a file 77 * Maximal count of links to a file
@@ -90,29 +84,12 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
90#define EXT2_MIN_BLOCK_SIZE 1024 84#define EXT2_MIN_BLOCK_SIZE 1024
91#define EXT2_MAX_BLOCK_SIZE 4096 85#define EXT2_MAX_BLOCK_SIZE 4096
92#define EXT2_MIN_BLOCK_LOG_SIZE 10 86#define EXT2_MIN_BLOCK_LOG_SIZE 10
93#ifdef __KERNEL__ 87#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
94# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
95#else
96# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
97#endif
98#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) 88#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
99#ifdef __KERNEL__ 89#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
100# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
101#else
102# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
103#endif
104#ifdef __KERNEL__
105#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits) 90#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
106#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) 91#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
107#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) 92#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
108#else
109#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
110 EXT2_GOOD_OLD_INODE_SIZE : \
111 (s)->s_inode_size)
112#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
113 EXT2_GOOD_OLD_FIRST_INO : \
114 (s)->s_first_ino)
115#endif
116 93
117/* 94/*
118 * Macro-instructions used to manage fragments 95 * Macro-instructions used to manage fragments
@@ -120,13 +97,8 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
120#define EXT2_MIN_FRAG_SIZE 1024 97#define EXT2_MIN_FRAG_SIZE 1024
121#define EXT2_MAX_FRAG_SIZE 4096 98#define EXT2_MAX_FRAG_SIZE 4096
122#define EXT2_MIN_FRAG_LOG_SIZE 10 99#define EXT2_MIN_FRAG_LOG_SIZE 10
123#ifdef __KERNEL__ 100#define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size)
124# define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size) 101#define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block)
125# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block)
126#else
127# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
128# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
129#endif
130 102
131/* 103/*
132 * Structure of a blocks group descriptor 104 * Structure of a blocks group descriptor
@@ -146,16 +118,10 @@ struct ext2_group_desc
146/* 118/*
147 * Macro-instructions used to manage group descriptors 119 * Macro-instructions used to manage group descriptors
148 */ 120 */
149#ifdef __KERNEL__ 121#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
150# define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) 122#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
151# define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) 123#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
152# define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) 124#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
153# define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
154#else
155# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
156# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
157# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
158#endif
159 125
160/* 126/*
161 * Constants relative to the data blocks 127 * Constants relative to the data blocks
@@ -296,7 +262,6 @@ struct ext2_inode {
296 262
297#define i_size_high i_dir_acl 263#define i_size_high i_dir_acl
298 264
299#if defined(__KERNEL__) || defined(__linux__)
300#define i_reserved1 osd1.linux1.l_i_reserved1 265#define i_reserved1 osd1.linux1.l_i_reserved1
301#define i_frag osd2.linux2.l_i_frag 266#define i_frag osd2.linux2.l_i_frag
302#define i_fsize osd2.linux2.l_i_fsize 267#define i_fsize osd2.linux2.l_i_fsize
@@ -305,23 +270,6 @@ struct ext2_inode {
305#define i_uid_high osd2.linux2.l_i_uid_high 270#define i_uid_high osd2.linux2.l_i_uid_high
306#define i_gid_high osd2.linux2.l_i_gid_high 271#define i_gid_high osd2.linux2.l_i_gid_high
307#define i_reserved2 osd2.linux2.l_i_reserved2 272#define i_reserved2 osd2.linux2.l_i_reserved2
308#endif
309
310#ifdef __hurd__
311#define i_translator osd1.hurd1.h_i_translator
312#define i_frag osd2.hurd2.h_i_frag
313#define i_fsize osd2.hurd2.h_i_fsize
314#define i_uid_high osd2.hurd2.h_i_uid_high
315#define i_gid_high osd2.hurd2.h_i_gid_high
316#define i_author osd2.hurd2.h_i_author
317#endif
318
319#ifdef __masix__
320#define i_reserved1 osd1.masix1.m_i_reserved1
321#define i_frag osd2.masix2.m_i_frag
322#define i_fsize osd2.masix2.m_i_fsize
323#define i_reserved2 osd2.masix2.m_i_reserved2
324#endif
325 273
326/* 274/*
327 * File system states 275 * File system states