Make cin be static
[oweals/busybox.git] / mkfs_minix.c
index 1bbccd978ad02cded8518b3f5ed7663aef5224c0..e1ede6caa3357ba3c8ec4920aceb39498d5f7677 100644 (file)
@@ -62,7 +62,7 @@
  *     removed getopt based parser and added a hand rolled one.
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
@@ -242,8 +242,12 @@ static unsigned short good_blocks_table[MAX_GOOD_BLOCKS];
 static int used_good_blocks = 0;
 static unsigned long req_nr_inodes = 0;
 
-#define inode_in_use(x) (isset(inode_map,(x)))
-#define zone_in_use(x) (isset(zone_map,(x)-FIRSTZONE+1))
+static inline int bit(char * a,unsigned int i)
+{
+         return (a[i >> 3] & (1<<(i & 7))) != 0;
+}
+#define inode_in_use(x) (bit(inode_map,(x)))
+#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1))
 
 #define mark_inode(x) (setbit(inode_map,(x)))
 #define unmark_inode(x) (clrbit(inode_map,(x)))
@@ -258,7 +262,7 @@ static unsigned long req_nr_inodes = 0;
  */
 static volatile void die(char *str)
 {
-       errorMsg("%s\n", str);
+       error_msg("%s\n", str);
        exit(8);
 }
 
@@ -325,11 +329,8 @@ static int get_size(const char *file)
        int fd;
        long size;
 
-       fd = open(file, O_RDWR);
-       if (fd < 0) {
-               perror(file);
-               exit(1);
-       }
+       if ((fd = open(file, O_RDWR)) < 0)
+               perror_msg_and_die("%s", file);
        if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
                close(fd);
                return (size * 512);
@@ -792,7 +793,7 @@ extern int mkfs_minix_main(int argc, char **argv)
 #ifdef BB_FEATURE_MINIX2
                                                version2 = 1;
 #else
-                                               errorMsg("%s: not compiled with minix v2 support\n",
+                                               error_msg("%s: not compiled with minix v2 support\n",
                                                                device_name);
                                                exit(-1);
 #endif