#include <sys/param.h>
#include "busybox.h"
-
- typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-
-
static const int MINIX_ROOT_INO = 1;
static const int MINIX_LINK_MAX = 250;
static const int MINIX2_LINK_MAX = 65530;
* Note the 8-bit gid and atime and ctime.
*/
struct minix_inode {
- u16 i_mode;
- u16 i_uid;
- u32 i_size;
- u32 i_time;
- u8 i_gid;
- u8 i_nlinks;
- u16 i_zone[9];
+ u_int16_t i_mode;
+ u_int16_t i_uid;
+ u_int32_t i_size;
+ u_int32_t i_time;
+ u_int8_t i_gid;
+ u_int8_t i_nlinks;
+ u_int16_t i_zone[9];
};
/*
* now 16-bit. The inode is now 64 bytes instead of 32.
*/
struct minix2_inode {
- u16 i_mode;
- u16 i_nlinks;
- u16 i_uid;
- u16 i_gid;
- u32 i_size;
- u32 i_atime;
- u32 i_mtime;
- u32 i_ctime;
- u32 i_zone[10];
+ u_int16_t i_mode;
+ u_int16_t i_nlinks;
+ u_int16_t i_uid;
+ u_int16_t i_gid;
+ u_int32_t i_size;
+ u_int32_t i_atime;
+ u_int32_t i_mtime;
+ u_int32_t i_ctime;
+ u_int32_t i_zone[10];
};
/*
* minix super-block data on disk
*/
struct minix_super_block {
- u16 s_ninodes;
- u16 s_nzones;
- u16 s_imap_blocks;
- u16 s_zmap_blocks;
- u16 s_firstdatazone;
- u16 s_log_zone_size;
- u32 s_max_size;
- u16 s_magic;
- u16 s_state;
- u32 s_zones;
+ u_int16_t s_ninodes;
+ u_int16_t s_nzones;
+ u_int16_t s_imap_blocks;
+ u_int16_t s_zmap_blocks;
+ u_int16_t s_firstdatazone;
+ u_int16_t s_log_zone_size;
+ u_int32_t s_max_size;
+ u_int16_t s_magic;
+ u_int16_t s_state;
+ u_int32_t s_zones;
};
struct minix_dir_entry {
- u16 inode;
+ u_int16_t inode;
char name[0];
};
#define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct minix_inode))
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_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 BB_FEATURE_MINIX2
+#ifdef CONFIG_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
+#ifdef CONFIG_FEATURE_MINIX2
static void recursive_check2(unsigned int ino);
#endif
return 0;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static int check_zone_nr2(unsigned int *nr, int *corrected)
{
if (!*nr)
return result;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_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;
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
if (version2)
block = Inode2[ROOT_INO].i_zone[0];
else
namelen = 30;
dirsize = 32;
version2 = 0;
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
} else if (MAGIC == MINIX2_SUPER_MAGIC) {
namelen = 14;
dirsize = 16;
return inode;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static struct minix2_inode *get_inode2(unsigned int nr)
{
struct minix2_inode *inode;
die("root inode isn't a directory");
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void check_root2(void)
{
struct minix2_inode *inode = Inode2 + ROOT_INO;
return block;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static int add_zone2(unsigned int *znr, int *corrected)
{
int result;
write_block(block, blk);
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void add_zone_ind2(unsigned int *znr, int *corrected)
{
static char blk[BLOCK_SIZE];
write_block(block, blk);
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_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 BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void check_zones2(unsigned int i)
{
struct minix2_inode *inode;
return;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void check_file2(struct minix2_inode *dir, unsigned int offset)
{
static char blk[BLOCK_SIZE];
check_file(dir, offset);
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void recursive_check2(unsigned int ino)
{
struct minix2_inode *dir;
}
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void check_counts2(void)
{
int i;
check_counts();
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
static void check2(void)
{
memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count));
name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
}
-#ifdef BB_FEATURE_CLEAN_UP
+#ifdef CONFIG_FEATURE_CLEAN_UP
/* execute this atexit() to deallocate name_list[] */
/* piptigger was here */
static void free_name_list(void)
int retcode = 0;
alloc_name_list();
-#ifdef BB_FEATURE_CLEAN_UP
+#ifdef CONFIG_FEATURE_CLEAN_UP
/* Don't bother to free memory. Exit does
* that automagically, so we can save a few bytes */
atexit(free_name_list);
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad v2 inode size");
#endif
tcsetattr(0, TCSANOW, &tmp);
termios_set = 1;
}
-#ifdef BB_FEATURE_MINIX2
+#ifdef CONFIG_FEATURE_MINIX2
if (version2) {
check_root2();
check2();