| 1 |
Description: fixes for large disks |
| 2 |
Author: Christian T. Steigies <[email protected]> |
| 3 |
--- a/amigastuff.c |
| 4 |
+++ b/amigastuff.c |
| 5 |
@@ -30,8 +30,13 @@ |
| 6 |
#include <malloc.h> |
| 7 |
#include <string.h> |
| 8 |
|
| 9 |
+# if 0 |
| 10 |
+these include files are broken, see #252709 |
| 11 |
#include <asm/system.h> |
| 12 |
#include <asm/byteorder.h> |
| 13 |
+#else |
| 14 |
+#include <netinet/in.h> |
| 15 |
+#endif |
| 16 |
|
| 17 |
#include <amiga/types.h> |
| 18 |
#include <amiga/filehandler.h> |
| 19 |
@@ -57,7 +62,7 @@ |
| 20 |
struct PartitionBlock *pa[MAXPARTS]; |
| 21 |
int parts, firstblock, lastblock, maxblock, minblock; |
| 22 |
char *initsectors, *listsector; |
| 23 |
-char type[32]; /* Needed by DosType() */ |
| 24 |
+char type[100]; /* Needed by DosType() */ |
| 25 |
|
| 26 |
int rigiddisk_new(int first); |
| 27 |
|
| 28 |
@@ -698,17 +703,26 @@ |
| 29 |
|
| 30 |
geo.heads=1; |
| 31 |
geo.sectors=1; |
| 32 |
- geo.cylinders=hdsize/SECTOR_SIZE; |
| 33 |
+ // geo.cylinders=hdsize/SECTOR_SIZE; |
| 34 |
+ hdsize/=SECTOR_SIZE; |
| 35 |
geo.start=0; |
| 36 |
|
| 37 |
- while ((((geo.cylinders/2)*2)==geo.cylinders) && (geo.cylinders>1024)) { |
| 38 |
+ // while ((((geo.cylinders/2)*2)==geo.cylinders) && (geo.cylinders>1024)) { |
| 39 |
+ while ((((hdsize/2)*2)==hdsize) && (hdsize>1024)) { |
| 40 |
geo.sectors*=2; |
| 41 |
- geo.cylinders/=2; |
| 42 |
- if (((geo.cylinders/2)*2)==geo.cylinders && (geo.cylinders>1024) ) { |
| 43 |
+ // geo.cylinders/=2; |
| 44 |
+ hdsize/=2; |
| 45 |
+ // if (((geo.cylinders/2)*2)==geo.cylinders && (geo.cylinders>1024) ) { |
| 46 |
+ if (((hdsize/2)*2)==hdsize && (hdsize>1024) ) { |
| 47 |
geo.heads*=2; |
| 48 |
- geo.cylinders/=2; |
| 49 |
+ // geo.cylinders/=2; |
| 50 |
+ hdsize/=2; |
| 51 |
} |
| 52 |
} |
| 53 |
+ geo.cylinders=hdsize; |
| 54 |
+ if (hdsize != geo.cylinders) { |
| 55 |
+ printf("Warning: %lli cylinders can not be stored in 16-bit value!\n", hdsize); |
| 56 |
+ } |
| 57 |
|
| 58 |
|
| 59 |
} else { |
| 60 |
@@ -939,7 +953,7 @@ |
| 61 |
dt.dlong = htonl(dostype); |
| 62 |
|
| 63 |
if (!list_only) { |
| 64 |
- j = sprintf(type, "0x%04x = ",dostype); |
| 65 |
+ j = sprintf(type, "0x%04x = ",(unsigned int) dostype); |
| 66 |
|
| 67 |
for (i = 0; i < 4; i++) |
| 68 |
if (isprint(dt.dchar[i])) |
| 69 |
@@ -970,10 +984,10 @@ |
| 70 |
int rigiddisk_show(void) |
| 71 |
{ |
| 72 |
printf ("Disk %s: %ld heads, %ld sectors, %ld cylinders, RDB: %d\n", disk_device, |
| 73 |
- htonl(rdb->rdb_Heads),htonl(rdb->rdb_Sectors),htonl(rdb->rdb_Cylinders),firstblock); |
| 74 |
+ (long int) htonl(rdb->rdb_Heads), (long int) htonl(rdb->rdb_Sectors), (long int) htonl(rdb->rdb_Cylinders), firstblock); |
| 75 |
|
| 76 |
printf ("Logical Cylinders from %ld to %ld, %ld bytes/Cylinder \n\n", |
| 77 |
- htonl(rdb->rdb_LoCylinder), htonl(rdb->rdb_HiCylinder), SECTOR_SIZE*htonl(rdb->rdb_Sectors)*htonl(rdb->rdb_Heads)); |
| 78 |
+ (long int) htonl(rdb->rdb_LoCylinder), (long int) htonl(rdb->rdb_HiCylinder), (long int) SECTOR_SIZE*htonl(rdb->rdb_Sectors)*htonl(rdb->rdb_Heads)); |
| 79 |
|
| 80 |
return 0; |
| 81 |
} |
| 82 |
@@ -996,11 +1010,11 @@ |
| 83 |
printf ("%s%-2d ",disk_device,(i+1)); |
| 84 |
printf ("%s ", htonl(curr->pb_Flags)&PBFF_BOOTABLE?"*":" "); |
| 85 |
printf ("%s ", htonl(curr->pb_Flags)&PBFF_NOMOUNT?" ":"*"); |
| 86 |
- printf ("%6ld %6ld ", htonl(de->de_LowCyl),htonl(de->de_HighCyl)); |
| 87 |
- printf ("%6ld ", (htonl(de->de_HighCyl)-htonl(de->de_LowCyl)+1)* |
| 88 |
+ printf ("%6ld %6ld ", (long int) htonl(de->de_LowCyl), (long int) htonl(de->de_HighCyl)); |
| 89 |
+ printf ("%6ld ", (long int) (htonl(de->de_HighCyl)-htonl(de->de_LowCyl)+1)* |
| 90 |
htonl(de->de_BlocksPerTrack)*htonl(de->de_Surfaces)/2); |
| 91 |
- printf ("%3ld ",htonl(de->de_BootPri)); |
| 92 |
- printf ("%3ld ",htonl(de->de_BootBlocks)); |
| 93 |
+ printf ("%3ld ",(long int) htonl(de->de_BootPri)); |
| 94 |
+ printf ("%3ld ",(long int) htonl(de->de_BootBlocks)); |
| 95 |
printf ("%s\n",DosType(htonl(de->de_DosType))); |
| 96 |
} |
| 97 |
|