mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

703 lines
23 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/powerpc/quik/own-24-header.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  10. #
  11. # This patch file is dual-licensed. It is available under the license the
  12. # patched project is licensed under, as long as it is an OpenSource license
  13. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  14. # of the GNU General Public License as published by the Free Software
  15. # Foundation; either version 2 of the License, or (at your option) any later
  16. # version.
  17. #
  18. # --- ROCK-COPYRIGHT-NOTE-END ---
  19. --- ./second/file.c.orig 2004-09-25 17:01:31.260931472 +0200
  20. +++ ./second/file.c 2004-09-25 17:01:41.325401440 +0200
  21. @@ -23,7 +23,7 @@
  22. #include <sys/types.h>
  23. #include <errno.h>
  24. #include "quik.h"
  25. -#include <linux/ext2_fs.h>
  26. +#include "linux/ext2_fs.h"
  27. #include <ext2fs/ext2fs.h>
  28. #include <setjmp.h>
  29. #include <asm/mac-part.h>
  30. --- ./quik/quik.c.orig 2004-09-25 17:01:48.716277856 +0200
  31. +++ ./quik/quik.c 2004-09-25 17:01:57.531937672 +0200
  32. @@ -28,7 +28,7 @@
  33. #include <string.h>
  34. #include <stdlib.h>
  35. #include <linux/fs.h>
  36. -#include <linux/ext2_fs.h>
  37. +#include "linux/ext2_fs.h"
  38. #include <sys/stat.h>
  39. #include <endian.h>
  40. #include <fcntl.h>
  41. --- /dev/null 1970-01-01 01:00:00.000000000 +0100
  42. +++ ./include/linux/ext2_fs.h 2004-09-25 17:00:05.756930056 +0200
  43. @@ -0,0 +1,659 @@
  44. +/*
  45. + * linux/include/linux/ext2_fs.h
  46. + *
  47. + * Copyright (C) 1992, 1993, 1994, 1995
  48. + * Remy Card (card@masi.ibp.fr)
  49. + * Laboratoire MASI - Institut Blaise Pascal
  50. + * Universite Pierre et Marie Curie (Paris VI)
  51. + *
  52. + * from
  53. + *
  54. + * linux/include/linux/minix_fs.h
  55. + *
  56. + * Copyright (C) 1991, 1992 Linus Torvalds
  57. + */
  58. +
  59. +#ifndef _LINUX_EXT2_FS_H
  60. +#define _LINUX_EXT2_FS_H
  61. +
  62. +#include <linux/types.h>
  63. +
  64. +/*
  65. + * The second extended filesystem constants/structures
  66. + */
  67. +
  68. +/*
  69. + * Define EXT2FS_DEBUG to produce debug messages
  70. + */
  71. +#undef EXT2FS_DEBUG
  72. +
  73. +/*
  74. + * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
  75. + */
  76. +#define EXT2_PREALLOCATE
  77. +#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
  78. +
  79. +/*
  80. + * The second extended file system version
  81. + */
  82. +#define EXT2FS_DATE "95/08/09"
  83. +#define EXT2FS_VERSION "0.5b"
  84. +
  85. +/*
  86. + * Debug code
  87. + */
  88. +#ifdef EXT2FS_DEBUG
  89. +# define ext2_debug(f, a...) { \
  90. + printk ("EXT2-fs DEBUG (%s, %d): %s:", \
  91. + __FILE__, __LINE__, __FUNCTION__); \
  92. + printk (f, ## a); \
  93. + }
  94. +#else
  95. +# define ext2_debug(f, a...) /**/
  96. +#endif
  97. +
  98. +/*
  99. + * Special inode numbers
  100. + */
  101. +#define EXT2_BAD_INO 1 /* Bad blocks inode */
  102. +#define EXT2_ROOT_INO 2 /* Root inode */
  103. +#define EXT2_ACL_IDX_INO 3 /* ACL inode */
  104. +#define EXT2_ACL_DATA_INO 4 /* ACL inode */
  105. +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
  106. +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
  107. +
  108. +/* First non-reserved inode for old ext2 filesystems */
  109. +#define EXT2_GOOD_OLD_FIRST_INO 11
  110. +
  111. +/*
  112. + * The second extended file system magic number
  113. + */
  114. +#define EXT2_SUPER_MAGIC 0xEF53
  115. +
  116. +/*
  117. + * Maximal count of links to a file
  118. + */
  119. +#define EXT2_LINK_MAX 32000
  120. +
  121. +/*
  122. + * Macro-instructions used to manage several block sizes
  123. + */
  124. +#define EXT2_MIN_BLOCK_SIZE 1024
  125. +#define EXT2_MAX_BLOCK_SIZE 4096
  126. +#define EXT2_MIN_BLOCK_LOG_SIZE 10
  127. +#ifdef __KERNEL__
  128. +# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
  129. +#else
  130. +# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  131. +#endif
  132. +#define EXT2_ACLE_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
  133. +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
  134. +#ifdef __KERNEL__
  135. +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
  136. +#else
  137. +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
  138. +#endif
  139. +#ifdef __KERNEL__
  140. +#define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits)
  141. +#define EXT2_INODE_SIZE(s) ((s)->u.ext2_sb.s_inode_size)
  142. +#define EXT2_FIRST_INO(s) ((s)->u.ext2_sb.s_first_ino)
  143. +#else
  144. +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
  145. + EXT2_GOOD_OLD_INODE_SIZE : \
  146. + (s)->s_inode_size)
  147. +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
  148. + EXT2_GOOD_OLD_FIRST_INO : \
  149. + (s)->s_first_ino)
  150. +#endif
  151. +
  152. +/*
  153. + * Macro-instructions used to manage fragments
  154. + */
  155. +#define EXT2_MIN_FRAG_SIZE 1024
  156. +#define EXT2_MAX_FRAG_SIZE 4096
  157. +#define EXT2_MIN_FRAG_LOG_SIZE 10
  158. +#ifdef __KERNEL__
  159. +# define EXT2_FRAG_SIZE(s) ((s)->u.ext2_sb.s_frag_size)
  160. +# define EXT2_FRAGS_PER_BLOCK(s) ((s)->u.ext2_sb.s_frags_per_block)
  161. +#else
  162. +# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
  163. +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
  164. +#endif
  165. +
  166. +/*
  167. + * ACL structures
  168. + */
  169. +struct ext2_acl_header /* Header of Access Control Lists */
  170. +{
  171. + __u32 aclh_size;
  172. + __u32 aclh_file_count;
  173. + __u32 aclh_acle_count;
  174. + __u32 aclh_first_acle;
  175. +};
  176. +
  177. +struct ext2_acl_entry /* Access Control List Entry */
  178. +{
  179. + __u32 acle_size;
  180. + __u16 acle_perms; /* Access permissions */
  181. + __u16 acle_type; /* Type of entry */
  182. + __u16 acle_tag; /* User or group identity */
  183. + __u16 acle_pad1;
  184. + __u32 acle_next; /* Pointer on next entry for the */
  185. + /* same inode or on next free entry */
  186. +};
  187. +
  188. +/*
  189. + * Structure of a blocks group descriptor
  190. + */
  191. +struct ext2_group_desc
  192. +{
  193. + __u32 bg_block_bitmap; /* Blocks bitmap block */
  194. + __u32 bg_inode_bitmap; /* Inodes bitmap block */
  195. + __u32 bg_inode_table; /* Inodes table block */
  196. + __u16 bg_free_blocks_count; /* Free blocks count */
  197. + __u16 bg_free_inodes_count; /* Free inodes count */
  198. + __u16 bg_used_dirs_count; /* Directories count */
  199. + __u16 bg_pad;
  200. + __u32 bg_reserved[3];
  201. +};
  202. +
  203. +/*
  204. + * Macro-instructions used to manage group descriptors
  205. + */
  206. +#ifdef __KERNEL__
  207. +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->u.ext2_sb.s_blocks_per_group)
  208. +# define EXT2_DESC_PER_BLOCK(s) ((s)->u.ext2_sb.s_desc_per_block)
  209. +# define EXT2_INODES_PER_GROUP(s) ((s)->u.ext2_sb.s_inodes_per_group)
  210. +# define EXT2_DESC_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_desc_per_block_bits)
  211. +#else
  212. +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
  213. +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
  214. +# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
  215. +#endif
  216. +
  217. +/*
  218. + * Constants relative to the data blocks
  219. + */
  220. +#define EXT2_NDIR_BLOCKS 12
  221. +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
  222. +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
  223. +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
  224. +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
  225. +
  226. +/*
  227. + * Inode flags
  228. + */
  229. +#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */
  230. +#define EXT2_UNRM_FL 0x00000002 /* Undelete */
  231. +#define EXT2_COMPR_FL 0x00000004 /* Compress file */
  232. +#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */
  233. +#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */
  234. +#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */
  235. +#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */
  236. +#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */
  237. +/* Reserved for compression usage... */
  238. +#define EXT2_DIRTY_FL 0x00000100
  239. +#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
  240. +#define EXT2_NOCOMP_FL 0x00000400 /* Don't compress */
  241. +#define EXT2_ECOMPR_FL 0x00000800 /* Compression error */
  242. +/* End compression flags --- maybe not all used */
  243. +#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
  244. +#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
  245. +
  246. +#define EXT2_FL_USER_VISIBLE 0x00001FFF /* User visible flags */
  247. +#define EXT2_FL_USER_MODIFIABLE 0x000000FF /* User modifiable flags */
  248. +
  249. +/*
  250. + * ioctl commands
  251. + */
  252. +#define EXT2_IOC_GETFLAGS _IOR('f', 1, long)
  253. +#define EXT2_IOC_SETFLAGS _IOW('f', 2, long)
  254. +#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
  255. +#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
  256. +
  257. +/*
  258. + * Structure of an inode on the disk
  259. + */
  260. +struct ext2_inode {
  261. + __u16 i_mode; /* File mode */
  262. + __u16 i_uid; /* Low 16 bits of Owner Uid */
  263. + __u32 i_size; /* Size in bytes */
  264. + __u32 i_atime; /* Access time */
  265. + __u32 i_ctime; /* Creation time */
  266. + __u32 i_mtime; /* Modification time */
  267. + __u32 i_dtime; /* Deletion Time */
  268. + __u16 i_gid; /* Low 16 bits of Group Id */
  269. + __u16 i_links_count; /* Links count */
  270. + __u32 i_blocks; /* Blocks count */
  271. + __u32 i_flags; /* File flags */
  272. + union {
  273. + struct {
  274. + __u32 l_i_reserved1;
  275. + } linux1;
  276. + struct {
  277. + __u32 h_i_translator;
  278. + } hurd1;
  279. + struct {
  280. + __u32 m_i_reserved1;
  281. + } masix1;
  282. + } osd1; /* OS dependent 1 */
  283. + __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
  284. + __u32 i_generation; /* File version (for NFS) */
  285. + __u32 i_file_acl; /* File ACL */
  286. + __u32 i_dir_acl; /* Directory ACL */
  287. + __u32 i_faddr; /* Fragment address */
  288. + union {
  289. + struct {
  290. + __u8 l_i_frag; /* Fragment number */
  291. + __u8 l_i_fsize; /* Fragment size */
  292. + __u16 i_pad1;
  293. + __u16 l_i_uid_high; /* these 2 fields */
  294. + __u16 l_i_gid_high; /* were reserved2[0] */
  295. + __u32 l_i_reserved2;
  296. + } linux2;
  297. + struct {
  298. + __u8 h_i_frag; /* Fragment number */
  299. + __u8 h_i_fsize; /* Fragment size */
  300. + __u16 h_i_mode_high;
  301. + __u16 h_i_uid_high;
  302. + __u16 h_i_gid_high;
  303. + __u32 h_i_author;
  304. + } hurd2;
  305. + struct {
  306. + __u8 m_i_frag; /* Fragment number */
  307. + __u8 m_i_fsize; /* Fragment size */
  308. + __u16 m_pad1;
  309. + __u32 m_i_reserved2[2];
  310. + } masix2;
  311. + } osd2; /* OS dependent 2 */
  312. +};
  313. +
  314. +#define i_size_high i_dir_acl
  315. +
  316. +#if defined(__KERNEL__) || defined(__linux__)
  317. +#define i_reserved1 osd1.linux1.l_i_reserved1
  318. +#define i_frag osd2.linux2.l_i_frag
  319. +#define i_fsize osd2.linux2.l_i_fsize
  320. +#define i_uid_low i_uid
  321. +#define i_gid_low i_gid
  322. +#define i_uid_high osd2.linux2.l_i_uid_high
  323. +#define i_gid_high osd2.linux2.l_i_gid_high
  324. +#define i_reserved2 osd2.linux2.l_i_reserved2
  325. +#endif
  326. +
  327. +#ifdef __hurd__
  328. +#define i_translator osd1.hurd1.h_i_translator
  329. +#define i_frag osd2.hurd2.h_i_frag;
  330. +#define i_fsize osd2.hurd2.h_i_fsize;
  331. +#define i_uid_high osd2.hurd2.h_i_uid_high
  332. +#define i_gid_high osd2.hurd2.h_i_gid_high
  333. +#define i_author osd2.hurd2.h_i_author
  334. +#endif
  335. +
  336. +#ifdef __masix__
  337. +#define i_reserved1 osd1.masix1.m_i_reserved1
  338. +#define i_frag osd2.masix2.m_i_frag
  339. +#define i_fsize osd2.masix2.m_i_fsize
  340. +#define i_reserved2 osd2.masix2.m_i_reserved2
  341. +#endif
  342. +
  343. +/*
  344. + * File system states
  345. + */
  346. +#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
  347. +#define EXT2_ERROR_FS 0x0002 /* Errors detected */
  348. +
  349. +/*
  350. + * Mount flags
  351. + */
  352. +#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */
  353. +#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */
  354. +#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */
  355. +#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
  356. +#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
  357. +#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
  358. +#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
  359. +#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */
  360. +
  361. +#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
  362. +#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
  363. +#define test_opt(sb, opt) ((sb)->u.ext2_sb.s_mount_opt & \
  364. + EXT2_MOUNT_##opt)
  365. +/*
  366. + * Maximal mount counts between two filesystem checks
  367. + */
  368. +#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
  369. +#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
  370. +
  371. +/*
  372. + * Behaviour when detecting errors
  373. + */
  374. +#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
  375. +#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
  376. +#define EXT2_ERRORS_PANIC 3 /* Panic */
  377. +#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
  378. +
  379. +/*
  380. + * Structure of the super block
  381. + */
  382. +struct ext2_super_block {
  383. + __u32 s_inodes_count; /* Inodes count */
  384. + __u32 s_blocks_count; /* Blocks count */
  385. + __u32 s_r_blocks_count; /* Reserved blocks count */
  386. + __u32 s_free_blocks_count; /* Free blocks count */
  387. + __u32 s_free_inodes_count; /* Free inodes count */
  388. + __u32 s_first_data_block; /* First Data Block */
  389. + __u32 s_log_block_size; /* Block size */
  390. + __s32 s_log_frag_size; /* Fragment size */
  391. + __u32 s_blocks_per_group; /* # Blocks per group */
  392. + __u32 s_frags_per_group; /* # Fragments per group */
  393. + __u32 s_inodes_per_group; /* # Inodes per group */
  394. + __u32 s_mtime; /* Mount time */
  395. + __u32 s_wtime; /* Write time */
  396. + __u16 s_mnt_count; /* Mount count */
  397. + __s16 s_max_mnt_count; /* Maximal mount count */
  398. + __u16 s_magic; /* Magic signature */
  399. + __u16 s_state; /* File system state */
  400. + __u16 s_errors; /* Behaviour when detecting errors */
  401. + __u16 s_minor_rev_level; /* minor revision level */
  402. + __u32 s_lastcheck; /* time of last check */
  403. + __u32 s_checkinterval; /* max. time between checks */
  404. + __u32 s_creator_os; /* OS */
  405. + __u32 s_rev_level; /* Revision level */
  406. + __u16 s_def_resuid; /* Default uid for reserved blocks */
  407. + __u16 s_def_resgid; /* Default gid for reserved blocks */
  408. + /*
  409. + * These fields are for EXT2_DYNAMIC_REV superblocks only.
  410. + *
  411. + * Note: the difference between the compatible feature set and
  412. + * the incompatible feature set is that if there is a bit set
  413. + * in the incompatible feature set that the kernel doesn't
  414. + * know about, it should refuse to mount the filesystem.
  415. + *
  416. + * e2fsck's requirements are more strict; if it doesn't know
  417. + * about a feature in either the compatible or incompatible
  418. + * feature set, it must abort and not try to meddle with
  419. + * things it doesn't understand...
  420. + */
  421. + __u32 s_first_ino; /* First non-reserved inode */
  422. + __u16 s_inode_size; /* size of inode structure */
  423. + __u16 s_block_group_nr; /* block group # of this superblock */
  424. + __u32 s_feature_compat; /* compatible feature set */
  425. + __u32 s_feature_incompat; /* incompatible feature set */
  426. + __u32 s_feature_ro_compat; /* readonly-compatible feature set */
  427. + __u8 s_uuid[16]; /* 128-bit uuid for volume */
  428. + char s_volume_name[16]; /* volume name */
  429. + char s_last_mounted[64]; /* directory where last mounted */
  430. + __u32 s_algorithm_usage_bitmap; /* For compression */
  431. + /*
  432. + * Performance hints. Directory preallocation should only
  433. + * happen if the EXT2_COMPAT_PREALLOC flag is on.
  434. + */
  435. + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
  436. + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
  437. + __u16 s_padding1;
  438. + /*
  439. + * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
  440. + */
  441. + __u8 s_journal_uuid[16]; /* uuid of journal superblock */
  442. + __u32 s_journal_inum; /* inode number of journal file */
  443. + __u32 s_journal_dev; /* device number of journal file */
  444. + __u32 s_last_orphan; /* start of list of inodes to delete */
  445. + __u32 s_hash_seed[4]; /* HTREE hash seed */
  446. + __u8 s_def_hash_version; /* Default hash version to use */
  447. + __u8 s_reserved_char_pad;
  448. + __u16 s_reserved_word_pad;
  449. + __u32 s_default_mount_opts;
  450. + __u32 s_first_meta_bg; /* First metablock block group */
  451. + __u32 s_reserved[190]; /* Padding to the end of the block */
  452. +};
  453. +
  454. +#ifdef __KERNEL__
  455. +#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
  456. +#else
  457. +/* Assume that user mode programs are passing in an ext2fs superblock, not
  458. + * a kernel struct super_block. This will allow us to call the feature-test
  459. + * macros from user land. */
  460. +#define EXT2_SB(sb) (sb)
  461. +#endif
  462. +
  463. +/*
  464. + * Codes for operating systems
  465. + */
  466. +#define EXT2_OS_LINUX 0
  467. +#define EXT2_OS_HURD 1
  468. +#define EXT2_OS_MASIX 2
  469. +#define EXT2_OS_FREEBSD 3
  470. +#define EXT2_OS_LITES 4
  471. +
  472. +/*
  473. + * Revision levels
  474. + */
  475. +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
  476. +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
  477. +
  478. +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
  479. +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
  480. +
  481. +#define EXT2_GOOD_OLD_INODE_SIZE 128
  482. +
  483. +/*
  484. + * Feature set definitions
  485. + */
  486. +
  487. +#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
  488. + ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
  489. +#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
  490. + ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
  491. +#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
  492. + ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
  493. +#define EXT2_SET_COMPAT_FEATURE(sb,mask) \
  494. + EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
  495. +#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \
  496. + EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
  497. +#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \
  498. + EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
  499. +#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \
  500. + EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
  501. +#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
  502. + EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
  503. +#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
  504. + EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
  505. +
  506. +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
  507. +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
  508. +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
  509. +#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
  510. +#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
  511. +#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
  512. +#define EXT2_FEATURE_COMPAT_ANY 0xffffffff
  513. +
  514. +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
  515. +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
  516. +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
  517. +#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff
  518. +
  519. +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
  520. +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
  521. +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
  522. +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
  523. +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
  524. +#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
  525. +
  526. +#define EXT2_FEATURE_COMPAT_SUPP 0
  527. +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
  528. + EXT2_FEATURE_INCOMPAT_META_BG)
  529. +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
  530. + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
  531. + EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
  532. +#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
  533. +#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
  534. +
  535. +/*
  536. + * Default mount options
  537. + */
  538. +#define EXT2_DEFM_DEBUG 0x0001
  539. +#define EXT2_DEFM_BSDGROUPS 0x0002
  540. +#define EXT2_DEFM_XATTR_USER 0x0004
  541. +#define EXT2_DEFM_ACL 0x0008
  542. +#define EXT2_DEFM_UID16 0x0010
  543. + /* Not used by ext2, but reserved for use by ext3 */
  544. +#define EXT3_DEFM_JMODE 0x0060
  545. +#define EXT3_DEFM_JMODE_DATA 0x0020
  546. +#define EXT3_DEFM_JMODE_ORDERED 0x0040
  547. +#define EXT3_DEFM_JMODE_WBACK 0x0060
  548. +
  549. +#define EXT2_DEF_RESUID 0
  550. +#define EXT2_DEF_RESGID 0
  551. +
  552. +/*
  553. + * Structure of a directory entry
  554. + */
  555. +#define EXT2_NAME_LEN 255
  556. +
  557. +struct ext2_dir_entry {
  558. + __u32 inode; /* Inode number */
  559. + __u16 rec_len; /* Directory entry length */
  560. + __u16 name_len; /* Name length */
  561. + char name[EXT2_NAME_LEN]; /* File name */
  562. +};
  563. +
  564. +/*
  565. + * The new version of the directory entry. Since EXT2 structures are
  566. + * stored in intel byte order, and the name_len field could never be
  567. + * bigger than 255 chars, it's safe to reclaim the extra byte for the
  568. + * file_type field.
  569. + */
  570. +struct ext2_dir_entry_2 {
  571. + __u32 inode; /* Inode number */
  572. + __u16 rec_len; /* Directory entry length */
  573. + __u8 name_len; /* Name length */
  574. + __u8 file_type;
  575. + char name[EXT2_NAME_LEN]; /* File name */
  576. +};
  577. +
  578. +/*
  579. + * Ext2 directory file types. Only the low 3 bits are used. The
  580. + * other bits are reserved for now.
  581. + */
  582. +enum {
  583. + EXT2_FT_UNKNOWN,
  584. + EXT2_FT_REG_FILE,
  585. + EXT2_FT_DIR,
  586. + EXT2_FT_CHRDEV,
  587. + EXT2_FT_BLKDEV,
  588. + EXT2_FT_FIFO,
  589. + EXT2_FT_SOCK,
  590. + EXT2_FT_SYMLINK,
  591. + EXT2_FT_MAX
  592. +};
  593. +
  594. +/*
  595. + * EXT2_DIR_PAD defines the directory entries boundaries
  596. + *
  597. + * NOTE: It must be a multiple of 4
  598. + */
  599. +#define EXT2_DIR_PAD 4
  600. +#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
  601. +#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
  602. + ~EXT2_DIR_ROUND)
  603. +
  604. +#ifdef __KERNEL__
  605. +/*
  606. + * Function prototypes
  607. + */
  608. +
  609. +/*
  610. + * Ok, these declarations are also in <linux/kernel.h> but none of the
  611. + * ext2 source programs needs to include it so they are duplicated here.
  612. + */
  613. +# define NORET_TYPE /**/
  614. +# define ATTRIB_NORET __attribute__((noreturn))
  615. +# define NORET_AND noreturn,
  616. +
  617. +/* balloc.c */
  618. +extern int ext2_bg_has_super(struct super_block *sb, int group);
  619. +extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
  620. +extern int ext2_new_block (struct inode *, unsigned long,
  621. + __u32 *, __u32 *, int *);
  622. +extern void ext2_free_blocks (struct inode *, unsigned long,
  623. + unsigned long);
  624. +extern unsigned long ext2_count_free_blocks (struct super_block *);
  625. +extern void ext2_check_blocks_bitmap (struct super_block *);
  626. +extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
  627. + unsigned int block_group,
  628. + struct buffer_head ** bh);
  629. +
  630. +/* dir.c */
  631. +extern int ext2_add_link (struct dentry *, struct inode *);
  632. +extern ino_t ext2_inode_by_name(struct inode *, struct dentry *);
  633. +extern int ext2_make_empty(struct inode *, struct inode *);
  634. +extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,struct dentry *, struct page **);
  635. +extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
  636. +extern int ext2_empty_dir (struct inode *);
  637. +extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
  638. +extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *);
  639. +
  640. +/* fsync.c */
  641. +extern int ext2_sync_file (struct file *, struct dentry *, int);
  642. +extern int ext2_fsync_inode (struct inode *, int);
  643. +
  644. +/* ialloc.c */
  645. +extern struct inode * ext2_new_inode (const struct inode *, int);
  646. +extern void ext2_free_inode (struct inode *);
  647. +extern unsigned long ext2_count_free_inodes (struct super_block *);
  648. +extern void ext2_check_inodes_bitmap (struct super_block *);
  649. +extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
  650. +
  651. +/* inode.c */
  652. +extern void ext2_read_inode (struct inode *);
  653. +extern void ext2_write_inode (struct inode *, int);
  654. +extern void ext2_put_inode (struct inode *);
  655. +extern void ext2_delete_inode (struct inode *);
  656. +extern int ext2_sync_inode (struct inode *);
  657. +extern void ext2_discard_prealloc (struct inode *);
  658. +extern void ext2_truncate (struct inode *);
  659. +extern void ext2_set_inode_flags(struct inode *inode);
  660. +
  661. +/* ioctl.c */
  662. +extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
  663. + unsigned long);
  664. +
  665. +/* super.c */
  666. +extern void ext2_error (struct super_block *, const char *, const char *, ...)
  667. + __attribute__ ((format (printf, 3, 4)));
  668. +extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
  669. + const char *, ...)
  670. + __attribute__ ((NORET_AND format (printf, 3, 4)));
  671. +extern void ext2_warning (struct super_block *, const char *, const char *, ...)
  672. + __attribute__ ((format (printf, 3, 4)));
  673. +extern void ext2_update_dynamic_rev (struct super_block *sb);
  674. +extern void ext2_put_super (struct super_block *);
  675. +extern void ext2_write_super (struct super_block *);
  676. +extern int ext2_remount (struct super_block *, int *, char *);
  677. +extern struct super_block * ext2_read_super (struct super_block *,void *,int);
  678. +extern int ext2_statfs (struct super_block *, struct statfs *);
  679. +
  680. +/*
  681. + * Inodes and files operations
  682. + */
  683. +
  684. +/* dir.c */
  685. +extern struct file_operations ext2_dir_operations;
  686. +
  687. +/* file.c */
  688. +extern struct inode_operations ext2_file_inode_operations;
  689. +extern struct file_operations ext2_file_operations;
  690. +
  691. +/* inode.c */
  692. +extern struct address_space_operations ext2_aops;
  693. +
  694. +/* namei.c */
  695. +extern struct inode_operations ext2_dir_inode_operations;
  696. +
  697. +/* symlink.c */
  698. +extern struct inode_operations ext2_fast_symlink_inode_operations;
  699. +
  700. +#endif /* __KERNEL__ */
  701. +
  702. +#endif /* _LINUX_EXT2_FS_H */