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
This commit is contained in:
Denis Vlasenko 2007-03-19 14:43:38 +00:00
parent de8a6a01d8
commit bd852076b9
5 changed files with 793 additions and 797 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,18 +39,15 @@ static short aix_volumes = 1;
static void
aix_info(void)
{
puts(
_("\n\tThere is a valid AIX label on this disk.\n"
"\tUnfortunately Linux cannot handle these\n"
"\tdisks at the moment. Nevertheless some\n"
"\tadvice:\n"
"\t1. fdisk will destroy its contents on write.\n"
"\t2. Be sure that this disk is NOT a still vital\n"
"\t part of a volume group. (Otherwise you may\n"
"\t erase the other disks as well, if unmirrored.)\n"
"\t3. Before deleting this physical volume be sure\n"
"\t to remove the disk logically from your AIX\n"
"\t machine. (Otherwise you become an AIXpert).")
puts("\n"
"There is a valid AIX label on this disk.\n"
"Unfortunately Linux cannot handle these disks at the moment.\n"
"Nevertheless some advice:\n"
"1. fdisk will destroy its contents on write.\n"
"2. Be sure that this disk is NOT a still vital part of a volume group.\n"
" (Otherwise you may erase the other disks as well, if unmirrored.)\n"
"3. Before deleting this physical volume be sure to remove the disk\n"
" logically from your AIX machine. (Otherwise you become an AIXpert).\n"
);
}

View File

@ -195,29 +195,29 @@ static const char * const xbsd_dktypenames[] = {
#define BSD_FS_MSDOS 8 /* MS-DOS file system */
#endif
static const struct systypes xbsd_fstypes[] = {
{ "\x00" "unused" }, /* BSD_FS_UNUSED */
{ "\x01" "swap" }, /* BSD_FS_SWAP */
{ "\x02" "Version 6" }, /* BSD_FS_V6 */
{ "\x03" "Version 7" }, /* BSD_FS_V7 */
{ "\x04" "System V" }, /* BSD_FS_SYSV */
{ "\x05" "4.1BSD" }, /* BSD_FS_V71K */
{ "\x06" "Eighth Edition" }, /* BSD_FS_V8 */
{ "\x07" "4.2BSD" }, /* BSD_FS_BSDFFS */
static const char *const xbsd_fstypes[] = {
"\x00" "unused", /* BSD_FS_UNUSED */
"\x01" "swap", /* BSD_FS_SWAP */
"\x02" "Version 6", /* BSD_FS_V6 */
"\x03" "Version 7", /* BSD_FS_V7 */
"\x04" "System V", /* BSD_FS_SYSV */
"\x05" "4.1BSD", /* BSD_FS_V71K */
"\x06" "Eighth Edition", /* BSD_FS_V8 */
"\x07" "4.2BSD", /* BSD_FS_BSDFFS */
#ifdef __alpha__
{ "\x08" "ext2" }, /* BSD_FS_EXT2 */
"\x08" "ext2", /* BSD_FS_EXT2 */
#else
{ "\x08" "MS-DOS" }, /* BSD_FS_MSDOS */
"\x08" "MS-DOS", /* BSD_FS_MSDOS */
#endif
{ "\x09" "4.4LFS" }, /* BSD_FS_BSDLFS */
{ "\x0a" "unknown" }, /* BSD_FS_OTHER */
{ "\x0b" "HPFS" }, /* BSD_FS_HPFS */
{ "\x0c" "ISO-9660" }, /* BSD_FS_ISO9660 */
{ "\x0d" "boot" }, /* BSD_FS_BOOT */
{ "\x0e" "ADOS" }, /* BSD_FS_ADOS */
{ "\x0f" "HFS" }, /* BSD_FS_HFS */
{ "\x10" "AdvFS" }, /* BSD_FS_ADVFS */
{ NULL }
"\x09" "4.4LFS", /* BSD_FS_BSDLFS */
"\x0a" "unknown", /* BSD_FS_OTHER */
"\x0b" "HPFS", /* BSD_FS_HPFS */
"\x0c" "ISO-9660", /* BSD_FS_ISO9660 */
"\x0d" "boot", /* BSD_FS_BOOT */
"\x0e" "ADOS", /* BSD_FS_ADOS */
"\x0f" "HFS", /* BSD_FS_HFS */
"\x10" "AdvFS", /* BSD_FS_ADVFS */
NULL
};
#define BSD_FSMAXTYPES (SIZE(xbsd_fstypes)-1)
@ -257,9 +257,9 @@ static int xbsd_get_part_index(int max);
static int xbsd_check_new_partition(int *i);
static void xbsd_list_types(void);
static uint16_t xbsd_dkcksum(struct xbsd_disklabel *lp);
static int xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d);
static int xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d);
static int xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d);
static int xbsd_initlabel(struct partition *p);
static int xbsd_readlabel(struct partition *p);
static int xbsd_writelabel(struct partition *p);
#if defined(__alpha__)
static void alpha_bootblock_checksum(char *boot);
@ -272,11 +272,22 @@ static struct partition *xbsd_part;
static int xbsd_part_index;
#endif
/* Group big globals data and allocate it in one go */
struct bsd_globals {
/* We access this through a uint64_t * when checksumming */
/* hopefully xmalloc gives us required alignment */
static char *disklabelbuffer; /*[BSD_BBSIZE]*/
char disklabelbuffer[BSD_BBSIZE];
struct xbsd_disklabel xbsd_dlabel;
};
static struct xbsd_disklabel xbsd_dlabel;
static struct bsd_globals *bsd_globals_ptr;
#define disklabelbuffer (bsd_globals_ptr->disklabelbuffer)
#define xbsd_dlabel (bsd_globals_ptr->xbsd_dlabel)
/* Code */
#define bsd_cround(n) \
(display_in_cyl_units ? ((n)/xbsd_dlabel.d_secpercyl) + 1 : (n))
@ -290,7 +301,7 @@ static struct xbsd_disklabel xbsd_dlabel;
static int
check_osf_label(void)
{
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
if (xbsd_readlabel(NULL) == 0)
return 0;
return 1;
}
@ -298,9 +309,9 @@ check_osf_label(void)
static int
bsd_trydev(const char * dev)
{
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
if (xbsd_readlabel(NULL) == 0)
return -1;
printf(_("\nBSD label for device: %s\n"), dev);
printf("\nBSD label for device: %s\n", dev);
xbsd_print_disklabel(0);
return 0;
}
@ -308,21 +319,21 @@ bsd_trydev(const char * dev)
static void
bsd_menu(void)
{
puts(_("Command Action"));
puts(_("d\tdelete a BSD partition"));
puts(_("e\tedit drive data"));
puts(_("i\tinstall bootstrap"));
puts(_("l\tlist known filesystem types"));
puts(_("n\tadd a new BSD partition"));
puts(_("p\tprint BSD partition table"));
puts(_("q\tquit without saving changes"));
puts(_("r\treturn to main menu"));
puts(_("s\tshow complete disklabel"));
puts(_("t\tchange a partition's filesystem id"));
puts(_("u\tchange units (cylinders/sectors)"));
puts(_("w\twrite disklabel to disk"));
puts("Command Action");
puts("d\tdelete a BSD partition");
puts("e\tedit drive data");
puts("i\tinstall bootstrap");
puts("l\tlist known filesystem types");
puts("n\tadd a new BSD partition");
puts("p\tprint BSD partition table");
puts("q\tquit without saving changes");
puts("r\treturn to main menu");
puts("s\tshow complete disklabel");
puts("t\tchange a partition's filesystem id");
puts("u\tchange units (cylinders/sectors)");
puts("w\twrite disklabel to disk");
#if !defined(__alpha__)
puts(_("x\tlink BSD partition to non-BSD partition"));
puts("x\tlink BSD partition to non-BSD partition");
#endif
}
@ -357,13 +368,13 @@ bsd_select(void)
xbsd_part_index = t;
ss = get_start_sect(xbsd_part);
if (ss == 0) {
fprintf(stderr, _("Partition %s has invalid starting sector 0.\n"),
printf("Partition %s has invalid starting sector 0\n",
partname(disk_device, t+1, 0));
return;
}
printf(_("Reading disklabel of %s at sector %d.\n"),
printf("Reading disklabel of %s at sector %d\n",
partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR);
if (xbsd_readlabel(xbsd_part, &xbsd_dlabel) == 0)
if (xbsd_readlabel(xbsd_part) == 0)
if (xbsd_create_disklabel() == 0)
return;
break;
@ -371,13 +382,13 @@ bsd_select(void)
}
if (t == 4) {
printf(_("There is no *BSD partition on %s.\n"), disk_device);
printf("There is no *BSD partition on %s\n", disk_device);
return;
}
#elif defined(__alpha__)
if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
if (xbsd_readlabel(NULL) == 0)
if (xbsd_create_disklabel() == 0)
exit(EXIT_SUCCESS);
@ -385,7 +396,7 @@ bsd_select(void)
while (1) {
putchar('\n');
switch (tolower(read_nonempty(_("BSD disklabel command (m for help): ")))) {
switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
case 'd':
xbsd_delete_part();
break;
@ -465,14 +476,14 @@ xbsd_new_part(void)
end = xbsd_dlabel.d_secperunit - 1;
#endif
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
begin = read_int(bsd_cround(begin), bsd_cround(begin), bsd_cround(end),
0, mesg);
if (display_in_cyl_units)
begin = (begin - 1) * xbsd_dlabel.d_secpercyl;
snprintf(mesg, sizeof(mesg), _("Last %s or +size or +sizeM or +sizeK"),
snprintf(mesg, sizeof(mesg), "Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
end = read_int(bsd_cround(begin), bsd_cround(end), bsd_cround(end),
bsd_cround(begin), mesg);
@ -499,35 +510,35 @@ xbsd_print_disklabel(int show_all)
printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0));
#endif
if ((unsigned) lp->d_type < BSD_DKMAXTYPES)
printf(_("type: %s\n"), xbsd_dktypenames[lp->d_type]);
printf("type: %s\n", xbsd_dktypenames[lp->d_type]);
else
printf(_("type: %d\n"), lp->d_type);
printf(_("disk: %.*s\n"), (int) sizeof(lp->d_typename), lp->d_typename);
printf(_("label: %.*s\n"), (int) sizeof(lp->d_packname), lp->d_packname);
printf(_("flags:"));
printf("type: %d\n", lp->d_type);
printf("disk: %.*s\n", (int) sizeof(lp->d_typename), lp->d_typename);
printf("label: %.*s\n", (int) sizeof(lp->d_packname), lp->d_packname);
printf("flags:");
if (lp->d_flags & BSD_D_REMOVABLE)
printf(_(" removable"));
printf(" removable");
if (lp->d_flags & BSD_D_ECC)
printf(_(" ecc"));
printf(" ecc");
if (lp->d_flags & BSD_D_BADSECT)
printf(_(" badsect"));
printf(" badsect");
puts("");
/* On various machines the fields of *lp are short/int/long */
/* In order to avoid problems, we cast them all to long. */
printf(_("bytes/sector: %ld\n"), (long) lp->d_secsize);
printf(_("sectors/track: %ld\n"), (long) lp->d_nsectors);
printf(_("tracks/cylinder: %ld\n"), (long) lp->d_ntracks);
printf(_("sectors/cylinder: %ld\n"), (long) lp->d_secpercyl);
printf(_("cylinders: %ld\n"), (long) lp->d_ncylinders);
printf(_("rpm: %d\n"), lp->d_rpm);
printf(_("interleave: %d\n"), lp->d_interleave);
printf(_("trackskew: %d\n"), lp->d_trackskew);
printf(_("cylinderskew: %d\n"), lp->d_cylskew);
printf(_("headswitch: %ld\t\t# milliseconds\n"),
printf("bytes/sector: %ld\n", (long) lp->d_secsize);
printf("sectors/track: %ld\n", (long) lp->d_nsectors);
printf("tracks/cylinder: %ld\n", (long) lp->d_ntracks);
printf("sectors/cylinder: %ld\n", (long) lp->d_secpercyl);
printf("cylinders: %ld\n", (long) lp->d_ncylinders);
printf("rpm: %d\n", lp->d_rpm);
printf("interleave: %d\n", lp->d_interleave);
printf("trackskew: %d\n", lp->d_trackskew);
printf("cylinderskew: %d\n", lp->d_cylskew);
printf("headswitch: %ld\t\t# milliseconds\n",
(long) lp->d_headswitch);
printf(_("track-to-track seek: %ld\t# milliseconds\n"),
printf("track-to-track seek: %ld\t# milliseconds\n",
(long) lp->d_trkseek);
printf(_("drivedata: "));
printf("drivedata: ");
for (i = NDDATA - 1; i >= 0; i--)
if (lp->d_drivedata[i])
break;
@ -536,8 +547,8 @@ xbsd_print_disklabel(int show_all)
for (j = 0; j <= i; j++)
printf("%ld ", (long) lp->d_drivedata[j]);
}
printf(_("\n%d partitions:\n"), lp->d_npartitions);
printf(_("# start end size fstype [fsize bsize cpg]\n"));
printf("\n%d partitions:\n", lp->d_npartitions);
printf("# start end size fstype [fsize bsize cpg]\n");
pp = lp->d_partitions;
for (i = 0; i < lp->d_npartitions; i++, pp++) {
if (pp->p_size) {
@ -561,7 +572,7 @@ xbsd_print_disklabel(int show_all)
}
if ((unsigned) pp->p_fstype < BSD_FSMAXTYPES)
printf("%8.8s", xbsd_fstypes[pp->p_fstype].name);
printf("%8.8s", xbsd_fstypes[pp->p_fstype]);
else
printf("%8x", pp->p_fstype);
@ -587,12 +598,12 @@ static void
xbsd_write_disklabel(void)
{
#if defined(__alpha__)
printf(_("Writing disklabel to %s.\n"), disk_device);
xbsd_writelabel(NULL, &xbsd_dlabel);
printf("Writing disklabel to %s\n", disk_device);
xbsd_writelabel(NULL);
#else
printf(_("Writing disklabel to %s.\n"),
printf("Writing disklabel to %s\n",
partname(disk_device, xbsd_part_index + 1, 0));
xbsd_writelabel(xbsd_part, &xbsd_dlabel);
xbsd_writelabel(xbsd_part);
#endif
reread_partition_table(0); /* no exit yet */
}
@ -603,21 +614,21 @@ xbsd_create_disklabel(void)
char c;
#if defined(__alpha__)
fprintf(stderr, _("%s contains no disklabel.\n"), disk_device);
printf("%s contains no disklabel\n", disk_device);
#else
fprintf(stderr, _("%s contains no disklabel.\n"),
printf("%s contains no disklabel\n",
partname(disk_device, xbsd_part_index + 1, 0));
#endif
while (1) {
c = read_nonempty(_("Do you want to create a disklabel? (y/n) "));
c = read_nonempty("Do you want to create a disklabel? (y/n) ");
if (c == 'y' || c == 'Y') {
if (xbsd_initlabel(
#if defined(__alpha__) || defined(__powerpc__) || defined(__hppa__) || \
defined(__s390__) || defined(__s390x__)
NULL, &xbsd_dlabel
NULL
#else
xbsd_part, &xbsd_dlabel/* not used, xbsd_part_index*/
xbsd_part
#endif
) == 1) {
xbsd_print_disklabel(1);
@ -651,27 +662,27 @@ xbsd_edit_disklabel(void)
d = &xbsd_dlabel;
#if defined(__alpha__) || defined(__ia64__)
d->d_secsize = edit_int(d->d_secsize ,_("bytes/sector"));
d->d_nsectors = edit_int(d->d_nsectors ,_("sectors/track"));
d->d_ntracks = edit_int(d->d_ntracks ,_("tracks/cylinder"));
d->d_ncylinders = edit_int(d->d_ncylinders ,_("cylinders"));
d->d_secsize = edit_int(d->d_secsize , "bytes/sector");
d->d_nsectors = edit_int(d->d_nsectors , "sectors/track");
d->d_ntracks = edit_int(d->d_ntracks , "tracks/cylinder");
d->d_ncylinders = edit_int(d->d_ncylinders , "cylinders");
#endif
/* d->d_secpercyl can be != d->d_nsectors * d->d_ntracks */
while (1) {
d->d_secpercyl = edit_int(d->d_nsectors * d->d_ntracks,
_("sectors/cylinder"));
"sectors/cylinder");
if (d->d_secpercyl <= d->d_nsectors * d->d_ntracks)
break;
printf(_("Must be <= sectors/track * tracks/cylinder (default).\n"));
printf("Must be <= sectors/track * tracks/cylinder (default)\n");
}
d->d_rpm = edit_int(d->d_rpm ,_("rpm"));
d->d_interleave = edit_int(d->d_interleave,_("interleave"));
d->d_trackskew = edit_int(d->d_trackskew ,_("trackskew"));
d->d_cylskew = edit_int(d->d_cylskew ,_("cylinderskew"));
d->d_headswitch = edit_int(d->d_headswitch,_("headswitch"));
d->d_trkseek = edit_int(d->d_trkseek ,_("track-to-track seek"));
d->d_rpm = edit_int(d->d_rpm , "rpm");
d->d_interleave = edit_int(d->d_interleave, "interleave");
d->d_trackskew = edit_int(d->d_trackskew , "trackskew");
d->d_cylskew = edit_int(d->d_cylskew , "cylinderskew");
d->d_headswitch = edit_int(d->d_headswitch, "headswitch");
d->d_trkseek = edit_int(d->d_trkseek , "track-to-track seek");
d->d_secperunit = d->d_secpercyl * d->d_ncylinders;
}
@ -699,9 +710,9 @@ xbsd_get_bootstrap(char *path, void *ptr, int size)
static void
sync_disks(void)
{
printf(_("\nSyncing disks.\n"));
printf("Syncing disks\n");
sync();
sleep(4); /* What? */
/* sleep(4); What? */
}
static void
@ -743,7 +754,7 @@ xbsd_write_bootstrap(void)
e = d + sizeof(struct xbsd_disklabel);
for (p = d; p < e; p++)
if (*p) {
fprintf(stderr, _("Bootstrap overlaps with disk label!\n"));
printf("Bootstrap overlaps with disk label!\n");
exit(EXIT_FAILURE);
}
@ -764,9 +775,9 @@ xbsd_write_bootstrap(void)
fdisk_fatal(unable_to_write);
#if defined(__alpha__)
printf(_("Bootstrap installed on %s.\n"), disk_device);
printf("Bootstrap installed on %s\n", disk_device);
#else
printf(_("Bootstrap installed on %s.\n"),
printf("Bootstrap installed on %s\n",
partname(disk_device, xbsd_part_index+1, 0));
#endif
@ -785,10 +796,10 @@ xbsd_change_fstype(void)
static int
xbsd_get_part_index(int max)
{
char prompt[256];
char prompt[sizeof("Partition (a-%c): ") + 16];
char l;
snprintf(prompt, sizeof(prompt), _("Partition (a-%c): "), 'a' + max - 1);
snprintf(prompt, sizeof(prompt), "Partition (a-%c): ", 'a' + max - 1);
do
l = tolower(read_nonempty(prompt));
while (l < 'a' || l > 'a' + max - 1);
@ -807,8 +818,7 @@ xbsd_check_new_partition(int *i)
break;
if (t == BSD_MAXPARTITIONS) {
fprintf(stderr, _("The maximum number of partitions "
"has been created\n"));
printf("The maximum number of partitions has been created\n");
return 0;
}
}
@ -819,7 +829,7 @@ xbsd_check_new_partition(int *i)
xbsd_dlabel.d_npartitions = (*i) + 1;
if (xbsd_dlabel.d_partitions[*i].p_size != 0) {
fprintf(stderr, _("This partition already exists.\n"));
printf("This partition already exists\n");
return 0;
}
@ -846,8 +856,9 @@ xbsd_dkcksum(struct xbsd_disklabel *lp)
}
static int
xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
xbsd_initlabel(struct partition *p)
{
struct xbsd_disklabel *d = &xbsd_dlabel;
struct xbsd_partition *pp;
get_geometry();
@ -897,7 +908,7 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
pp->p_offset = 0;
pp->p_size = d->d_secperunit;
pp->p_fstype = BSD_FS_UNUSED;
#elif defined(__alpha__)
#else
d->d_npartitions = 3;
pp = &d->d_partitions[2]; /* Partition C should be
the whole disk */
@ -914,17 +925,20 @@ xbsd_initlabel(struct partition *p, struct xbsd_disklabel *d)
* If it has the right magic, return 1.
*/
static int
xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
xbsd_readlabel(struct partition *p)
{
struct xbsd_disklabel *d;
int t, sector;
if (!disklabelbuffer)
disklabelbuffer = xmalloc(BSD_BBSIZE);
if (!bsd_globals_ptr)
bsd_globals_ptr = xzalloc(sizeof(*bsd_globals_ptr));
d = &xbsd_dlabel;
/* p is used only to get the starting sector */
#if !defined(__alpha__)
sector = (p ? get_start_sect(p) : 0);
#elif defined(__alpha__)
#else
sector = 0;
#endif
@ -946,15 +960,15 @@ xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
}
if (d->d_npartitions > BSD_MAXPARTITIONS)
fprintf(stderr, _("Warning: too many partitions "
"(%d, maximum is %d).\n"),
printf("Warning: too many partitions (%d, maximum is %d)\n",
d->d_npartitions, BSD_MAXPARTITIONS);
return 1;
}
static int
xbsd_writelabel(struct partition *p, struct xbsd_disklabel *d)
xbsd_writelabel(struct partition *p)
{
struct xbsd_disklabel *d = &xbsd_dlabel;
unsigned int sector;
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__hppa__)
@ -1028,7 +1042,6 @@ xbsd_link_part(void)
#endif
#if defined(__alpha__)
static void
alpha_bootblock_checksum(char *boot)
{
@ -1043,4 +1056,8 @@ alpha_bootblock_checksum(char *boot)
}
#endif /* __alpha__ */
/* Undefine 'global' tricks */
#undef disklabelbuffer
#undef xbsd_dlabel
#endif /* OSF_LABEL */

View File

@ -6,6 +6,20 @@
* the terms of the GNU Public License.
*/
#define SGI_VOLHDR 0x00
/* 1 and 2 were used for drive types no longer supported by SGI */
#define SGI_SWAP 0x03
/* 4 and 5 were for filesystem types SGI haven't ever supported on MIPS CPUs */
#define SGI_VOLUME 0x06
#define SGI_EFS 0x07
#define SGI_LVOL 0x08
#define SGI_RLVOL 0x09
#define SGI_XFS 0x0a
#define SGI_XFSLOG 0x0b
#define SGI_XLV 0x0c
#define SGI_XVM 0x0d
#define SGI_ENTIRE_DISK SGI_VOLUME
struct device_parameter { /* 48 bytes */
unsigned char skew;
unsigned char gap1;
@ -159,26 +173,26 @@ isinfreelist(unsigned int b)
* end of free blocks section
*/
static const struct systypes sgi_sys_types[] = {
/* SGI_VOLHDR */ { "\x00" "SGI volhdr" },
/* 0x01 */ { "\x01" "SGI trkrepl" },
/* 0x02 */ { "\x02" "SGI secrepl" },
/* SGI_SWAP */ { "\x03" "SGI raw" },
/* 0x04 */ { "\x04" "SGI bsd" },
/* 0x05 */ { "\x05" "SGI sysv" },
/* SGI_ENTIRE_DISK */ { "\x06" "SGI volume" },
/* SGI_EFS */ { "\x07" "SGI efs" },
/* 0x08 */ { "\x08" "SGI lvol" },
/* 0x09 */ { "\x09" "SGI rlvol" },
/* SGI_XFS */ { "\x0a" "SGI xfs" },
/* SGI_XFSLOG */ { "\x0b" "SGI xfslog" },
/* SGI_XLV */ { "\x0c" "SGI xlv" },
/* SGI_XVM */ { "\x0d" "SGI xvm" },
/* LINUX_SWAP */ { "\x82" "Linux swap" },
/* LINUX_NATIVE */ { "\x83" "Linux native" },
/* LINUX_LVM */ { "\x8d" "Linux LVM" },
/* LINUX_RAID */ { "\xfd" "Linux RAID" },
{ NULL }
static const char *const sgi_sys_types[] = {
/* SGI_VOLHDR */ "\x00" "SGI volhdr" ,
/* 0x01 */ "\x01" "SGI trkrepl" ,
/* 0x02 */ "\x02" "SGI secrepl" ,
/* SGI_SWAP */ "\x03" "SGI raw" ,
/* 0x04 */ "\x04" "SGI bsd" ,
/* 0x05 */ "\x05" "SGI sysv" ,
/* SGI_ENTIRE_DISK */ "\x06" "SGI volume" ,
/* SGI_EFS */ "\x07" "SGI efs" ,
/* 0x08 */ "\x08" "SGI lvol" ,
/* 0x09 */ "\x09" "SGI rlvol" ,
/* SGI_XFS */ "\x0a" "SGI xfs" ,
/* SGI_XFSLOG */ "\x0b" "SGI xfslog" ,
/* SGI_XLV */ "\x0c" "SGI xlv" ,
/* SGI_XVM */ "\x0d" "SGI xvm" ,
/* LINUX_SWAP */ "\x82" "Linux swap" ,
/* LINUX_NATIVE */ "\x83" "Linux native",
/* LINUX_LVM */ "\x8d" "Linux LVM" ,
/* LINUX_RAID */ "\xfd" "Linux RAID" ,
NULL
};
@ -206,18 +220,20 @@ two_s_complement_32bit_sum(unsigned int* base, int size /* in bytes */)
return sum;
}
void BUG_bad_sgi_partition_size(void);
static int
check_sgi_label(void)
{
if (sizeof(sgilabel) > 512) {
fprintf(stderr,
_("According to MIPS Computer Systems, Inc the "
"Label must not contain more than 512 bytes\n"));
exit(1);
if (sizeof(sgi_partition) > 512) {
/* According to MIPS Computer Systems, Inc the label
* must not contain more than 512 bytes */
BUG_bad_sgi_partition_size();
}
if (sgilabel->magic != SGI_LABEL_MAGIC
&& sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED) {
&& sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED
) {
current_label_type = label_dos;
return 0;
}
@ -228,8 +244,7 @@ check_sgi_label(void)
*/
if (two_s_complement_32bit_sum((unsigned int*)sgilabel,
sizeof(*sgilabel))) {
fprintf(stderr,
_("Detected sgi disklabel with wrong checksum.\n"));
printf("Detected sgi disklabel with wrong checksum\n");
}
update_units();
current_label_type = label_sgi;
@ -274,12 +289,12 @@ sgi_list_table(int xtra)
int i, w, wd;
int kpi = 0; /* kernel partition ID */
if(xtra) {
printf(_("\nDisk %s (SGI disk label): %d heads, %d sectors\n"
if (xtra) {
printf("\nDisk %s (SGI disk label): %d heads, %d sectors\n"
"%d cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
"Units = %s of %d * 512 bytes\n\n"),
"Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
SGI_SSWAP16(sgiparam.pcylcount),
SGI_SSWAP16(sgiparam.sparecyl),
@ -287,23 +302,23 @@ sgi_list_table(int xtra)
(char *)sgilabel,
str_units(PLURAL), units_per_sector);
} else {
printf( _("\nDisk %s (SGI disk label): "
printf("\nDisk %s (SGI disk label): "
"%d heads, %d sectors, %d cylinders\n"
"Units = %s of %d * 512 bytes\n\n"),
"Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector );
}
w = strlen(disk_device);
wd = strlen(_("Device"));
wd = sizeof("Device") - 1;
if (w < wd)
w = wd;
printf(_("----- partitions -----\n"
"Pt# %*s Info Start End Sectors Id System\n"),
w + 2, _("Device"));
printf("----- partitions -----\n"
"Pt# %*s Info Start End Sectors Id System\n",
w + 2, "Device");
for (i = 0 ; i < partitions; i++) {
if( sgi_get_num_sectors(i) || debug ) {
if (sgi_get_num_sectors(i) || debug ) {
uint32_t start = sgi_get_start_sector(i);
uint32_t len = sgi_get_num_sectors(i);
kpi++; /* only count nonempty partitions */
@ -320,8 +335,8 @@ sgi_list_table(int xtra)
/* type name */ partition_type(sgi_get_sysid(i)));
}
}
printf(_("----- Bootinfo -----\nBootfile: %s\n"
"----- Directory Entries -----\n"),
printf("----- Bootinfo -----\nBootfile: %s\n"
"----- Directory Entries -----\n",
sgilabel->boot_file);
for (i = 0 ; i < sgi_volumes; i++) {
if (sgilabel->directory[i].vol_file_size) {
@ -329,7 +344,7 @@ sgi_list_table(int xtra)
uint32_t len = SGI_SSWAP32(sgilabel->directory[i].vol_file_size);
unsigned char *name = sgilabel->directory[i].vol_file_name;
printf(_("%2d: %-10s sector%5u size%8u\n"),
printf("%2d: %-10s sector%5u size%8u\n",
i, (char*)name, (unsigned int) start, (unsigned int) len);
}
}
@ -357,26 +372,22 @@ static int
sgi_check_bootfile(const char* aFile)
{
if (strlen(aFile) < 3) /* "/a\n" is minimum */ {
printf(_("\nInvalid Bootfile!\n"
printf("\nInvalid Bootfile!\n"
"\tThe bootfile must be an absolute non-zero pathname,\n"
"\te.g. \"/unix\" or \"/unix.save\".\n"));
"\te.g. \"/unix\" or \"/unix.save\".\n");
return 0;
} else {
}
if (strlen(aFile) > 16) {
printf(_("\n\tName of Bootfile too long: "
"16 bytes maximum.\n"));
printf("\nName of Bootfile too long (>16 bytes)\n");
return 0;
} else {
}
if (aFile[0] != '/') {
printf(_("\n\tBootfile must have a "
"fully qualified pathname.\n"));
printf("\nBootfile must have a fully qualified pathname\n");
return 0;
}
}
}
if (strncmp(aFile, (char*)sgilabel->boot_file, 16)) {
printf(_("\n\tBe aware, that the bootfile is not checked for existence.\n\t"
"SGI's default is \"/unix\" and for backup \"/unix.save\".\n"));
printf("\nBe aware, that the bootfile is not checked for existence.\n"
"\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n");
/* filename is correct and did change */
return 1;
}
@ -403,7 +414,7 @@ sgi_set_bootfile(const char* aFile)
sgilabel->boot_file[i] = 0;
i++;
}
printf(_("\n\tBootfile is changed to \"%s\".\n"), sgilabel->boot_file);
printf("\n\tBootfile is changed to \"%s\"\n", sgilabel->boot_file);
}
}
@ -484,34 +495,34 @@ verify_sgi(int verbose)
if (sgi_get_sysid(i) == SGI_ENTIRE_DISK) {
if (entire++ == 1) {
if (verbose)
printf(_("More than one entire disk entry present.\n"));
printf("More than one entire disk entry present\n");
}
}
}
}
if (sortcount == 0) {
if (verbose)
printf(_("No partitions defined\n"));
printf("No partitions defined\n");
return (lastblock > 0) ? 1 : (lastblock == 0) ? 0 : -1;
}
qsort(Index, sortcount, sizeof(Index[0]), (void*)compare_start);
if (sgi_get_sysid(Index[0]) == SGI_ENTIRE_DISK) {
if ((Index[0] != 10) && verbose)
printf(_("IRIX likes when Partition 11 covers the entire disk.\n"));
printf("IRIX likes when Partition 11 covers the entire disk\n");
if ((sgi_get_start_sector(Index[0]) != 0) && verbose)
printf(_("The entire disk partition should start "
printf("The entire disk partition should start "
"at block 0,\n"
"not at diskblock %d.\n"),
"not at diskblock %d\n",
sgi_get_start_sector(Index[0]));
if (debug) /* I do not understand how some disks fulfil it */
if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose)
printf(_("The entire disk partition is only %d diskblock large,\n"
"but the disk is %d diskblocks long.\n"),
printf("The entire disk partition is only %d diskblock large,\n"
"but the disk is %d diskblocks long\n",
sgi_get_num_sectors(Index[0]), lastblock);
lastblock = sgi_get_num_sectors(Index[0]);
} else {
if (verbose)
printf(_("One Partition (#11) should cover the entire disk.\n"));
printf("One Partition (#11) should cover the entire disk\n");
if (debug > 2)
printf("sysid=%d\tpartition=%d\n",
sgi_get_sysid(Index[0]), Index[0]+1);
@ -522,20 +533,20 @@ verify_sgi(int verbose)
if ((sgi_get_start_sector(Index[i]) % cylsize) != 0) {
if (debug) /* I do not understand how some disks fulfil it */
if (verbose)
printf(_("Partition %d does not start on cylinder boundary.\n"),
printf("Partition %d does not start on cylinder boundary\n",
Index[i]+1);
}
if (sgi_get_num_sectors(Index[i]) % cylsize != 0) {
if (debug) /* I do not understand how some disks fulfil it */
if (verbose)
printf(_("Partition %d does not end on cylinder boundary.\n"),
printf("Partition %d does not end on cylinder boundary\n",
Index[i]+1);
}
/* We cannot handle several "entire disk" entries. */
if (sgi_get_sysid(Index[i]) == SGI_ENTIRE_DISK) continue;
if (start > sgi_get_start_sector(Index[i])) {
if (verbose)
printf(_("The Partition %d and %d overlap by %d sectors.\n"),
printf("Partitions %d and %d overlap by %d sectors\n",
Index[i-1]+1, Index[i]+1,
start - sgi_get_start_sector(Index[i]));
if (gap > 0) gap = -gap;
@ -543,7 +554,7 @@ verify_sgi(int verbose)
}
if (start < sgi_get_start_sector(Index[i])) {
if (verbose)
printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"),
printf("Unused gap of %8u sectors - sectors %8u-%8u\n",
sgi_get_start_sector(Index[i]) - start,
start, sgi_get_start_sector(Index[i])-1);
gap += sgi_get_start_sector(Index[i]) - start;
@ -561,7 +572,7 @@ verify_sgi(int verbose)
}
if (start < lastblock) {
if (verbose)
printf(_("Unused gap of %8u sectors - sectors %8u-%u\n"),
printf("Unused gap of %8u sectors - sectors %8u-%8u\n",
lastblock - start, start, lastblock-1);
gap += lastblock - start;
add2freelist(start, lastblock);
@ -572,17 +583,17 @@ verify_sgi(int verbose)
*/
if (verbose) {
if (!sgi_get_num_sectors(sgi_get_bootpartition())) {
printf(_("\nThe boot partition does not exist.\n"));
printf("\nThe boot partition does not exist\n");
}
if (!sgi_get_num_sectors(sgi_get_swappartition())) {
printf(_("\nThe swap partition does not exist.\n"));
printf("\nThe swap partition does not exist\n");
} else {
if ((sgi_get_sysid(sgi_get_swappartition()) != SGI_SWAP)
&& (sgi_get_sysid(sgi_get_swappartition()) != LINUX_SWAP))
printf(_("\nThe swap partition has no swap type.\n"));
printf("\nThe swap partition has no swap type\n");
}
if (sgi_check_bootfile("/unix"))
printf(_("\tYou have chosen an unusual boot file name.\n"));
printf("\tYou have chosen an unusual boot file name\n");
}
return (gap > 0) ? 1 : (gap == 0) ? 0 : -1;
}
@ -602,19 +613,20 @@ sgi_gaps(void)
static void
sgi_change_sysid(int i, int sys)
{
if( sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */
printf(_("Sorry You may change the Tag of non-empty partitions.\n"));
if (sgi_get_num_sectors(i) == 0 ) { /* caught already before, ... */
printf("Sorry you may change the Tag of non-empty partitions\n");
return;
}
if (((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR))
&& (sgi_get_start_sector(i) < 1) ) {
if ((sys != SGI_ENTIRE_DISK) && (sys != SGI_VOLHDR)
&& (sgi_get_start_sector(i) < 1)
) {
read_maybe_empty(
_("It is highly recommended that the partition at offset 0\n"
"It is highly recommended that the partition at offset 0\n"
"is of type \"SGI volhdr\", the IRIX system will rely on it to\n"
"retrieve from its directory standalone tools like sash and fx.\n"
"Only the \"SGI volume\" entire disk section may violate this.\n"
"Type YES if you are sure about tagging this partition differently.\n"));
if (strcmp(line_ptr, _("YES\n")))
"Type YES if you are sure about tagging this partition differently.\n");
if (strcmp(line_ptr, "YES\n") != 0)
return;
}
sgilabel->partitions[i].id = SGI_SSWAP32(sys);
@ -640,7 +652,7 @@ sgi_set_partition(int i, unsigned int start, unsigned int length, int sys)
sgilabel->partitions[i].start_sector = SGI_SSWAP32(start);
set_changed(i);
if (sgi_gaps() < 0) /* rebuild freelist */
printf(_("Do You know, You got a partition overlap on the disk?\n"));
printf("Partition overlap detected\n");
}
static void
@ -649,7 +661,7 @@ sgi_set_entire(void)
int n;
for (n = 10; n < partitions; n++) {
if(!sgi_get_num_sectors(n) ) {
if (!sgi_get_num_sectors(n) ) {
sgi_set_partition(n, 0, sgi_get_lastblock(), SGI_VOLUME);
break;
}
@ -693,32 +705,31 @@ sgi_add_partition(int n, int sys)
} else if (n == 8) {
sys = 0;
}
if(sgi_get_num_sectors(n)) {
printf(_("Partition %d is already defined. Delete "
"it before re-adding it.\n"), n + 1);
if (sgi_get_num_sectors(n)) {
printf(msg_part_already_defined, n + 1);
return;
}
if ((sgi_entire() == -1) && (sys != SGI_VOLUME)) {
printf(_("Attempting to generate entire disk entry automatically.\n"));
printf("Attempting to generate entire disk entry automatically\n");
sgi_set_entire();
sgi_set_volhdr();
}
if ((sgi_gaps() == 0) && (sys != SGI_VOLUME)) {
printf(_("The entire disk is already covered with partitions.\n"));
printf("The entire disk is already covered with partitions\n");
return;
}
if (sgi_gaps() < 0) {
printf(_("You got a partition overlap on the disk. Fix it first!\n"));
printf("You got a partition overlap on the disk. Fix it first!\n");
return;
}
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
while (1) {
if(sys == SGI_VOLUME) {
if (sys == SGI_VOLUME) {
last = sgi_get_lastblock();
first = read_int(0, 0, last-1, 0, mesg);
if (first != 0) {
printf(_("It is highly recommended that eleventh partition\n"
"covers the entire disk and is of type 'SGI volume'\n"));
printf("It is highly recommended that eleventh partition\n"
"covers the entire disk and is of type 'SGI volume'\n");
}
} else {
first = freelist[0].first;
@ -730,15 +741,14 @@ sgi_add_partition(int n, int sys)
first *= units_per_sector;
else
first = first; /* align to cylinder if you know how ... */
if(!last )
if (!last )
last = isinfreelist(first);
if(last == 0) {
printf(_("You will get a partition overlap on the disk. "
"Fix it first!\n"));
} else
if (last != 0)
break;
printf("You will get a partition overlap on the disk. "
"Fix it first!\n");
}
snprintf(mesg, sizeof(mesg), _(" Last %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), " Last %s", str_units(SINGULAR));
last = read_int(scround(first), scround(last)-1, scround(last)-1,
scround(first), mesg)+1;
if (display_in_cyl_units)
@ -746,8 +756,8 @@ sgi_add_partition(int n, int sys)
else
last = last; /* align to cylinder if You know how ... */
if ( (sys == SGI_VOLUME) && (first != 0 || last != sgi_get_lastblock() ) )
printf(_("It is highly recommended that eleventh partition\n"
"covers the entire disk and is of type 'SGI volume'\n"));
printf("It is highly recommended that eleventh partition\n"
"covers the entire disk and is of type 'SGI volume'\n");
sgi_set_partition(n, first, last-first, sys);
}
@ -768,10 +778,7 @@ create_sgilabel(void)
sec_fac = sector_size / 512; /* determine the sector factor */
fprintf( stderr,
_("Building a new SGI disklabel. Changes will remain in memory only,\n"
"until you decide to write them. After that, of course, the previous\n"
"content will be unrecoverably lost.\n\n"));
printf(msg_building_new_label, "SGI disklabel");
sgi_other_endian = (BYTE_ORDER == LITTLE_ENDIAN);
res = ioctl(fd, BLKGETSIZE, &longsectors);
@ -785,23 +792,21 @@ create_sgilabel(void)
} else {
/* otherwise print error and use truncated version */
cylinders = geometry.cylinders;
fprintf(stderr,
_("Warning: BLKGETSIZE ioctl failed on %s. "
"Using geometry cylinder value of %d.\n"
"This value may be truncated for devices"
" > 33.8 GB.\n"), disk_device, cylinders);
printf(
"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n"
"This value may be truncated for devices > 33.8 GB.\n", disk_device, cylinders);
}
}
for (i = 0; i < 4; i++) {
old[i].sysid = 0;
if (valid_part_table_flag(MBRbuffer)) {
if(get_part_table(i)->sys_ind) {
if (get_part_table(i)->sys_ind) {
old[i].sysid = get_part_table(i)->sys_ind;
old[i].start = get_start_sect(get_part_table(i));
old[i].nsect = get_nr_sects(get_part_table(i));
printf(_("Trying to keep parameters of partition %d.\n"), i);
printf("Trying to keep parameters of partition %d\n", i);
if (debug)
printf(_("ID=%02x\tSTART=%d\tLENGTH=%d\n"),
printf("ID=%02x\tSTART=%d\tLENGTH=%d\n",
old[i].sysid, old[i].start, old[i].nsect);
}
}
@ -851,7 +856,7 @@ create_sgilabel(void)
sgi_set_entire();
sgi_set_volhdr();
for (i = 0; i < 4; i++) {
if(old[i].sysid) {
if (old[i].sysid) {
sgi_set_partition(i, old[i].start, old[i].nsect, old[i].sysid);
}
}

View File

@ -1,5 +1,8 @@
#if ENABLE_FEATURE_SUN_LABEL
#define SUNOS_SWAP 3
#define SUN_WHOLE_DISK 5
#define SUN_LABEL_MAGIC 0xDABE
#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA
#define SUN_SSWAP16(x) (sun_other_endian ? fdisk_swap16(x) : (uint16_t)(x))
@ -57,22 +60,22 @@ guess_device_type(void)
}
}
static const struct systypes sun_sys_types[] = {
{ "\x00" "Empty" }, /* 0 */
{ "\x01" "Boot" }, /* 1 */
{ "\x02" "SunOS root" }, /* 2 */
{ "\x03" "SunOS swap" }, /* SUNOS_SWAP */
{ "\x04" "SunOS usr" }, /* 4 */
{ "\x05" "Whole disk" }, /* SUN_WHOLE_DISK */
{ "\x06" "SunOS stand" }, /* 6 */
{ "\x07" "SunOS var" }, /* 7 */
{ "\x08" "SunOS home" }, /* 8 */
{ "\x82" "Linux swap" }, /* LINUX_SWAP */
{ "\x83" "Linux native" }, /* LINUX_NATIVE */
{ "\x8e" "Linux LVM" }, /* 0x8e */
static const char *const sun_sys_types[] = {
"\x00" "Empty" , /* 0 */
"\x01" "Boot" , /* 1 */
"\x02" "SunOS root" , /* 2 */
"\x03" "SunOS swap" , /* SUNOS_SWAP */
"\x04" "SunOS usr" , /* 4 */
"\x05" "Whole disk" , /* SUN_WHOLE_DISK */
"\x06" "SunOS stand" , /* 6 */
"\x07" "SunOS var" , /* 7 */
"\x08" "SunOS home" , /* 8 */
"\x82" "Linux swap" , /* LINUX_SWAP */
"\x83" "Linux native", /* LINUX_NATIVE */
"\x8e" "Linux LVM" , /* 0x8e */
/* New (2.2.x) raid partition with autodetect using persistent superblock */
{ "\xfd" "Linux raid autodetect" }, /* 0xfd */
{ NULL }
"\xfd" "Linux raid autodetect", /* 0xfd */
NULL
};
@ -103,10 +106,10 @@ check_sun_label(void)
ush = ((unsigned short *) (sunlabel + 1)) - 1;
for (csum = 0; ush >= (unsigned short *)sunlabel;) csum ^= *ush--;
if (csum) {
fprintf(stderr,_("Detected sun disklabel with wrong checksum.\n"
"Probably you'll have to set all the values,\n"
"e.g. heads, sectors, cylinders and partitions\n"
"or force a fresh label (s command in main menu)\n"));
printf("Detected sun disklabel with wrong checksum.\n"
"Probably you'll have to set all the values,\n"
"e.g. heads, sectors, cylinders and partitions\n"
"or force a fresh label (s command in main menu)\n");
} else {
heads = SUN_SSWAP16(sunlabel->ntrks);
cylinders = SUN_SSWAP16(sunlabel->ncyl);
@ -209,7 +212,7 @@ sun_autoconfigure_scsi(void)
continue;
if (!strstr(model, sun_drives[i].model))
continue;
printf(_("Autoconfigure found a %s%s%s\n"),
printf("Autoconfigure found a %s%s%s\n",
sun_drives[i].vendor,
(*sun_drives[i].vendor) ? " " : "",
sun_drives[i].model);
@ -232,17 +235,15 @@ create_sunlabel(void)
unsigned char c;
const struct sun_predefined_drives *p = NULL;
fprintf(stderr,
_("Building a new sun disklabel. Changes will remain in memory only,\n"
"until you decide to write them. After that, of course, the previous\n"
"content won't be recoverable.\n\n"));
printf(msg_building_new_label, "sun disklabel");
sun_other_endian = BB_LITTLE_ENDIAN;
memset(MBRbuffer, 0, sizeof(MBRbuffer));
sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC);
if (!floppy) {
puts(_("Drive type\n"
puts("Drive type\n"
" ? auto configure\n"
" 0 custom (with hardware detected defaults)"));
" 0 custom (with hardware detected defaults)");
for (i = 0; i < SIZE(sun_drives); i++) {
printf(" %c %s%s%s\n",
i + 'a', sun_drives[i].vendor,
@ -250,21 +251,23 @@ create_sunlabel(void)
sun_drives[i].model);
}
while (1) {
c = read_nonempty(_("Select type (? for auto, 0 for custom): "));
c = read_nonempty("Select type (? for auto, 0 for custom): ");
if (c == '0') {
break;
}
if (c >= 'a' && c < 'a' + SIZE(sun_drives)) {
p = sun_drives + c - 'a';
break;
} else if (c >= 'A' && c < 'A' + SIZE(sun_drives)) {
}
if (c >= 'A' && c < 'A' + SIZE(sun_drives)) {
p = sun_drives + c - 'A';
break;
} else if (c == '0') {
break;
} else if (c == '?' && scsi_disk) {
}
if (c == '?' && scsi_disk) {
p = sun_autoconfigure_scsi();
if (!p)
printf(_("Autoconfigure failed.\n"));
else
if (p)
break;
printf("Autoconfigure failed\n");
}
}
}
@ -285,17 +288,17 @@ create_sunlabel(void)
sunlabel->ilfact = SUN_SSWAP16(1);
sunlabel->sparecyl = 0;
} else {
heads = read_int(1,heads,1024,0,_("Heads"));
sectors = read_int(1,sectors,1024,0,_("Sectors/track"));
heads = read_int(1, heads, 1024, 0, "Heads");
sectors = read_int(1, sectors, 1024, 0, "Sectors/track");
if (cylinders)
cylinders = read_int(1,cylinders-2,65535,0,_("Cylinders"));
cylinders = read_int(1, cylinders-2, 65535, 0, "Cylinders");
else
cylinders = read_int(1,0,65535,0,_("Cylinders"));
sunlabel->nacyl = SUN_SSWAP16(read_int(0,2,65535,0, _("Alternate cylinders")));
sunlabel->pcylcount = SUN_SSWAP16(read_int(0,cylinders+SUN_SSWAP16(sunlabel->nacyl), 65535,0, _("Physical cylinders")));
sunlabel->rspeed = SUN_SSWAP16(read_int(1,5400,100000,0, _("Rotation speed (rpm)")));
sunlabel->ilfact = SUN_SSWAP16(read_int(1,1,32,0, _("Interleave factor")));
sunlabel->sparecyl = SUN_SSWAP16(read_int(0,0,sectors,0, _("Extra sectors per cylinder")));
cylinders = read_int(1, 0, 65535, 0, "Cylinders");
sunlabel->nacyl = SUN_SSWAP16(read_int(0, 2, 65535, 0, "Alternate cylinders"));
sunlabel->pcylcount = SUN_SSWAP16(read_int(0, cylinders+SUN_SSWAP16(sunlabel->nacyl), 65535, 0, "Physical cylinders"));
sunlabel->rspeed = SUN_SSWAP16(read_int(1, 5400, 100000, 0, "Rotation speed (rpm)"));
sunlabel->ilfact = SUN_SSWAP16(read_int(1, 1, 32, 0, "Interleave factor"));
sunlabel->sparecyl = SUN_SSWAP16(read_int(0, 0, sectors, 0, "Extra sectors per cylinder"));
}
} else {
sunlabel->sparecyl = SUN_SSWAP16(p->sparecyl);
@ -309,13 +312,13 @@ create_sunlabel(void)
cylinders = p->ncyl;
heads = p->ntrks;
sectors = p->nsect;
puts(_("You may change all the disk params from the x menu"));
puts("You may change all the disk params from the x menu");
}
snprintf((char *)(sunlabel->info), sizeof(sunlabel->info),
"%s%s%s cyl %d alt %d hd %d sec %d",
p ? p->vendor : "", (p && *p->vendor) ? " " : "",
p ? p->model : (floppy ? _("3,5\" floppy") : _("Linux custom")),
p ? p->model : (floppy ? "3,5\" floppy" : "Linux custom"),
cylinders, SUN_SSWAP16(sunlabel->nacyl), heads, sectors);
sunlabel->ntrks = SUN_SSWAP16(heads);
@ -409,7 +412,7 @@ verify_sun(void)
for (k = 0; k < 7; k++) {
for (i = 0; i < 8; i++) {
if (k && (lens[i] % (heads * sectors))) {
printf(_("Partition %d doesn't end on cylinder boundary\n"), i+1);
printf("Partition %d doesn't end on cylinder boundary\n", i+1);
}
if (lens[i]) {
for (j = 0; j < i; j++)
@ -429,8 +432,8 @@ verify_sun(void)
endo = starts[i]+lens[i];
if (starts[j]+lens[j] < endo)
endo = starts[j]+lens[j];
printf(_("Partition %d overlaps with others in "
"sectors %d-%d\n"), i+1, starto, endo);
printf("Partition %d overlaps with others in "
"sectors %d-%d\n", i+1, starto, endo);
}
}
}
@ -446,18 +449,18 @@ verify_sun(void)
qsort(array,SIZE(array),sizeof(array[0]),
(int (*)(const void *,const void *)) verify_sun_cmp);
if (array[0] == -1) {
printf(_("No partitions defined\n"));
printf("No partitions defined\n");
return;
}
stop = cylinders * heads * sectors;
if (starts[array[0]])
printf(_("Unused gap - sectors 0-%d\n"),starts[array[0]]);
printf("Unused gap - sectors 0-%d\n", starts[array[0]]);
for (i = 0; i < 7 && array[i+1] != -1; i++) {
printf(_("Unused gap - sectors %d-%d\n"),starts[array[i]]+lens[array[i]],starts[array[i+1]]);
printf("Unused gap - sectors %d-%d\n", starts[array[i]]+lens[array[i]], starts[array[i+1]]);
}
start = starts[array[i]] + lens[array[i]];
if (start < stop)
printf(_("Unused gap - sectors %d-%d\n"),start,stop);
printf("Unused gap - sectors %d-%d\n", start, stop);
}
static void
@ -471,8 +474,7 @@ add_sun_partition(int n, int sys)
int i, first, last;
if (sunlabel->partitions[n].num_sectors && sunlabel->infos[n].id) {
printf(_("Partition %d is already defined. Delete "
"it before re-adding it.\n"), n + 1);
printf(msg_part_already_defined, n + 1);
return;
}
@ -481,12 +483,12 @@ add_sun_partition(int n, int sys)
if (n == 2)
whole_disk = 1;
else {
printf(_("Other partitions already cover the whole disk.\nDelete "
"some/shrink them before retry.\n"));
printf("Other partitions already cover the whole disk.\n"
"Delete/shrink them before retry.\n");
return;
}
}
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR));
while (1) {
if (whole_disk)
first = read_int(0, 0, 0, 0, mesg);
@ -501,7 +503,7 @@ add_sun_partition(int n, int sys)
if (n == 2 && first != 0)
printf("\
It is highly recommended that the third partition covers the whole disk\n\
and is of type `Whole disk'\n");
and is of type 'Whole disk'\n");
/* ewt asks to add: "don't start a partition at cyl 0"
However, edmundo@rano.demon.co.uk writes:
"In addition to having a Sun partition table, to be able to
@ -526,7 +528,7 @@ and is of type `Whole disk'\n");
whole_disk = 1;
break;
}
printf(_("Sector %d is already allocated\n"), first);
printf("Sector %d is already allocated\n", first);
} else
break;
}
@ -537,7 +539,7 @@ and is of type `Whole disk'\n");
stop = starts[i];
}
snprintf(mesg, sizeof(mesg),
_("Last %s or +size or +sizeM or +sizeK"),
"Last %s or +size or +sizeM or +sizeK",
str_units(SINGULAR));
if (whole_disk)
last = read_int(scround(stop2), scround(stop2), scround(stop2),
@ -555,11 +557,10 @@ and is of type `Whole disk'\n");
whole_disk = 1;
last = stop2;
} else if (last > stop) {
printf(_("You haven't covered the whole disk with "
"the 3rd partition, but your value\n"
"%d %s covers some other partition. "
"Your entry has been changed\n"
"to %d %s\n"),
printf(
"You haven't covered the whole disk with the 3rd partition,\n"
"but your value %d %s covers some other partition.\n"
"Your entry has been changed to %d %s\n",
scround(last), str_units(SINGULAR),
scround(stop), str_units(SINGULAR));
last = stop;
@ -581,10 +582,10 @@ sun_delete_partition(int i)
&& sunlabel->infos[i].id == SUN_WHOLE_DISK
&& !sunlabel->partitions[i].start_cylinder
&& (nsec = SUN_SSWAP32(sunlabel->partitions[i].num_sectors)) == heads * sectors * cylinders)
printf(_("If you want to maintain SunOS/Solaris compatibility, "
printf("If you want to maintain SunOS/Solaris compatibility, "
"consider leaving this\n"
"partition as Whole disk (5), starting at 0, with %u "
"sectors\n"), nsec);
"sectors\n", nsec);
sunlabel->infos[i].id = 0;
sunlabel->partitions[i].num_sectors = 0;
}
@ -594,12 +595,12 @@ sun_change_sysid(int i, int sys)
{
if (sys == LINUX_SWAP && !sunlabel->partitions[i].start_cylinder) {
read_maybe_empty(
_("It is highly recommended that the partition at offset 0\n"
"It is highly recommended that the partition at offset 0\n"
"is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n"
"there may destroy your partition table and bootblock.\n"
"Type YES if you're very sure you would like that partition\n"
"tagged with 82 (Linux swap): "));
if (strcmp (line_ptr, _("YES\n")))
"tagged with 82 (Linux swap): ");
if (strcmp (line_ptr, "YES\n"))
return;
}
switch (sys) {
@ -625,11 +626,11 @@ sun_list_table(int xtra)
w = strlen(disk_device);
if (xtra)
printf(
_("\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
"\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
"%d cylinders, %d alternate cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
"Units = %s of %d * 512 bytes\n\n"),
"Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, SUN_SSWAP16(sunlabel->rspeed),
cylinders, SUN_SSWAP16(sunlabel->nacyl),
SUN_SSWAP16(sunlabel->pcylcount),
@ -639,13 +640,13 @@ sun_list_table(int xtra)
str_units(PLURAL), units_per_sector);
else
printf(
_("\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
"Units = %s of %d * 512 bytes\n\n"),
"\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
"Units = %s of %d * 512 bytes\n\n",
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector);
printf(_("%*s Flag Start End Blocks Id System\n"),
w + 1, _("Device"));
printf("%*s Flag Start End Blocks Id System\n",
w + 1, "Device");
for (i = 0 ; i < partitions; i++) {
if (sunlabel->partitions[i].num_sectors) {
uint32_t start = SUN_SSWAP32(sunlabel->partitions[i].start_cylinder) * heads * sectors;
@ -669,8 +670,8 @@ static void
sun_set_alt_cyl(void)
{
sunlabel->nacyl =
SUN_SSWAP16(read_int(0,SUN_SSWAP16(sunlabel->nacyl), 65535, 0,
_("Number of alternate cylinders")));
SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->nacyl), 65535, 0,
"Number of alternate cylinders"));
}
static void
@ -684,7 +685,7 @@ sun_set_xcyl(void)
{
sunlabel->sparecyl =
SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->sparecyl), sectors, 0,
_("Extra sectors per cylinder")));
"Extra sectors per cylinder"));
}
static void
@ -692,7 +693,7 @@ sun_set_ilfact(void)
{
sunlabel->ilfact =
SUN_SSWAP16(read_int(1, SUN_SSWAP16(sunlabel->ilfact), 32, 0,
_("Interleave factor")));
"Interleave factor"));
}
static void
@ -700,7 +701,7 @@ sun_set_rspeed(void)
{
sunlabel->rspeed =
SUN_SSWAP16(read_int(1, SUN_SSWAP16(sunlabel->rspeed), 100000, 0,
_("Rotation speed (rpm)")));
"Rotation speed (rpm)"));
}
static void
@ -708,7 +709,7 @@ sun_set_pcylcount(void)
{
sunlabel->pcylcount =
SUN_SSWAP16(read_int(0, SUN_SSWAP16(sunlabel->pcylcount), 65535, 0,
_("Number of physical cylinders")));
"Number of physical cylinders"));
}
#endif /* FEATURE_FDISK_ADVANCED */