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"
@ -4316,41 +4316,50 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
&& *line_ptr != '-' && *line_ptr != '+') && *line_ptr != '-' && *line_ptr != '+')
continue; continue;
if (*line_ptr == '+' || *line_ptr == '-') { if (*line_ptr == '+' || *line_ptr == '-') {
i = atoi(line_ptr+1); int minus = (*line_ptr == '-');
if (*line_ptr == '-') int absolute = 0;
i = -i;
while (isdigit(*++line_ptr)) i = atoi(line_ptr+1);
use_default = 0;
switch (*line_ptr) { while (isdigit(*++line_ptr))
case 'c': use_default = 0;
case 'C':
switch (*line_ptr) {
case 'c':
case 'C':
if (!display_in_cyl_units) if (!display_in_cyl_units)
i *= heads * sectors; i *= heads * sectors;
break; break;
case 'k': case 'k':
case 'K': case 'K':
i *= 2; absolute = 1000;
i /= (sector_size / 512); break;
i /= units_per_sector; case 'm':
break; case 'M':
case 'm': absolute = 1000000;
case 'M': break;
i *= 2048; case 'g':
i /= (sector_size / 512); case 'G':
i /= units_per_sector; absolute = 1000000000;
break; break;
case 'g': default:
case 'G': break;
i *= 2048000; }
i /= (sector_size / 512); if (absolute) {
i /= units_per_sector; unsigned long long bytes;
break; unsigned long unit;
default:
break; bytes = (unsigned long long) i * absolute;
unit = sector_size * units_per_sector;
bytes += unit/2; /* round */
bytes /= unit;
i = bytes;
} }
i += base; if (minus)
} else { i = -i;
i += base;
} else {
i = atoi(line_ptr); i = atoi(line_ptr);
while (isdigit(*line_ptr)) { while (isdigit(*line_ptr)) {
line_ptr++; 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) {
printf(_("The maximum number of partitions has been created\n"));
return;
}
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind; free_primary += !ptes[i].part_table->sys_ind;
if (!free_primary && partitions >= MAXIMUM_PARTS) {
printf(_("The maximum number of partitions has been created\n"));
return;
}
if (!free_primary) { if (!free_primary) {
if (extended_offset) if (extended_offset)
add_logical(); add_logical();