aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-03 10:02:32 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-03 10:02:32 +0000
commit6b9670aadfe6d16099d630f89862239bb0c59e7c (patch)
tree49583baa61c56c0c98ec126d15b9c27c6eeea7cd
parent17c8278e822b64d9e67a9bbd63812b7a4f4abf1c (diff)
downloadbusybox-w32-6b9670aadfe6d16099d630f89862239bb0c59e7c.tar.gz
busybox-w32-6b9670aadfe6d16099d630f89862239bb0c59e7c.tar.bz2
busybox-w32-6b9670aadfe6d16099d630f89862239bb0c59e7c.zip
Patch from Kent Robotti updating fdisk to version v2.11z
git-svn-id: svn://busybox.net/trunk/busybox@7030 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--util-linux/fdisk.c86
1 files changed, 48 insertions, 38 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 71fbe074e..11da77179 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -19,7 +19,7 @@
19 * Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port 19 * Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port
20 */ 20 */
21 21
22#define UTIL_LINUX_VERSION "2.11w" 22#define UTIL_LINUX_VERSION "2.11z"
23 23
24#define PROC_PARTITIONS "/proc/partitions" 24#define PROC_PARTITIONS "/proc/partitions"
25 25
@@ -4316,41 +4316,50 @@ read_int(uint low, uint dflt, uint high, uint base, char *mesg)
4316 && *line_ptr != '-' && *line_ptr != '+') 4316 && *line_ptr != '-' && *line_ptr != '+')
4317 continue; 4317 continue;
4318 4318
4319 if (*line_ptr == '+' || *line_ptr == '-') { 4319 if (*line_ptr == '+' || *line_ptr == '-') {
4320 i = atoi(line_ptr+1); 4320 int minus = (*line_ptr == '-');
4321 if (*line_ptr == '-') 4321 int absolute = 0;
4322 i = -i; 4322
4323 while (isdigit(*++line_ptr)) 4323 i = atoi(line_ptr+1);
4324 use_default = 0; 4324
4325 switch (*line_ptr) { 4325 while (isdigit(*++line_ptr))
4326 case 'c': 4326 use_default = 0;
4327 case 'C': 4327
4328 switch (*line_ptr) {
4329 case 'c':
4330 case 'C':
4328 if (!display_in_cyl_units) 4331 if (!display_in_cyl_units)
4329 i *= heads * sectors; 4332 i *= heads * sectors;
4330 break; 4333 break;
4331 case 'k': 4334 case 'k':
4332 case 'K': 4335 case 'K':
4333 i *= 2; 4336 absolute = 1000;
4334 i /= (sector_size / 512); 4337 break;
4335 i /= units_per_sector; 4338 case 'm':
4336 break; 4339 case 'M':
4337 case 'm': 4340 absolute = 1000000;
4338 case 'M': 4341 break;
4339 i *= 2048; 4342 case 'g':
4340 i /= (sector_size / 512); 4343 case 'G':
4341 i /= units_per_sector; 4344 absolute = 1000000000;
4342 break; 4345 break;
4343 case 'g': 4346 default:
4344 case 'G': 4347 break;
4345 i *= 2048000; 4348 }
4346 i /= (sector_size / 512); 4349 if (absolute) {
4347 i /= units_per_sector; 4350 unsigned long long bytes;
4348 break; 4351 unsigned long unit;
4349 default: 4352
4350 break; 4353 bytes = (unsigned long long) i * absolute;
4354 unit = sector_size * units_per_sector;
4355 bytes += unit/2; /* round */
4356 bytes /= unit;
4357 i = bytes;
4351 } 4358 }
4352 i += base; 4359 if (minus)
4353 } else { 4360 i = -i;
4361 i += base;
4362 } else {
4354 i = atoi(line_ptr); 4363 i = atoi(line_ptr);
4355 while (isdigit(*line_ptr)) { 4364 while (isdigit(*line_ptr)) {
4356 line_ptr++; 4365 line_ptr++;
@@ -4701,7 +4710,7 @@ static void check_consistency(const struct partition *p, int partition) {
4701 4710
4702/* Ending on cylinder boundary? */ 4711/* Ending on cylinder boundary? */
4703 if (peh != (heads - 1) || pes != sectors) { 4712 if (peh != (heads - 1) || pes != sectors) {
4704 printf(_("Partition %i does not end on cylinder boundary:\n"), 4713 printf(_("Partition %i does not end on cylinder boundary.\n"),
4705 partition + 1); 4714 partition + 1);
4706#if 0 4715#if 0
4707 printf(_(" phys=(%d, %d, %d) "), pec, peh, pes); 4716 printf(_(" phys=(%d, %d, %d) "), pec, peh, pes);
@@ -5266,13 +5275,14 @@ new_partition(void) {
5266 } 5275 }
5267#endif 5276#endif
5268 5277
5269 if (partitions >= MAXIMUM_PARTS) {
5270 printf(_("The maximum number of partitions has been created\n"));
5271 return;
5272 }
5273
5274 for (i = 0; i < 4; i++) 5278 for (i = 0; i < 4; i++)
5275 free_primary += !ptes[i].part_table->sys_ind; 5279 free_primary += !ptes[i].part_table->sys_ind;
5280
5281 if (!free_primary && partitions >= MAXIMUM_PARTS) {
5282 printf(_("The maximum number of partitions has been created\n"));
5283 return;
5284 }
5285
5276 if (!free_primary) { 5286 if (!free_primary) {
5277 if (extended_offset) 5287 if (extended_offset)
5278 add_logical(); 5288 add_logical();