is to be supported.
// Support module version checking
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
//
+// Support for Minix filesystem, version 2
+//#define BB_FEATURE_MINIX2
+//
//
// Enable busybox --install [-s]
// to create links (or symlinks) for all the commands that are
#define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif
-#ifdef MINIX2_SUPER_MAGIC2
-#define HAVE_MINIX2 1
-#endif
-
#ifndef __linux__
#define volatile
#endif
#define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode))
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define INODE_SIZE2 (sizeof(struct minix2_inode))
#define INODE_BLOCKS UPPER(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \
: MINIX_INODES_PER_BLOCK))
#define Super (*(struct minix_super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones))
#else
#define ZONES ((unsigned long)(Super.s_nzones))
static unsigned char *zone_count = NULL;
static void recursive_check(unsigned int ino);
+#ifdef BB_FEATURE_MINIX2
static void recursive_check2(unsigned int ino);
+#endif
#define inode_in_use(x) (isset(inode_map,(x)))
#define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1))
return 0;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int check_zone_nr2(unsigned int *nr, int *corrected)
{
if (!*nr)
return result;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int map_block2(struct minix2_inode *inode, unsigned int blknr)
{
unsigned int ind[BLOCK_SIZE >> 2];
char blk[BLOCK_SIZE];
int size;
-#if HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2)
block = Inode2[ROOT_INO].i_zone[0];
else
namelen = 30;
dirsize = 32;
version2 = 0;
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
} else if (MAGIC == MINIX2_SUPER_MAGIC) {
namelen = 14;
dirsize = 16;
return inode;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
struct minix2_inode *get_inode2(unsigned int nr)
{
struct minix2_inode *inode;
die("root inode isn't a directory");
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_root2(void)
{
struct minix2_inode *inode = Inode2 + ROOT_INO;
return block;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int add_zone2(unsigned int *znr, int *corrected)
{
int result;
write_block(block, blk);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void add_zone_ind2(unsigned int *znr, int *corrected)
{
static char blk[BLOCK_SIZE];
write_block(block, blk);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void add_zone_dind2(unsigned int *znr, int *corrected)
{
static char blk[BLOCK_SIZE];
add_zone_dind(8 + inode->i_zone, &changed);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_zones2(unsigned int i)
{
struct minix2_inode *inode;
return;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_file2(struct minix2_inode *dir, unsigned int offset)
{
static char blk[BLOCK_SIZE];
check_file(dir, offset);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void recursive_check2(unsigned int ino)
{
struct minix2_inode *dir;
}
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_counts2(void)
{
int i;
check_counts();
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check2(void)
{
memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count));
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad v2 inode size");
#endif
tcsetattr(0, TCSANOW, &tmp);
termios_set = 1;
}
-#if HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
check_root2();
check2();
#endif
-#ifdef MINIX2_SUPER_MAGIC2
-#define HAVE_MINIX2 1
-#endif
-
#ifndef __linux__
#define volatile
#endif
#define UPPER(size,n) (((size)+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode))
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define INODE_SIZE2 (sizeof(struct minix2_inode))
#define INODE_BLOCKS UPPER(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \
: MINIX_INODES_PER_BLOCK))
static char *inode_buffer = NULL;
#define Inode (((struct minix_inode *) inode_buffer)-1)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define Inode2 (((struct minix2_inode *) inode_buffer)-1)
#endif
static char super_block_buffer[BLOCK_SIZE];
#define Super (*(struct minix_super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones))
#else
#define ZONES ((unsigned long)(Super.s_nzones))
write_block(dind, (char *) dind_block);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void make_bad_inode2(void)
{
struct minix2_inode *inode = &Inode2[MINIX_BAD_INO];
write_block(inode->i_zone[0], root_block);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void make_root_inode2(void)
{
struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO];
else
inodes = req_nr_inodes;
/* Round up inode count to fill block size */
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2)
inodes = ((inodes + MINIX2_INODES_PER_BLOCK - 1) &
~(MINIX2_INODES_PER_BLOCK - 1));
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#endif
break;
}
case 'v':
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
version2 = 1;
#else
errorMsg("%s: not compiled with minix v2 support\n",
if (!device_name || BLOCKS < 10) {
show_usage();
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
if (namelen == 14)
magic = MINIX2_SUPER_MAGIC;
check_blocks();
else if (listfile)
get_list_blocks(listfile);
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
make_root_inode2();
make_bad_inode2();
#define BLKGETSIZE _IO(0x12,96) /* return device size */
#endif
-#ifdef MINIX2_SUPER_MAGIC2
-#define HAVE_MINIX2 1
-#endif
-
#ifndef __linux__
#define volatile
#endif
#define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode))
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define INODE_SIZE2 (sizeof(struct minix2_inode))
#define INODE_BLOCKS UPPER(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \
: MINIX_INODES_PER_BLOCK))
#define Super (*(struct minix_super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones))
#else
#define ZONES ((unsigned long)(Super.s_nzones))
static unsigned char *zone_count = NULL;
static void recursive_check(unsigned int ino);
+#ifdef BB_FEATURE_MINIX2
static void recursive_check2(unsigned int ino);
+#endif
#define inode_in_use(x) (isset(inode_map,(x)))
#define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1))
return 0;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int check_zone_nr2(unsigned int *nr, int *corrected)
{
if (!*nr)
return result;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int map_block2(struct minix2_inode *inode, unsigned int blknr)
{
unsigned int ind[BLOCK_SIZE >> 2];
char blk[BLOCK_SIZE];
int size;
-#if HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2)
block = Inode2[ROOT_INO].i_zone[0];
else
namelen = 30;
dirsize = 32;
version2 = 0;
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
} else if (MAGIC == MINIX2_SUPER_MAGIC) {
namelen = 14;
dirsize = 16;
return inode;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
struct minix2_inode *get_inode2(unsigned int nr)
{
struct minix2_inode *inode;
die("root inode isn't a directory");
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_root2(void)
{
struct minix2_inode *inode = Inode2 + ROOT_INO;
return block;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static int add_zone2(unsigned int *znr, int *corrected)
{
int result;
write_block(block, blk);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void add_zone_ind2(unsigned int *znr, int *corrected)
{
static char blk[BLOCK_SIZE];
write_block(block, blk);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void add_zone_dind2(unsigned int *znr, int *corrected)
{
static char blk[BLOCK_SIZE];
add_zone_dind(8 + inode->i_zone, &changed);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_zones2(unsigned int i)
{
struct minix2_inode *inode;
return;
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_file2(struct minix2_inode *dir, unsigned int offset)
{
static char blk[BLOCK_SIZE];
check_file(dir, offset);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void recursive_check2(unsigned int ino)
{
struct minix2_inode *dir;
}
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check_counts2(void)
{
int i;
check_counts();
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void check2(void)
{
memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count));
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad v2 inode size");
#endif
tcsetattr(0, TCSANOW, &tmp);
termios_set = 1;
}
-#if HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
check_root2();
check2();
#endif
-#ifdef MINIX2_SUPER_MAGIC2
-#define HAVE_MINIX2 1
-#endif
-
#ifndef __linux__
#define volatile
#endif
#define UPPER(size,n) (((size)+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode))
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define INODE_SIZE2 (sizeof(struct minix2_inode))
#define INODE_BLOCKS UPPER(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \
: MINIX_INODES_PER_BLOCK))
static char *inode_buffer = NULL;
#define Inode (((struct minix_inode *) inode_buffer)-1)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define Inode2 (((struct minix2_inode *) inode_buffer)-1)
#endif
static char super_block_buffer[BLOCK_SIZE];
#define Super (*(struct minix_super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
#define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones))
#else
#define ZONES ((unsigned long)(Super.s_nzones))
write_block(dind, (char *) dind_block);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void make_bad_inode2(void)
{
struct minix2_inode *inode = &Inode2[MINIX_BAD_INO];
write_block(inode->i_zone[0], root_block);
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
static void make_root_inode2(void)
{
struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO];
else
inodes = req_nr_inodes;
/* Round up inode count to fill block size */
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2)
inodes = ((inodes + MINIX2_INODES_PER_BLOCK - 1) &
~(MINIX2_INODES_PER_BLOCK - 1));
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
#endif
break;
}
case 'v':
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
version2 = 1;
#else
errorMsg("%s: not compiled with minix v2 support\n",
if (!device_name || BLOCKS < 10) {
show_usage();
}
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
if (namelen == 14)
magic = MINIX2_SUPER_MAGIC;
check_blocks();
else if (listfile)
get_list_blocks(listfile);
-#ifdef HAVE_MINIX2
+#ifdef BB_FEATURE_MINIX2
if (version2) {
make_root_inode2();
make_bad_inode2();