summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--toolbox/Android.bp7
-rw-r--r--toolbox/newfs_msdos.c21
2 files changed, 22 insertions, 6 deletions
diff --git a/toolbox/Android.bp b/toolbox/Android.bp
index a0c24979d..077f5423d 100644
--- a/toolbox/Android.bp
+++ b/toolbox/Android.bp
@@ -61,3 +61,10 @@ cc_binary {
defaults: ["toolbox_defaults"],
srcs: ["r.c"],
}
+
+cc_binary_host {
+ name: "newfs_msdos",
+ defaults: ["toolbox_defaults"],
+ srcs: ["newfs_msdos.c"],
+ cflags: ["-Dnewfs_msdos_main=main"]
+}
diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c
index d7047e2c4..5fc8b0242 100644
--- a/toolbox/newfs_msdos.c
+++ b/toolbox/newfs_msdos.c
@@ -32,15 +32,17 @@ static const char rcsid[] =
#include <sys/param.h>
-#ifndef ANDROID
+#ifdef __APPLE__
+#elif defined(ANDROID)
+#include <linux/fs.h>
+#include <linux/hdreg.h>
+#include <stdarg.h>
+#include <sys/ioctl.h>
+#else
#include <sys/fdcio.h>
#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/mount.h>
-#else
-#include <stdarg.h>
-#include <linux/fs.h>
-#include <linux/hdreg.h>
#endif
#include <sys/stat.h>
@@ -58,6 +60,10 @@ static const char rcsid[] =
#include <time.h>
#include <unistd.h>
+#ifndef __unused
+#define __unused __attribute__((__unused__))
+#endif
+
#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */
#define BPN 4 /* bits per nibble */
#define NPB 2 /* nibbles per byte */
@@ -794,7 +800,10 @@ static void getstdfmt(const char *fmt, struct bpb *bpb)
* Get disk slice, partition, and geometry information.
*/
-#ifdef ANDROID
+#ifdef __APPLE__
+static void getdiskinfo(__unused int fd, __unused const char* fname, __unused const char* dtype,
+ __unused int oflag, __unused struct bpb* bpb) {}
+#elif ANDROID
static void getdiskinfo(int fd, const char *fname, const char *dtype,
__unused int oflag,struct bpb *bpb)
{