diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-19 14:43:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-19 14:43:38 +0000 |
commit | bd852076b9f6600d039e75d646a6965b5b092606 (patch) | |
tree | ea133ee61be3857f3d7fa4c67302c52eb268391c /util-linux/fdisk_sgi.c | |
parent | de8a6a01d84ebb09a333104bf0fd5f6e251d9eb7 (diff) | |
download | busybox-w32-bd852076b9f6600d039e75d646a6965b5b092606.tar.gz busybox-w32-bd852076b9f6600d039e75d646a6965b5b092606.tar.bz2 busybox-w32-bd852076b9f6600d039e75d646a6965b5b092606.zip |
fdisk: get rid of _() macro.
Shorten some messages. Stop using stderr - anyone who tries
to use fdisk no-interactively is "strange" anyway.
Improve storage handling in bsd module.
text data bss dec hex filename
728112 1488 33788 763388 ba5fc busybox.t0/busybox
727248 1488 33372 762108 ba0fc busybox.t1/busybox
Diffstat (limited to 'util-linux/fdisk_sgi.c')
-rw-r--r-- | util-linux/fdisk_sgi.c | 245 |
1 files changed, 125 insertions, 120 deletions
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c index 937ac883b..b2e0d7a62 100644 --- a/util-linux/fdisk_sgi.c +++ b/util-linux/fdisk_sgi.c | |||
@@ -6,6 +6,20 @@ | |||
6 | * the terms of the GNU Public License. | 6 | * the terms of the GNU Public License. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #define SGI_VOLHDR 0x00 | ||
10 | /* 1 and 2 were used for drive types no longer supported by SGI */ | ||
11 | #define SGI_SWAP 0x03 | ||
12 | /* 4 and 5 were for filesystem types SGI haven't ever supported on MIPS CPUs */ | ||
13 | #define SGI_VOLUME 0x06 | ||
14 | #define SGI_EFS 0x07 | ||
15 | #define SGI_LVOL 0x08 | ||
16 | #define SGI_RLVOL 0x09 | ||
17 | #define SGI_XFS 0x0a | ||
18 | #define SGI_XFSLOG 0x0b | ||
19 | #define SGI_XLV 0x0c | ||
20 | #define SGI_XVM 0x0d | ||
21 | #define SGI_ENTIRE_DISK SGI_VOLUME | ||
22 | |||
9 | struct device_parameter { /* 48 bytes */ | 23 | struct device_parameter { /* 48 bytes */ |
10 | unsigned char skew; | 24 | unsigned char skew; |
11 | unsigned char gap1; | 25 | unsigned char gap1; |
@@ -159,26 +173,26 @@ isinfreelist(unsigned int b) | |||
159 | * end of free blocks section | 173 | * end of free blocks section |
160 | */ | 174 | */ |
161 | 175 | ||
162 | static const struct systypes sgi_sys_types[] = { | 176 | static const char *const sgi_sys_types[] = { |
163 | /* SGI_VOLHDR */ { "\x00" "SGI volhdr" }, | 177 | /* SGI_VOLHDR */ "\x00" "SGI volhdr" , |
164 | /* 0x01 */ { "\x01" "SGI trkrepl" }, | 178 | /* 0x01 */ "\x01" "SGI trkrepl" , |
165 | /* 0x02 */ { "\x02" "SGI secrepl" }, | 179 | /* 0x02 */ "\x02" "SGI secrepl" , |
166 | /* SGI_SWAP */ { "\x03" "SGI raw" }, | 180 | /* SGI_SWAP */ "\x03" "SGI raw" , |
167 | /* 0x04 */ { "\x04" "SGI bsd" }, | 181 | /* 0x04 */ "\x04" "SGI bsd" , |
168 | /* 0x05 */ { "\x05" "SGI sysv" }, | 182 | /* 0x05 */ "\x05" "SGI sysv" , |
169 | /* SGI_ENTIRE_DISK */ { "\x06" "SGI volume" }, | 183 | /* SGI_ENTIRE_DISK */ "\x06" "SGI volume" , |
170 | /* SGI_EFS */ { "\x07" "SGI efs" }, | 184 | /* SGI_EFS */ "\x07" "SGI efs" , |
171 | /* 0x08 */ { "\x08" "SGI lvol" }, | 185 | /* 0x08 */ "\x08" "SGI lvol" , |
172 | /* 0x09 */ { "\x09" "SGI rlvol" }, | 186 | /* 0x09 */ "\x09" "SGI rlvol" , |
173 | /* SGI_XFS */ { "\x0a" "SGI xfs" }, | 187 | /* SGI_XFS */ "\x0a" "SGI xfs" , |
174 | /* SGI_XFSLOG */ { "\x0b" "SGI xfslog" }, | 188 | /* SGI_XFSLOG */ "\x0b" "SGI xfslog" , |
175 | /* SGI_XLV */ { "\x0c" "SGI xlv" }, | 189 | /* SGI_XLV */ "\x0c" "SGI xlv" , |
176 | /* SGI_XVM */ { "\x0d" "SGI xvm" }, | 190 | /* SGI_XVM */ "\x0d" "SGI xvm" , |
177 | /* LINUX_SWAP */ { "\x82" "Linux swap" }, | 191 | /* LINUX_SWAP */ "\x82" "Linux swap" , |
178 | /* LINUX_NATIVE */ { "\x83" "Linux native" }, | 192 | /* LINUX_NATIVE */ "\x83" "Linux native", |
179 | /* LINUX_LVM */ { "\x8d" "Linux LVM" }, | 193 | /* LINUX_LVM */ "\x8d" "Linux LVM" , |
180 | /* LINUX_RAID */ { "\xfd" "Linux RAID" }, | 194 | /* LINUX_RAID */ "\xfd" "Linux RAID" , |
181 | { NULL } | 195 | NULL |
182 | }; | 196 | }; |
183 | 197 | ||
184 | 198 | ||
@@ -206,18 +220,20 @@ two_s_complement_32bit_sum(unsigned int* base, int size /* in bytes */) | |||
206 | return sum; | 220 | return sum; |
207 | } | 221 | } |
208 | 222 | ||
223 | void BUG_bad_sgi_partition_size(void); | ||
224 | |||
209 | static int | 225 | static int |
210 | check_sgi_label(void) | 226 | check_sgi_label(void) |
211 | { | 227 | { |
212 | if (sizeof(sgilabel) > 512) { | 228 | if (sizeof(sgi_partition) > 512) { |
213 | fprintf(stderr, | 229 | /* According to MIPS Computer Systems, Inc the label |
214 | _("According to MIPS Computer Systems, Inc the " | 230 | * must not contain more than 512 bytes */ |
215 | "Label must not contain more than 512 bytes\n")); | 231 | BUG_bad_sgi_partition_size(); |
216 | exit(1); | ||
217 | } | 232 | } |
218 | 233 | ||
219 | if (sgilabel->magic != SGI_LABEL_MAGIC | 234 | if (sgilabel->magic != SGI_LABEL_MAGIC |
220 | && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED) { | 235 | && sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED |
236 | ) { | ||
221 | current_label_type = label_dos; | 237 | current_label_type = label_dos; |
222 | return 0; | 238 | return 0; |
223 | } | 239 | } |
@@ -228,8 +244,7 @@ check_sgi_label(void) | |||
228 | */ | 244 | */ |
229 | if (two_s_complement_32bit_sum((unsigned int*)sgilabel, | 245 | if (two_s_complement_32bit_sum((unsigned int*)sgilabel, |
230 | sizeof(*sgilabel))) { | 246 | sizeof(*sgilabel))) { |
231 | fprintf(stderr, | 247 | printf("Detected sgi disklabel with wrong checksum\n"); |
232 | _("Detected sgi disklabel with wrong checksum.\n")); | ||
233 | } | 248 | } |
234 | update_units(); | 249 | update_units(); |
235 | current_label_type = label_sgi; | 250 | current_label_type = label_sgi; |
@@ -274,12 +289,12 @@ sgi_list_table(int xtra) | |||
274 | int i, w, wd; | 289 | int i, w, wd; |
275 | int kpi = 0; /* kernel partition ID */ | 290 | int kpi = 0; /* kernel partition ID */ |
276 | 291 | ||
277 | if(xtra) { | 292 | if (xtra) { |
278 | printf(_("\nDisk %s (SGI disk label): %d heads, %d sectors\n" | 293 | printf("\nDisk %s (SGI disk label): %d heads, %d sectors\n" |
279 | "%d cylinders, %d physical cylinders\n" | 294 | "%d cylinders, %d physical cylinders\n" |
280 | "%d extra sects/cyl, interleave %d:1\n" | 295 | "%d extra sects/cyl, interleave %d:1\n" |
281 | "%s\n" | 296 | "%s\n" |
282 | "Units = %s of %d * 512 bytes\n\n"), | 297 | "Units = %s of %d * 512 bytes\n\n", |
283 | disk_device, heads, sectors, cylinders, | 298 | disk_device, heads, sectors, cylinders, |
284 | SGI_SSWAP16(sgiparam.pcylcount), | 299 | SGI_SSWAP16(sgiparam.pcylcount), |
285 | SGI_SSWAP16(sgiparam.sparecyl), | 300 | SGI_SSWAP16(sgiparam.sparecyl), |
@@ -287,23 +302,23 @@ sgi_list_table(int xtra) | |||
287 | (char *)sgilabel, | 302 | (char *)sgilabel, |
288 | str_units(PLURAL), units_per_sector); | 303 | str_units(PLURAL), units_per_sector); |
289 | } else { | 304 | } else { |
290 | printf( _("\nDisk %s (SGI disk label): " | 305 | printf("\nDisk %s (SGI disk label): " |
291 | "%d heads, %d sectors, %d cylinders\n" | 306 | "%d heads, %d sectors, %d cylinders\n" |
292 | "Units = %s of %d * 512 bytes\n\n"), | 307 | "Units = %s of %d * 512 bytes\n\n", |
293 | disk_device, heads, sectors, cylinders, | 308 | disk_device, heads, sectors, cylinders, |
294 | str_units(PLURAL), units_per_sector ); | 309 | str_units(PLURAL), units_per_sector ); |
295 | } | 310 | } |
296 | 311 | ||
297 | w = strlen(disk_device); | 312 | w = strlen(disk_device); |
298 | wd = strlen(_("Device")); | 313 | wd = sizeof("Device") - 1; |
299 | if (w < wd) | 314 | if (w < wd) |
300 | w = wd; | 315 | w = wd; |
301 | 316 | ||
302 | printf(_("----- partitions -----\n" | 317 | printf("----- partitions -----\n" |
303 | "Pt# %*s Info Start End Sectors Id System\n"), | 318 | "Pt# %*s Info Start End Sectors Id System\n", |
304 | w + 2, _("Device")); | 319 | w + 2, "Device"); |
305 | for (i = 0 ; i < partitions; i++) { | 320 | for (i = 0 ; i < partitions; i++) { |
306 | if( sgi_get_num_sectors(i) || debug ) { | 321 | if (sgi_get_num_sectors(i) || debug ) { |
307 | uint32_t start = sgi_get_start_sector(i); | 322 | uint32_t start = sgi_get_start_sector(i); |
308 | uint32_t len = sgi_get_num_sectors(i); | 323 | uint32_t len = sgi_get_num_sectors(i); |
309 | kpi++; /* only count nonempty partitions */ | 324 | kpi++; /* only count nonempty partitions */ |
@@ -320,8 +335,8 @@ sgi_list_table(int xtra) | |||
320 | /* type name */ partition_type(sgi_get_sysid(i))); | 335 | /* type name */ partition_type(sgi_get_sysid(i))); |
321 | } | 336 | } |
322 | } | 337 | } |
323 | printf(_("----- Bootinfo -----\nBootfile: %s\n" | 338 | printf("----- Bootinfo -----\nBootfile: %s\n" |
324 | "----- Directory Entries -----\n"), | 339 | "----- Directory Entries -----\n", |
325 | sgilabel->boot_file); | 340 | sgilabel->boot_file); |
326 | for (i = 0 ; i < sgi_volumes; i++) { | 341 | for (i = 0 ; i < sgi_volumes; i++) { |
327 | if (sgilabel->directory[i].vol_file_size) { | 342 | if (sgilabel->directory[i].vol_file_size) { |
@@ -329,7 +344,7 @@ sgi_list_table(int xtra) | |||
329 | uint32_t len = SGI_SSWAP32(sgilabel->directory[i].vol_file_size); | 344 | uint32_t len = SGI_SSWAP32(sgilabel->directory[i].vol_file_size); |
330 | unsigned char *name = sgilabel->directory[i].vol_file_name; | 345 | unsigned char *name = sgilabel->directory[i].vol_file_name; |
331 | 346 | ||
332 | printf(_("%2d: %-10s sector%5u size%8u\n"), | 347 | printf("%2d: %-10s sector%5u size%8u\n", |
333 | i, (char*)name, (unsigned int) start, (unsigned int) len); | 348 | i, (char*)name, (unsigned int) start, (unsigned int) len); |
334 | } | 349 | } |
335 | } | 350 | } |
@@ -357,26 +372,22 @@ static int | |||
357 | sgi_check_bootfile(const char* aFile) | 372 | sgi_check_bootfile(const char* aFile) |
358 | { | 373 | { |
359 | if (strlen(aFile) < 3) /* "/a\n" is minimum */ { | 374 | if (strlen(aFile) < 3) /* "/a\n" is minimum */ { |
360 | printf(_("\nInvalid Bootfile!\n" | 375 | printf("\nInvalid Bootfile!\n" |
361 | "\tThe bootfile must be an absolute non-zero pathname,\n" | 376 | "\tThe bootfile must be an absolute non-zero pathname,\n" |
362 | "\te.g. \"/unix\" or \"/unix.save\".\n")); | 377 | "\te.g. \"/unix\" or \"/unix.save\".\n"); |
363 | return 0; | 378 | return 0; |
364 | } else { | 379 | } |
365 | if (strlen(aFile) > 16) { | 380 | if (strlen(aFile) > 16) { |
366 | printf(_("\n\tName of Bootfile too long: " | 381 | printf("\nName of Bootfile too long (>16 bytes)\n"); |
367 | "16 bytes maximum.\n")); | 382 | return 0; |
368 | return 0; | 383 | } |
369 | } else { | 384 | if (aFile[0] != '/') { |
370 | if (aFile[0] != '/') { | 385 | printf("\nBootfile must have a fully qualified pathname\n"); |
371 | printf(_("\n\tBootfile must have a " | 386 | return 0; |
372 | "fully qualified pathname.\n")); | 387 | } |
373 | return 0; | ||
374 | } | ||
375 | } | ||
376 | } | ||
377 | if (strncmp(aFile, (char*)sgilabel->boot_file, 16)) { | 388 | if (strncmp(aFile, (char*)sgilabel->boot_file, 16)) { |
378 | printf(_("\n\tBe aware, that the bootfile is not checked for existence.\n\t" | 389 | printf("\nBe aware, that the bootfile is not checked for existence.\n" |
379 | "SGI's default is \"/unix\" and for backup \"/unix.save\".\n")); | 390 | "\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n"); |
380 | /* filename is correct and did change */ | 391 | /* filename is correct and did change */ |
381 | return 1; | 392 | return 1; |
382 | } | 393 | } |
@@ -403,7 +414,7 @@ sgi_set_bootfile(const char* aFile) | |||
403 | sgilabel->boot_file[i] = 0; | 414 | sgilabel->boot_file[i] = 0; |
404 | i++; | 415 | i++; |
405 | } | 416 | } |
406 | printf(_("\n\tBootfile is changed to \"%s\".\n"), sgilabel->boot_file); | 417 | printf("\n\tBootfile is changed to \"%s\"\n", sgilabel->boot_file); |
407 | } | 418 | } |
408 | } | 419 | } |
409 | 420 | ||
@@ -484,34 +495,34 @@ verify_sgi(int verbose) | |||
484 | if (sgi_get_sysid(i) == SGI_ENTIRE_DISK) { | 495 | if (sgi_get_sysid(i) == SGI_ENTIRE_DISK) { |
485 | if (entire++ == 1) { | 496 | if (entire++ == 1) { |
486 | if (verbose) | 497 | if (verbose) |
487 | printf(_("More than one entire disk entry present.\n")); | 498 | printf("More than one entire disk entry present\n"); |
488 | } | 499 | } |
489 | } | 500 | } |
490 | } | 501 | } |
491 | } | 502 | } |
492 | if (sortcount == 0) { | 503 | if (sortcount == 0) { |
493 | if (verbose) | 504 | if (verbose) |
494 | printf(_("No partitions defined\n")); | 505 | printf("No partitions defined\n"); |
495 | return (lastblock > 0) ? 1 : (lastblock == 0) ? 0 : -1; | 506 | return (lastblock > 0) ? 1 : (lastblock == 0) ? 0 : -1; |
496 | } | 507 | } |
497 | qsort(Index, sortcount, sizeof(Index[0]), (void*)compare_start); | 508 | qsort(Index, sortcount, sizeof(Index[0]), (void*)compare_start); |
498 | if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) { | 509 | if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) { |
499 | if ((Index[0] != 10) && verbose) | 510 | if ((Index[0] != 10) && verbose) |
500 | printf(_("IRIX likes when Partition 11 covers the entire disk.\n")); | 511 | printf("IRIX likes when Partition 11 covers the entire disk\n"); |
501 | if ((sgi_get_start_sector(Index[0]) != 0) && verbose) | 512 | if ((sgi_get_start_sector(Index[0]) != 0) && verbose) |
502 | printf(_("The entire disk partition should start " | 513 | printf("The entire disk partition should start " |
503 | "at block 0,\n" | 514 | "at block 0,\n" |
504 | "not at diskblock %d.\n"), | 515 | "not at diskblock %d\n", |
505 | sgi_get_start_sector(Index[0])); | 516 | sgi_get_start_sector(Index[0])); |
506 | if (debug) /* I do not understand how some disks fulfil it */ | 517 | if (debug) /* I do not understand how some disks fulfil it */ |
507 | if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose) | 518 | if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose) |
508 | printf(_("The entire disk partition is only %d diskblock large,\n" | 519 | printf("The entire disk partition is only %d diskblock large,\n" |
509 | "but the disk is %d diskblocks long.\n"), | 520 | "but the disk is %d diskblocks long\n", |
510 | sgi_get_num_sectors(Index[0]), lastblock); | 521 | sgi_get_num_sectors(Index[0]), lastblock); |
511 | lastblock = sgi_get_num_sectors(Index[0]); | 522 | lastblock = sgi_get_num_sectors(Index[0]); |
512 | } else { | 523 | } else { |
513 | if (verbose) | 524 | if (verbose) |
514 | printf(_("One Partition (#11) should cover the entire disk.\n")); | 525 | printf("One Partition (#11) should cover the entire disk\n"); |
515 | if (debug > 2) | 526 | if (debug > 2) |
516 | printf("sysid=%d\tpartition=%d\n", | 527 | printf("sysid=%d\tpartition=%d\n", |
517 | sgi_get_sysid(Index[0]), Index[0]+1); | 528 | sgi_get_sysid(Index[0]), Index[0]+1); |
@@ -522,28 +533,28 @@ verify_sgi(int verbose) | |||
522 | if ((sgi_get_start_sector(Index[i]) % cylsize) != 0) { | 533 | if ((sgi_get_start_sector(Index[i]) % cylsize) != 0) { |
523 | if (debug) /* I do not understand how some disks fulfil it */ | 534 | if (debug) /* I do not understand how some disks fulfil it */ |
524 | if (verbose) | 535 | if (verbose) |
525 | printf(_("Partition %d does not start on cylinder boundary.\n"), | 536 | printf("Partition %d does not start on cylinder boundary\n", |
526 | Index[i]+1); | 537 | Index[i]+1); |
527 | } | 538 | } |
528 | if (sgi_get_num_sectors(Index[i]) % cylsize != 0) { | 539 | if (sgi_get_num_sectors(Index[i]) % cylsize != 0) { |
529 | if (debug) /* I do not understand how some disks fulfil it */ | 540 | if (debug) /* I do not understand how some disks fulfil it */ |
530 | if (verbose) | 541 | if (verbose) |
531 | printf(_("Partition %d does not end on cylinder boundary.\n"), | 542 | printf("Partition %d does not end on cylinder boundary\n", |
532 | Index[i]+1); | 543 | Index[i]+1); |
533 | } | 544 | } |
534 | /* We cannot handle several "entire disk" entries. */ | 545 | /* We cannot handle several "entire disk" entries. */ |
535 | if (sgi_get_sysid(Index[i]) == SGI_ENTIRE_DISK) continue; | 546 | if (sgi_get_sysid(Index[i]) == SGI_ENTIRE_DISK) continue; |
536 | if (start > sgi_get_start_sector(Index[i])) { | 547 | if (start > sgi_get_start_sector(Index[i])) { |
537 | if (verbose) | 548 | if (verbose) |
538 | printf(_("The Partition %d and %d overlap by %d sectors.\n"), | 549 | printf("Partitions %d and %d overlap by %d sectors\n", |
539 | Index[i-1]+1, Index[i]+1, | 550 | Index[i-1]+1, Index[i]+1, |
540 | start - sgi_get_start_sector(Index[i])); | 551 | start - sgi_get_start_sector(Index[i])); |
541 | if (gap > 0) gap = -gap; | 552 | if (gap > 0) gap = -gap; |
542 | if (gap == 0) gap = -1; | 553 | if (gap == 0) gap = -1; |
543 | } | 554 | } |
544 | if (start < sgi_get_start_sector(Index[i])) { | 555 | if (start < sgi_get_start_sector(Index[i])) { |
545 | if (verbose) | 556 | if (verbose) |
546 | printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"), | 557 | printf("Unused gap of %8u sectors - sectors %8u-%8u\n", |
547 | sgi_get_start_sector(Index[i]) - start, | 558 | sgi_get_start_sector(Index[i]) - start, |
548 | start, sgi_get_start_sector(Index[i])-1); | 559 | start, sgi_get_start_sector(Index[i])-1); |
549 | gap += sgi_get_start_sector(Index[i]) - start; | 560 | gap += sgi_get_start_sector(Index[i]) - start; |
@@ -561,7 +572,7 @@ verify_sgi(int verbose) | |||
561 | } | 572 | } |
562 | if (start < lastblock) { | 573 | if (start < lastblock) { |
563 | if (verbose) | 574 | if (verbose) |
564 | printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"), | 575 | printf("Unused gap of %8u sectors - sectors %8u-%8u\n", |
565 | lastblock - start, start, lastblock-1); | 576 | lastblock - start, start, lastblock-1); |
566 | gap += lastblock - start; | 577 | gap += lastblock - start; |
567 | add2freelist(start, lastblock); | 578 | add2freelist(start, lastblock); |
@@ -572,17 +583,17 @@ verify_sgi(int verbose) | |||
572 | */ | 583 | */ |
573 | if (verbose) { | 584 | if (verbose) { |
574 | if (!sgi_get_num_sectors(sgi_get_bootpartition())) { | 585 | if (!sgi_get_num_sectors(sgi_get_bootpartition())) { |
575 | printf(_("\nThe boot partition does not exist.\n")); | 586 | printf("\nThe boot partition does not exist\n"); |
576 | } | 587 | } |
577 | if (!sgi_get_num_sectors(sgi_get_swappartition())) { | 588 | if (!sgi_get_num_sectors(sgi_get_swappartition())) { |
578 | printf(_("\nThe swap partition does not exist.\n")); | 589 | printf("\nThe swap partition does not exist\n"); |
579 | } else { | 590 | } else { |
580 | if ((sgi_get_sysid(sgi_get_swappartition()) != SGI_SWAP) | 591 | if ((sgi_get_sysid(sgi_get_swappartition()) != SGI_SWAP) |
581 | && (sgi_get_sysid(sgi_get_swappartition()) != LINUX_SWAP)) | 592 | && (sgi_get_sysid(sgi_get_swappartition()) != LINUX_SWAP)) |
582 | printf(_("\nThe swap partition has no swap type.\n")); | 593 | printf("\nThe swap partition has no swap type\n"); |
583 | } | 594 | } |
584 | if (sgi_check_bootfile("/unix")) | 595 | if (sgi_check_bootfile("/unix")) |
585 | printf(_("\tYou have chosen an unusual boot file name.\n")); | 596 | printf("\tYou have chosen an unusual boot file name\n"); |
586 | } | 597 | } |
587 | return (gap > 0) ? 1 : (gap == 0) ? 0 : -1; | 598 | return (gap > 0) ? 1 : (gap == 0) ? 0 : -1; |
588 | } | 599 | } |
@@ -602,19 +613,20 @@ sgi_gaps(void) | |||
602 | static void | 613 | static void |
603 | sgi_change_sysid(int i, int sys) | 614 | sgi_change_sysid(int i, int sys) |
604 | { | 615 | { |
605 | if( sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */ | 616 | if (sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */ |
606 | printf(_("Sorry You may change the Tag of non-empty partitions.\n")); | 617 | printf("Sorry you may change the Tag of non-empty partitions\n"); |
607 | return; | 618 | return; |
608 | } | 619 | } |
609 | if (((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR)) | 620 | if ((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR) |
610 | && (sgi_get_start_sector(i) < 1) ) { | 621 | && (sgi_get_start_sector(i) < 1) |
622 | ) { | ||
611 | read_maybe_empty( | 623 | read_maybe_empty( |
612 | _("It is highly recommended that the partition at offset 0\n" | 624 | "It is highly recommended that the partition at offset 0\n" |
613 | "is of type \"SGI volhdr\", the IRIX system will rely on it to\n" | 625 | "is of type \"SGI volhdr\", the IRIX system will rely on it to\n" |
614 | "retrieve from its directory standalone tools like sash and fx.\n" | 626 | "retrieve from its directory standalone tools like sash and fx.\n" |
615 | "Only the \"SGI volume\" entire disk section may violate this.\n" | 627 | "Only the \"SGI volume\" entire disk section may violate this.\n" |
616 | "Type YES if you are sure about tagging this partition differently.\n")); | 628 | "Type YES if you are sure about tagging this partition differently.\n"); |
617 | if (strcmp(line_ptr, _("YES\n"))) | 629 | if (strcmp(line_ptr, "YES\n") != 0) |
618 | return; | 630 | return; |
619 | } | 631 | } |
620 | sgilabel->partitions[i].id = SGI_SSWAP32(sys); | 632 | sgilabel->partitions[i].id = SGI_SSWAP32(sys); |
@@ -640,7 +652,7 @@ sgi_set_partition(int i, unsigned int start, unsigned int length, int sys) | |||
640 | sgilabel->partitions[i].start_sector = SGI_SSWAP32(start); | 652 | sgilabel->partitions[i].start_sector = SGI_SSWAP32(start); |
641 | set_changed(i); | 653 | set_changed(i); |
642 | if (sgi_gaps() < 0) /* rebuild freelist */ | 654 | if (sgi_gaps() < 0) /* rebuild freelist */ |
643 | printf(_("Do You know, You got a partition overlap on the disk?\n")); | 655 | printf("Partition overlap detected\n"); |
644 | } | 656 | } |
645 | 657 | ||
646 | static void | 658 | static void |
@@ -649,7 +661,7 @@ sgi_set_entire(void) | |||
649 | int n; | 661 | int n; |
650 | 662 | ||
651 | for (n = 10; n < partitions; n++) { | 663 | for (n = 10; n < partitions; n++) { |
652 | if(!sgi_get_num_sectors(n) ) { | 664 | if (!sgi_get_num_sectors(n) ) { |
653 | sgi_set_partition(n, 0, sgi_get_lastblock(), SGI_VOLUME); | 665 | sgi_set_partition(n, 0, sgi_get_lastblock(), SGI_VOLUME); |
654 | break; | 666 | break; |
655 | } | 667 | } |
@@ -693,32 +705,31 @@ sgi_add_partition(int n, int sys) | |||
693 | } else if (n == 8) { | 705 | } else if (n == 8) { |
694 | sys = 0; | 706 | sys = 0; |
695 | } | 707 | } |
696 | if(sgi_get_num_sectors(n)) { | 708 | if (sgi_get_num_sectors(n)) { |
697 | printf(_("Partition %d is already defined. Delete " | 709 | printf(msg_part_already_defined, n + 1); |
698 | "it before re-adding it.\n"), n + 1); | ||
699 | return; | 710 | return; |
700 | } | 711 | } |
701 | if ((sgi_entire() == -1) && (sys != SGI_VOLUME)) { | 712 | if ((sgi_entire() == -1) && (sys != SGI_VOLUME)) { |
702 | printf(_("Attempting to generate entire disk entry automatically.\n")); | 713 | printf("Attempting to generate entire disk entry automatically\n"); |
703 | sgi_set_entire(); | 714 | sgi_set_entire(); |
704 | sgi_set_volhdr(); | 715 | sgi_set_volhdr(); |
705 | } | 716 | } |
706 | if ((sgi_gaps() == 0) && (sys != SGI_VOLUME)) { | 717 | if ((sgi_gaps() == 0) && (sys != SGI_VOLUME)) { |
707 | printf(_("The entire disk is already covered with partitions.\n")); | 718 | printf("The entire disk is already covered with partitions\n"); |
708 | return; | 719 | return; |
709 | } | 720 | } |
710 | if (sgi_gaps() < 0) { | 721 | if (sgi_gaps() < 0) { |
711 | printf(_("You got a partition overlap on the disk. Fix it first!\n")); | 722 | printf("You got a partition overlap on the disk. Fix it first!\n"); |
712 | return; | 723 | return; |
713 | } | 724 | } |
714 | snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR)); | 725 | snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR)); |
715 | while (1) { | 726 | while (1) { |
716 | if(sys == SGI_VOLUME) { | 727 | if (sys == SGI_VOLUME) { |
717 | last = sgi_get_lastblock(); | 728 | last = sgi_get_lastblock(); |
718 | first = read_int(0, 0, last-1, 0, mesg); | 729 | first = read_int(0, 0, last-1, 0, mesg); |
719 | if (first != 0) { | 730 | if (first != 0) { |
720 | printf(_("It is highly recommended that eleventh partition\n" | 731 | printf("It is highly recommended that eleventh partition\n" |
721 | "covers the entire disk and is of type 'SGI volume'\n")); | 732 | "covers the entire disk and is of type 'SGI volume'\n"); |
722 | } | 733 | } |
723 | } else { | 734 | } else { |
724 | first = freelist[0].first; | 735 | first = freelist[0].first; |
@@ -730,15 +741,14 @@ sgi_add_partition(int n, int sys) | |||
730 | first *= units_per_sector; | 741 | first *= units_per_sector; |
731 | else | 742 | else |
732 | first = first; /* align to cylinder if you know how ... */ | 743 | first = first; /* align to cylinder if you know how ... */ |
733 | if(!last ) | 744 | if (!last ) |
734 | last = isinfreelist(first); | 745 | last = isinfreelist(first); |
735 | if(last == 0) { | 746 | if (last != 0) |
736 | printf(_("You will get a partition overlap on the disk. " | ||
737 | "Fix it first!\n")); | ||
738 | } else | ||
739 | break; | 747 | break; |
748 | printf("You will get a partition overlap on the disk. " | ||
749 | "Fix it first!\n"); | ||
740 | } | 750 | } |
741 | snprintf(mesg, sizeof(mesg), _(" Last %s"), str_units(SINGULAR)); | 751 | snprintf(mesg, sizeof(mesg), " Last %s", str_units(SINGULAR)); |
742 | last = read_int(scround(first), scround(last)-1, scround(last)-1, | 752 | last = read_int(scround(first), scround(last)-1, scround(last)-1, |
743 | scround(first), mesg)+1; | 753 | scround(first), mesg)+1; |
744 | if (display_in_cyl_units) | 754 | if (display_in_cyl_units) |
@@ -746,8 +756,8 @@ sgi_add_partition(int n, int sys) | |||
746 | else | 756 | else |
747 | last = last; /* align to cylinder if You know how ... */ | 757 | last = last; /* align to cylinder if You know how ... */ |
748 | if ( (sys == SGI_VOLUME) && (first != 0 || last != sgi_get_lastblock() ) ) | 758 | if ( (sys == SGI_VOLUME) && (first != 0 || last != sgi_get_lastblock() ) ) |
749 | printf(_("It is highly recommended that eleventh partition\n" | 759 | printf("It is highly recommended that eleventh partition\n" |
750 | "covers the entire disk and is of type 'SGI volume'\n")); | 760 | "covers the entire disk and is of type 'SGI volume'\n"); |
751 | sgi_set_partition(n, first, last-first, sys); | 761 | sgi_set_partition(n, first, last-first, sys); |
752 | } | 762 | } |
753 | 763 | ||
@@ -768,10 +778,7 @@ create_sgilabel(void) | |||
768 | 778 | ||
769 | sec_fac = sector_size / 512; /* determine the sector factor */ | 779 | sec_fac = sector_size / 512; /* determine the sector factor */ |
770 | 780 | ||
771 | fprintf( stderr, | 781 | printf(msg_building_new_label, "SGI disklabel"); |
772 | _("Building a new SGI disklabel. Changes will remain in memory only,\n" | ||
773 | "until you decide to write them. After that, of course, the previous\n" | ||
774 | "content will be unrecoverably lost.\n\n")); | ||
775 | 782 | ||
776 | sgi_other_endian = (BYTE_ORDER == LITTLE_ENDIAN); | 783 | sgi_other_endian = (BYTE_ORDER == LITTLE_ENDIAN); |
777 | res = ioctl(fd, BLKGETSIZE, &longsectors); | 784 | res = ioctl(fd, BLKGETSIZE, &longsectors); |
@@ -785,23 +792,21 @@ create_sgilabel(void) | |||
785 | } else { | 792 | } else { |
786 | /* otherwise print error and use truncated version */ | 793 | /* otherwise print error and use truncated version */ |
787 | cylinders = geometry.cylinders; | 794 | cylinders = geometry.cylinders; |
788 | fprintf(stderr, | 795 | printf( |
789 | _("Warning: BLKGETSIZE ioctl failed on %s. " | 796 | "Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n" |
790 | "Using geometry cylinder value of %d.\n" | 797 | "This value may be truncated for devices > 33.8 GB.\n", disk_device, cylinders); |
791 | "This value may be truncated for devices" | ||
792 | " > 33.8 GB.\n"), disk_device, cylinders); | ||
793 | } | 798 | } |
794 | } | 799 | } |
795 | for (i = 0; i < 4; i++) { | 800 | for (i = 0; i < 4; i++) { |
796 | old[i].sysid = 0; | 801 | old[i].sysid = 0; |
797 | if (valid_part_table_flag(MBRbuffer)) { | 802 | if (valid_part_table_flag(MBRbuffer)) { |
798 | if(get_part_table(i)->sys_ind) { | 803 | if (get_part_table(i)->sys_ind) { |
799 | old[i].sysid = get_part_table(i)->sys_ind; | 804 | old[i].sysid = get_part_table(i)->sys_ind; |
800 | old[i].start = get_start_sect(get_part_table(i)); | 805 | old[i].start = get_start_sect(get_part_table(i)); |
801 | old[i].nsect = get_nr_sects(get_part_table(i)); | 806 | old[i].nsect = get_nr_sects(get_part_table(i)); |
802 | printf(_("Trying to keep parameters of partition %d.\n"), i); | 807 | printf("Trying to keep parameters of partition %d\n", i); |
803 | if (debug) | 808 | if (debug) |
804 | printf(_("ID=%02x\tSTART=%d\tLENGTH=%d\n"), | 809 | printf("ID=%02x\tSTART=%d\tLENGTH=%d\n", |
805 | old[i].sysid, old[i].start, old[i].nsect); | 810 | old[i].sysid, old[i].start, old[i].nsect); |
806 | } | 811 | } |
807 | } | 812 | } |
@@ -851,7 +856,7 @@ create_sgilabel(void) | |||
851 | sgi_set_entire(); | 856 | sgi_set_entire(); |
852 | sgi_set_volhdr(); | 857 | sgi_set_volhdr(); |
853 | for (i = 0; i < 4; i++) { | 858 | for (i = 0; i < 4; i++) { |
854 | if(old[i].sysid) { | 859 | if (old[i].sysid) { |
855 | sgi_set_partition(i, old[i].start, old[i].nsect, old[i].sysid); | 860 | sgi_set_partition(i, old[i].start, old[i].nsect, old[i].sysid); |
856 | } | 861 | } |
857 | } | 862 | } |