summaryrefslogtreecommitdiff
path: root/sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch
diff options
context:
space:
mode:
authorAndrew Wilcox <AWilcox@Wilcox-Tech.com>2016-01-24 03:43:33 -0600
committerAndrew Wilcox <AWilcox@Wilcox-Tech.com>2016-01-24 03:43:33 -0600
commit897095052aabbe5e1173489e2e2e95ab7fc8b1f9 (patch)
tree018df398ac28a65df4a1f98d14f9339c51898d6f /sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch
parentce08c4a8bed21dd61229556b105dc1d4c779d607 (diff)
downloadpackages-897095052aabbe5e1173489e2e2e95ab7fc8b1f9.tar.gz
packages-897095052aabbe5e1173489e2e2e95ab7fc8b1f9.tar.bz2
packages-897095052aabbe5e1173489e2e2e95ab7fc8b1f9.tar.xz
packages-897095052aabbe5e1173489e2e2e95ab7fc8b1f9.zip
sys-fs/mac-fdisk: Apple *smh*
Diffstat (limited to 'sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch')
-rw-r--r--sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch b/sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch
new file mode 100644
index 000000000..fe9e78ec7
--- /dev/null
+++ b/sys-fs/mac-fdisk/files/mac-fdisk-large-disk-support.patch
@@ -0,0 +1,80 @@
+--- a/partition_map.c
++++ b/partition_map.c
+@@ -25,6 +25,11 @@
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++//
++// Defines
++//
++// #define TEST_COMPUTE
++
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+@@ -36,6 +41,10 @@
+ #include <sys/ioctl.h>
+ #include "kernel-defs.h"
+ #include <sys/stat.h>
++#ifdef TEST_COMPUTE
++#include <linux/fs.h>
++#endif
++
+ #endif
+
+ #include "partition_map.h"
+@@ -45,10 +54,6 @@
+ #include "errors.h"
+
+
+-//
+-// Defines
+-//
+-// #define TEST_COMPUTE
+
+
+ //
+@@ -666,7 +671,7 @@
+ loff_t pos;
+ #endif
+ char* data;
+- unsigned long l, r, x;
++ unsigned long long l, r, x;
+ int valid;
+
+ #ifdef TEST_COMPUTE
+@@ -720,9 +725,11 @@
+ } else {
+ r = r * 2;
+ }
+- if (r >= (1024*1024*1024)) {
+- break;
+- }
++// There's no explanation for this, but I suspect the author was trying to
++// prevent going over the 32 bit size
++// if (r >= (1024*1024*1024*2)) {
++// break;
++// }
+ }
+ // binary search for end
+ while (l <= r) {
+@@ -740,11 +747,17 @@
+ if (valid != 0) {
+ x = x + 1;
+ }
+- // printf("size in blocks = %d\n", x);
++#ifdef TEST_COMPUTE
++ printf("size in blocks = %d\n", x);
++#endif
+ free(data);
+ }
++
++ // Add a warning just in case...
++ if(x > 0x80000000)
++ printf("Warning: Large disks may not work with this tool!\n");
+
+- return x;
++ return (unsigned long) x;
+ }
+
+