- Use some macros to define common text between the dialog boxes to set the

type of new slices and to change the type of existing slices.  This also
  has the advantage of moving a few #ifdef PC98's up to where the macros
  are defined instead of in the middle of the code.
- Change the behavior of the 'T' option in the slice editor so that the
  default value in the dialog box is the current type of the existing
  slice rather than defaulting to changing the slice to a FreeBSD slice as
  this is more intuitive.

Approved by:	re
This commit is contained in:
John Baldwin 2002-12-05 22:10:39 +00:00
parent 878c9687ec
commit f179ebe91e
2 changed files with 50 additions and 76 deletions

View File

@ -52,6 +52,22 @@ enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_SIZE };
#endif
#define SUBTYPE_EFI 239
#ifdef PC98
#define OTHER_SLICE_VALUES \
"Other popular values are 37218 for a\n" \
"DOS FAT partition.\n\n"
#else
#define OTHER_SLICE_VALUES \
"Other popular values are 6 for a\n" \
"DOS FAT partition, 131 for a Linux ext2fs partition, or\n" \
"130 for a Linux swap partition.\n\n"
#endif
#define NON_FREEBSD_NOTE \
"Note: If you choose a non-FreeBSD partition type, it will not\n" \
"be formatted or otherwise prepared, it will simply reserve space\n" \
"for you to use another tool, such as DOS format, to later format\n" \
"and actually use the partition."
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
@ -423,25 +439,11 @@ diskPartition(Device *dev)
else if (*cp && toupper(*cp) == 'G')
size *= ONE_GIG;
sprintf(tmp, "%d", SUBTYPE_FREEBSD);
#ifdef PC98
val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 50324). You can choose other types, 37218 for a\n"
"DOS partition, for example.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS FORMAT, to later format\n"
"and use the partition.");
#else
val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). You can choose other types, 6 for a\n"
"DOS partition or 131 for a Linux partition, for example.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS FORMAT, to later format\n"
"and use the partition.");
#endif /* PC98 */
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type %u). "
OTHER_SLICE_VALUES
NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;
@ -484,27 +486,12 @@ diskPartition(Device *dev)
int subtype;
chunk_e partitiontype;
sprintf(tmp, "%d", SUBTYPE_FREEBSD);
#ifdef PC98
sprintf(tmp, "%d", chunk_info[current_chunk]->subtype);
val = msgGetInput(tmp, "New partition type:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 50324). Other popular values are 37218 for\n"
"DOS FAT partition.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS format, to later format\n"
"and actually use the partition.");
#else
val = msgGetInput(tmp, "New partition type:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). Other popular values are 6 for\n"
"DOS FAT partition, 131 for a Linux ext2fs partition or\n"
"130 for a Linux swap partition.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS format, to later format\n"
"and actually use the partition.");
#endif /* PC98 */
"Pressing Enter will use the current type. To choose a native\n"
"FreeBSD slice enter %u. "
OTHER_SLICE_VALUES
NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;

View File

@ -52,6 +52,22 @@ enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_SIZE };
#endif
#define SUBTYPE_EFI 239
#ifdef PC98
#define OTHER_SLICE_VALUES \
"Other popular values are 37218 for a\n" \
"DOS FAT partition.\n\n"
#else
#define OTHER_SLICE_VALUES \
"Other popular values are 6 for a\n" \
"DOS FAT partition, 131 for a Linux ext2fs partition, or\n" \
"130 for a Linux swap partition.\n\n"
#endif
#define NON_FREEBSD_NOTE \
"Note: If you choose a non-FreeBSD partition type, it will not\n" \
"be formatted or otherwise prepared, it will simply reserve space\n" \
"for you to use another tool, such as DOS format, to later format\n" \
"and actually use the partition."
/* Where we start displaying chunk information on the screen */
#define CHUNK_START_ROW 5
@ -423,25 +439,11 @@ diskPartition(Device *dev)
else if (*cp && toupper(*cp) == 'G')
size *= ONE_GIG;
sprintf(tmp, "%d", SUBTYPE_FREEBSD);
#ifdef PC98
val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 50324). You can choose other types, 37218 for a\n"
"DOS partition, for example.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS FORMAT, to later format\n"
"and use the partition.");
#else
val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). You can choose other types, 6 for a\n"
"DOS partition or 131 for a Linux partition, for example.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS FORMAT, to later format\n"
"and use the partition.");
#endif /* PC98 */
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type %u). "
OTHER_SLICE_VALUES
NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;
@ -484,27 +486,12 @@ diskPartition(Device *dev)
int subtype;
chunk_e partitiontype;
sprintf(tmp, "%d", SUBTYPE_FREEBSD);
#ifdef PC98
sprintf(tmp, "%d", chunk_info[current_chunk]->subtype);
val = msgGetInput(tmp, "New partition type:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 50324). Other popular values are 37218 for\n"
"DOS FAT partition.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS format, to later format\n"
"and actually use the partition.");
#else
val = msgGetInput(tmp, "New partition type:\n\n"
"Pressing Enter will choose the default, a native FreeBSD\n"
"slice (type 165). Other popular values are 6 for\n"
"DOS FAT partition, 131 for a Linux ext2fs partition or\n"
"130 for a Linux swap partition.\n\n"
"Note: If you choose a non-FreeBSD partition type, it will not\n"
"be formatted or otherwise prepared, it will simply reserve space\n"
"for you to use another tool, such as DOS format, to later format\n"
"and actually use the partition.");
#endif /* PC98 */
"Pressing Enter will use the current type. To choose a native\n"
"FreeBSD slice enter %u. "
OTHER_SLICE_VALUES
NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
if (val && (subtype = strtol(val, NULL, 0)) > 0) {
if (subtype == SUBTYPE_FREEBSD)
partitiontype = freebsd;