minix: cleanup global variables and macros

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2011-07-21 12:13:33 +02:00
parent e844147d17
commit 058cda4c1d
4 changed files with 39 additions and 22 deletions

View File

@ -111,6 +111,21 @@
#define ROOT_INO 1 #define ROOT_INO 1
/*
* Global variables used in minix_programs.h inline fuctions
*/
int fs_version = 1;
char *super_block_buffer;
static char *inode_buffer = NULL;
#define Inode (((struct minix_inode *) inode_buffer) - 1)
#define Inode2 (((struct minix2_inode *) inode_buffer) - 1)
static char *inode_map;
static char *zone_map;
static char * program_name = "fsck.minix"; static char * program_name = "fsck.minix";
static char * device_name = NULL; static char * device_name = NULL;
static int IN; static int IN;

View File

@ -6,13 +6,18 @@
/* /*
* Global variables. * Global variables.
*/ */
static int fs_version = 1; /* this default value needs to change in a near future */ extern int fs_version;
extern char *super_block_buffer;
static char *super_block_buffer; #define Super (*(struct minix_super_block *) super_block_buffer)
static char *inode_buffer = NULL; #define Super3 (*(struct minix3_super_block *) super_block_buffer)
static char *inode_map; #define INODE_SIZE (sizeof(struct minix_inode))
static char *zone_map; #define INODE2_SIZE (sizeof(struct minix2_inode))
#define BITS_PER_BLOCK (MINIX_BLOCK_SIZE << 3)
#define UPPER(size,n) ((size+((n)-1))/(n))
/* /*
* Inline functions. * Inline functions.

View File

@ -94,6 +94,20 @@
#define MAX_INODES 65535 #define MAX_INODES 65535
/*
* Global variables used in minix_programs.h inline fuctions
*/
int fs_version = 1;
char *super_block_buffer;
static char *inode_buffer = NULL;
#define Inode (((struct minix_inode *) inode_buffer) - 1)
#define Inode2 (((struct minix2_inode *) inode_buffer) - 1)
static char *inode_map;
static char *zone_map;
static char * program_name = "mkfs"; static char * program_name = "mkfs";
static char * device_name = NULL; static char * device_name = NULL;
static int DEV = -1; static int DEV = -1;
@ -115,7 +129,6 @@ static int version2 = 0;
static char root_block[MINIX_BLOCK_SIZE] = "\0"; static char root_block[MINIX_BLOCK_SIZE] = "\0";
static char boot_block_buffer[512]; static char boot_block_buffer[512];
#define Super (*(struct minix_super_block *)super_block_buffer)
static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; static unsigned short good_blocks_table[MAX_GOOD_BLOCKS];
static int used_good_blocks = 0; static int used_good_blocks = 0;

View File

@ -78,20 +78,4 @@ struct minix3_super_block {
#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ #define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs (60 char names) */ #define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs (60 char names) */
#define Inode (((struct minix_inode *) inode_buffer)-1)
#define Inode2 (((struct minix2_inode *) inode_buffer)-1)
#define INODE_SIZE (sizeof(struct minix_inode))
#define INODE2_SIZE (sizeof(struct minix2_inode))
#define BITS_PER_BLOCK (MINIX_BLOCK_SIZE<<3)
#define UPPER(size,n) ((size+((n)-1))/(n))
/*
* wrappers to different superblock attributes
*/
#define Super (*(struct minix_super_block *)super_block_buffer)
#define Super3 (*(struct minix3_super_block *)super_block_buffer)
#endif /* UTIL_LINUX_MINIX_H */ #endif /* UTIL_LINUX_MINIX_H */