aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_minix.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 00:43:19 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 00:43:19 +0000
commitaa95959cb81b72d37ce1f20606f97e064bbd2bfe (patch)
treecdc5e820c8363c08e6950d2ebae5dae904b4d2ee /util-linux/mkfs_minix.c
parent6dd392a2520ee226d8f8535c449454f4ed5a08a5 (diff)
downloadbusybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.tar.gz
busybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.tar.bz2
busybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.zip
factor out minix structures/constants into minix.h
fsck_minix: optimizations
Diffstat (limited to 'util-linux/mkfs_minix.c')
-rw-r--r--util-linux/mkfs_minix.c75
1 files changed, 2 insertions, 73 deletions
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 89874b6b8..e66ef7e17 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -65,6 +65,8 @@
65#include "busybox.h" 65#include "busybox.h"
66#include <mntent.h> 66#include <mntent.h>
67 67
68#include "minix.h"
69
68#define DEBUG 0 70#define DEBUG 0
69 71
70/* If debugging, store the very same times/uids/gids for image consistency */ 72/* If debugging, store the very same times/uids/gids for image consistency */
@@ -78,81 +80,8 @@
78# define GETGID getgid() 80# define GETGID getgid()
79#endif 81#endif
80 82
81/*
82 * This is the original minix inode layout on disk.
83 * Note the 8-bit gid and atime and ctime.
84 */
85struct minix1_inode {
86 uint16_t i_mode;
87 uint16_t i_uid;
88 uint32_t i_size;
89 uint32_t i_time;
90 uint8_t i_gid;
91 uint8_t i_nlinks;
92 uint16_t i_zone[9];
93};
94
95/*
96 * The new minix inode has all the time entries, as well as
97 * long block numbers and a third indirect block (7+1+1+1
98 * instead of 7+1+1). Also, some previously 8-bit values are
99 * now 16-bit. The inode is now 64 bytes instead of 32.
100 */
101struct minix2_inode {
102 uint16_t i_mode;
103 uint16_t i_nlinks;
104 uint16_t i_uid;
105 uint16_t i_gid;
106 uint32_t i_size;
107 uint32_t i_atime;
108 uint32_t i_mtime;
109 uint32_t i_ctime;
110 uint32_t i_zone[10];
111};
112
113/*
114 * minix super-block data on disk
115 */
116struct minix_super_block {
117 uint16_t s_ninodes;
118 uint16_t s_nzones;
119 uint16_t s_imap_blocks;
120 uint16_t s_zmap_blocks;
121 uint16_t s_firstdatazone;
122 uint16_t s_log_zone_size;
123 uint32_t s_max_size;
124 uint16_t s_magic;
125 uint16_t s_state;
126 uint32_t s_zones;
127};
128
129struct minix_dir_entry {
130 uint16_t inode;
131 char name[0];
132};
133
134/* Believe it or not, but mount.h has this one */
135#undef BLOCK_SIZE
136enum { 83enum {
137 BLOCK_SIZE = 1024,
138 BITS_PER_BLOCK = BLOCK_SIZE << 3,
139
140 MINIX_ROOT_INO = 1,
141 MINIX_BAD_INO = 2,
142 MAX_GOOD_BLOCKS = 512, 84 MAX_GOOD_BLOCKS = 512,
143
144 MINIX1_SUPER_MAGIC = 0x137F, /* original minix fs */
145 MINIX1_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */
146 MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */
147 MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */
148 MINIX_VALID_FS = 0x0001, /* clean fs */
149 MINIX_ERROR_FS = 0x0002, /* fs has errors */
150
151 INODE_SIZE1 = sizeof(struct minix1_inode),
152 INODE_SIZE2 = sizeof(struct minix2_inode),
153 MINIX1_INODES_PER_BLOCK = BLOCK_SIZE / sizeof(struct minix1_inode),
154 MINIX2_INODES_PER_BLOCK = BLOCK_SIZE / sizeof(struct minix2_inode),
155
156 TEST_BUFFER_BLOCKS = 16, 85 TEST_BUFFER_BLOCKS = 16,
157}; 86};
158 87