summaryrefslogtreecommitdiffstats
path: root/toolbox
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-04-25 17:50:47 -0700
committerDan Willemsen <dwillemsen@google.com>2018-05-02 13:14:51 -0700
commita228822c7df525b8bc5e1a30e63b0d490658b784 (patch)
treed8c2786e36317ef4d58a7ccc25beda54ace36a57 /toolbox
parent78393951de05ef60456f23d959400125684d7f7a (diff)
downloadsystem_core-a228822c7df525b8bc5e1a30e63b0d490658b784.tar.gz
system_core-a228822c7df525b8bc5e1a30e63b0d490658b784.tar.bz2
system_core-a228822c7df525b8bc5e1a30e63b0d490658b784.zip
Compile toolbox's newfs_msdos for the host
For potential use with build/make/tools/fat16copy.py Bug: 63035155 Test: mmma system/core/toolbox; newfs_msdos Change-Id: I8ad50b8c181fc4ec21e191ec9fea8e9aa11d2d9b
Diffstat (limited to 'toolbox')
-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)
{