summaryrefslogtreecommitdiff
path: root/user/mac-fdisk/mac-fdisk-large-disk-support.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2017-09-19 22:42:02 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2017-09-19 22:42:02 -0500
commit1fa4c88ee21866eeb0feae8f6b0bf609a04711cc (patch)
tree99ddd7dc3d18f0fa1bf52220b1511d4e2a395032 /user/mac-fdisk/mac-fdisk-large-disk-support.patch
parentd9ac52b688c7adfc31c678a7cbc5a1e5c917fb6c (diff)
downloadpackages-1fa4c88ee21866eeb0feae8f6b0bf609a04711cc.tar.gz
packages-1fa4c88ee21866eeb0feae8f6b0bf609a04711cc.tar.bz2
packages-1fa4c88ee21866eeb0feae8f6b0bf609a04711cc.tar.xz
packages-1fa4c88ee21866eeb0feae8f6b0bf609a04711cc.zip
user/mac-fdisk: new package
Diffstat (limited to 'user/mac-fdisk/mac-fdisk-large-disk-support.patch')
-rw-r--r--user/mac-fdisk/mac-fdisk-large-disk-support.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/user/mac-fdisk/mac-fdisk-large-disk-support.patch b/user/mac-fdisk/mac-fdisk-large-disk-support.patch
new file mode 100644
index 000000000..fe9e78ec7
--- /dev/null
+++ b/user/mac-fdisk/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;
+ }
+
+