aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fsck_minix.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/fsck_minix.c')
-rw-r--r--util-linux/fsck_minix.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 1d3e90aa8..d7d81f130 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -98,26 +98,8 @@
98#include <sys/param.h> 98#include <sys/param.h>
99#include "busybox.h" 99#include "busybox.h"
100 100
101static const int MINIX_ROOT_INO = 1; 101#define BLOCK_SIZE_BITS 10
102static const int MINIX_LINK_MAX = 250; 102#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
103static const int MINIX2_LINK_MAX = 65530;
104
105static const int MINIX_I_MAP_SLOTS = 8;
106static const int MINIX_Z_MAP_SLOTS = 64;
107static const int MINIX_SUPER_MAGIC = 0x137F; /* original minix fs */
108static const int MINIX_SUPER_MAGIC2 = 0x138F; /* minix fs, 30 char names */
109static const int MINIX2_SUPER_MAGIC = 0x2468; /* minix V2 fs */
110static const int MINIX2_SUPER_MAGIC2 = 0x2478; /* minix V2 fs, 30 char names */
111static const int MINIX_VALID_FS = 0x0001; /* Clean fs. */
112static const int MINIX_ERROR_FS = 0x0002; /* fs has errors. */
113
114#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
115#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
116
117static const int MINIX_V1 = 0x0001; /* original minix fs */
118static const int MINIX_V2 = 0x0002; /* minix V2 fs */
119
120#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
121 103
122/* 104/*
123 * This is the original minix inode layout on disk. 105 * This is the original minix inode layout on disk.
@@ -151,6 +133,29 @@ struct minix2_inode {
151 uint32_t i_zone[10]; 133 uint32_t i_zone[10];
152}; 134};
153 135
136enum {
137 MINIX_ROOT_INO = 1,
138 MINIX_LINK_MAX = 250,
139 MINIX2_LINK_MAX = 65530,
140
141 MINIX_I_MAP_SLOTS = 8,
142 MINIX_Z_MAP_SLOTS = 64,
143 MINIX_SUPER_MAGIC = 0x137F, /* original minix fs */
144 MINIX_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */
145 MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */
146 MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */
147 MINIX_VALID_FS = 0x0001, /* Clean fs. */
148 MINIX_ERROR_FS = 0x0002, /* fs has errors. */
149
150 MINIX_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix_inode))),
151 MINIX2_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix2_inode))),
152
153 MINIX_V1 = 0x0001, /* original minix fs */
154 MINIX_V2 = 0x0002 /* minix V2 fs */
155};
156
157#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
158
154/* 159/*
155 * minix super-block data on disk 160 * minix super-block data on disk
156 */ 161 */
@@ -172,8 +177,6 @@ struct minix_dir_entry {
172 char name[0]; 177 char name[0];
173}; 178};
174 179
175#define BLOCK_SIZE_BITS 10
176#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
177 180
178#define NAME_MAX 255 /* # chars in a file name */ 181#define NAME_MAX 255 /* # chars in a file name */
179 182
@@ -187,7 +190,7 @@ struct minix_dir_entry {
187#define volatile 190#define volatile
188#endif 191#endif
189 192
190static const int ROOT_INO = 1; 193enum { ROOT_INO = 1 };
191 194
192#define UPPER(size,n) ((size+((n)-1))/(n)) 195#define UPPER(size,n) ((size+((n)-1))/(n))
193#define INODE_SIZE (sizeof(struct minix_inode)) 196#define INODE_SIZE (sizeof(struct minix_inode))
@@ -219,7 +222,7 @@ static struct termios termios;
219static int termios_set = 0; 222static int termios_set = 0;
220 223
221/* File-name data */ 224/* File-name data */
222static const int MAX_DEPTH = 32; 225enum { MAX_DEPTH = 32 };
223static int name_depth = 0; 226static int name_depth = 0;
224// static char name_list[MAX_DEPTH][BUFSIZ + 1]; 227// static char name_list[MAX_DEPTH][BUFSIZ + 1];
225static char **name_list = NULL; 228static char **name_list = NULL;