Patch Busybox to use it's own version of major/minor/makedev macros
authorDan Cross <crossd@gmail.com>
Tue, 3 Nov 2015 21:19:13 +0000 (16:19 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 10 Nov 2015 16:09:45 +0000 (11:09 -0500)
These are needed for compatibility with legacy file formats (e.g.,
tar, cpio), but are absent from Akaros proper.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/apps/busybox/akaros-patches/1.17.3/0006-busybox-major-minor-makedev.patch [new file with mode: 0644]

diff --git a/tools/apps/busybox/akaros-patches/1.17.3/0006-busybox-major-minor-makedev.patch b/tools/apps/busybox/akaros-patches/1.17.3/0006-busybox-major-minor-makedev.patch
new file mode 100644 (file)
index 0000000..f737780
--- /dev/null
@@ -0,0 +1,47 @@
+diff -ur busybox-1.17.3-akaros-base/include/libbb.h busybox-1.17.3-akaros/include/libbb.h
+--- busybox-1.17.3-akaros-base/include/libbb.h 2015-11-03 16:05:17.610100657 -0500
++++ busybox-1.17.3-akaros/include/libbb.h      2015-11-03 16:10:35.950717057 -0500
+@@ -1265,8 +1265,20 @@
+ #ifdef __GLIBC__
+ /* At least glibc has horrendously large inline for this, so wrap it */
+ unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC;
++unsigned int bb_major(unsigned long long dev) FAST_FUNC;
++unsigned int bb_minor(unsigned long long dev) FAST_FUNC;
++#ifdef makedev
+ #undef makedev
++#endif
+ #define makedev(a,b) bb_makedev(a,b)
++#ifdef major
++#undef major
++#endif
++#define major(a) bb_major(a)
++#ifdef minor
++#undef minor
++#endif
++#define minor(a) bb_minor(a)
+ #endif
+diff -ur busybox-1.17.3-akaros-base/libbb/makedev.c busybox-1.17.3-akaros/libbb/makedev.c
+--- busybox-1.17.3-akaros-base/libbb/makedev.c 2015-11-03 16:05:17.522098264 -0500
++++ busybox-1.17.3-akaros/libbb/makedev.c      2015-11-03 16:12:53.898427762 -0500
+@@ -19,6 +19,18 @@
+ unsigned long long FAST_FUNC bb_makedev(unsigned int major, unsigned int minor);
+ unsigned long long FAST_FUNC bb_makedev(unsigned int major, unsigned int minor)
+ {
+-      return makedev(major, minor);
++      return ((major << 16) | minor);
++}
++
++unsigned int FAST_FUNC bb_major(unsigned long long dev);
++unsigned int FAST_FUNC bb_major(unsigned long long dev)
++{
++      return ((dev >> 16) & 0xFFFF);
++}
++
++unsigned int FAST_FUNC bb_minor(unsigned long long dev);
++unsigned int FAST_FUNC bb_minor(unsigned long long dev)
++{
++      return (dev & 0xFFFF);
+ }
+ #endif