summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen2018-04-25 19:50:47 -0500
committerDan Willemsen2018-05-02 15:14:51 -0500
commita228822c7df525b8bc5e1a30e63b0d490658b784 (patch)
treed8c2786e36317ef4d58a7ccc25beda54ace36a57 /toolbox
parent78393951de05ef60456f23d959400125684d7f7a (diff)
downloadplatform-system-core-a228822c7df525b8bc5e1a30e63b0d490658b784.tar.gz
platform-system-core-a228822c7df525b8bc5e1a30e63b0d490658b784.tar.xz
platform-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 {
61 defaults: ["toolbox_defaults"], 61 defaults: ["toolbox_defaults"],
62 srcs: ["r.c"], 62 srcs: ["r.c"],
63} 63}
64
65cc_binary_host {
66 name: "newfs_msdos",
67 defaults: ["toolbox_defaults"],
68 srcs: ["newfs_msdos.c"],
69 cflags: ["-Dnewfs_msdos_main=main"]
70}
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[] =
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34 34
35#ifndef ANDROID 35#ifdef __APPLE__
36#elif defined(ANDROID)
37#include <linux/fs.h>
38#include <linux/hdreg.h>
39#include <stdarg.h>
40#include <sys/ioctl.h>
41#else
36#include <sys/fdcio.h> 42#include <sys/fdcio.h>
37#include <sys/disk.h> 43#include <sys/disk.h>
38#include <sys/disklabel.h> 44#include <sys/disklabel.h>
39#include <sys/mount.h> 45#include <sys/mount.h>
40#else
41#include <stdarg.h>
42#include <linux/fs.h>
43#include <linux/hdreg.h>
44#endif 46#endif
45 47
46#include <sys/stat.h> 48#include <sys/stat.h>
@@ -58,6 +60,10 @@ static const char rcsid[] =
58#include <time.h> 60#include <time.h>
59#include <unistd.h> 61#include <unistd.h>
60 62
63#ifndef __unused
64#define __unused __attribute__((__unused__))
65#endif
66
61#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */ 67#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */
62#define BPN 4 /* bits per nibble */ 68#define BPN 4 /* bits per nibble */
63#define NPB 2 /* nibbles per byte */ 69#define NPB 2 /* nibbles per byte */
@@ -794,7 +800,10 @@ static void getstdfmt(const char *fmt, struct bpb *bpb)
794 * Get disk slice, partition, and geometry information. 800 * Get disk slice, partition, and geometry information.
795 */ 801 */
796 802
797#ifdef ANDROID 803#ifdef __APPLE__
804static void getdiskinfo(__unused int fd, __unused const char* fname, __unused const char* dtype,
805 __unused int oflag, __unused struct bpb* bpb) {}
806#elif ANDROID
798static void getdiskinfo(int fd, const char *fname, const char *dtype, 807static void getdiskinfo(int fd, const char *fname, const char *dtype,
799 __unused int oflag,struct bpb *bpb) 808 __unused int oflag,struct bpb *bpb)
800{ 809{