Patch from Kent Robotti updating fdisk to version v2.11z

This commit is contained in:
Eric Andersen 2003-07-03 10:02:32 +00:00
parent e5920a2dc0
commit c48d49ad98

View File

@ -19,7 +19,7 @@
* Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port * Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port
*/ */
#define UTIL_LINUX_VERSION "2.11w" #define UTIL_LINUX_VERSION "2.11z"
#define PROC_PARTITIONS "/proc/partitions" #define PROC_PARTITIONS "/proc/partitions"
@ -4317,11 +4317,14 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
continue; continue;
if (*line_ptr == '+' || *line_ptr == '-') { if (*line_ptr == '+' || *line_ptr == '-') {
int minus = (*line_ptr == '-');
int absolute = 0;
i = atoi(line_ptr+1); i = atoi(line_ptr+1);
if (*line_ptr == '-')
i = -i;
while (isdigit(*++line_ptr)) while (isdigit(*++line_ptr))
use_default = 0; use_default = 0;
switch (*line_ptr) { switch (*line_ptr) {
case 'c': case 'c':
case 'C': case 'C':
@ -4330,25 +4333,31 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
break; break;
case 'k': case 'k':
case 'K': case 'K':
i *= 2; absolute = 1000;
i /= (sector_size / 512);
i /= units_per_sector;
break; break;
case 'm': case 'm':
case 'M': case 'M':
i *= 2048; absolute = 1000000;
i /= (sector_size / 512);
i /= units_per_sector;
break; break;
case 'g': case 'g':
case 'G': case 'G':
i *= 2048000; absolute = 1000000000;
i /= (sector_size / 512);
i /= units_per_sector;
break; break;
default: default:
break; break;
} }
if (absolute) {
unsigned long long bytes;
unsigned long unit;
bytes = (unsigned long long) i * absolute;
unit = sector_size * units_per_sector;
bytes += unit/2; /* round */
bytes /= unit;
i = bytes;
}
if (minus)
i = -i;
i += base; i += base;
} else { } else {
i = atoi(line_ptr); i = atoi(line_ptr);
@ -4701,7 +4710,7 @@ static void check_consistency(const struct partition *p, int partition) {
/* Ending on cylinder boundary? */ /* Ending on cylinder boundary? */
if (peh != (heads - 1) || pes != sectors) { if (peh != (heads - 1) || pes != sectors) {
printf(_("Partition %i does not end on cylinder boundary:\n"), printf(_("Partition %i does not end on cylinder boundary.\n"),
partition + 1); partition + 1);
#if 0 #if 0
printf(_(" phys=(%d, %d, %d) "), pec, peh, pes); printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);
@ -5266,13 +5275,14 @@ new_partition(void) {
} }
#endif #endif
if (partitions >= MAXIMUM_PARTS) { for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary && partitions >= MAXIMUM_PARTS) {
printf(_("The maximum number of partitions has been created\n")); printf(_("The maximum number of partitions has been created\n"));
return; return;
} }
for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary) { if (!free_primary) {
if (extended_offset) if (extended_offset)
add_logical(); add_logical();