-.\" $OpenBSD: disklabel.8,v 1.154 2023/04/27 14:19:28 krw Exp $
+.\" $OpenBSD: disklabel.8,v 1.155 2023/05/13 18:13:42 krw Exp $
.\" $NetBSD: disklabel.8,v 1.9 1995/03/18 14:54:38 cgd Exp $
.\"
.\" Copyright (c) 1987, 1988, 1991, 1993
.\"
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
.\"
-.Dd $Mdocdate: April 27 2023 $
+.Dd $Mdocdate: May 13 2023 $
.Dt DISKLABEL 8
.Os
.Sh NAME
to delete all partitions).
If no partition is specified, the user will be prompted for one.
.It Cm e
-Edit disk type, e.g. 'SCSI', and label description, e.g. 'UMIS RPJTJ256MED'.
+Edit label description, e.g. 'UMIS RPJTJ256MED'.
.It Cm i
Change the disklabel UID, specified as a 16-character hexadecimal string.
If set to all zeros, a new UID will automatically be allocated when the
-/* $OpenBSD: disklabel.c,v 1.248 2023/05/06 15:07:02 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.249 2023/05/13 18:13:42 krw Exp $ */
/*
* Copyright (c) 1987, 1993
lab.d_ntracks = dl.d_ntracks;
lab.d_secpercyl = dl.d_secpercyl;
lab.d_ncylinders = dl.d_ncylinders;
+ lab.d_type = dl.d_type;
}
}
continue;
}
*tp++ = '\0', tp = skip(tp);
- if (!strcmp(cp, "type")) {
- if (tp == NULL)
- tp = "unknown";
- else if (strcasecmp(tp, "IDE") == 0)
- tp = "ESDI";
- cpp = dktypenames;
- for (; cpp < &dktypenames[DKMAXTYPES]; cpp++)
- if ((s = *cpp) && !strcasecmp(s, tp)) {
- lp->d_type = cpp - dktypenames;
- goto next;
- }
- v = GETNUM(lp->d_type, tp, 0, &errstr);
- if (errstr || v >= DKMAXTYPES)
- warnx("line %d: warning, unknown disk type: %s",
- lineno, tp);
- lp->d_type = v;
- continue;
- }
if (!strcmp(cp, "flags")) {
for (v = 0; (cp = tp) && *cp != '\0';) {
tp = word(cp);
!strcmp(cp, "sectors/track") ||
!strcmp(cp, "sectors/cylinder") ||
!strcmp(cp, "tracks/cylinder") ||
- !strcmp(cp, "cylinders"))
+ !strcmp(cp, "cylinders") ||
+ !strcmp(cp, "type"))
continue;
if ('a' <= *cp && *cp <= 'z' && cp[1] == '\0') {
-/* $OpenBSD: editor.c,v 1.404 2023/04/27 14:19:28 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.405 2023/05/13 18:13:42 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
struct alloc_table *alloc_table = alloc_table_default;
int alloc_table_nitems = 4;
-void edit_parms(struct disklabel *);
+void edit_packname(struct disklabel *);
void editor_resize(struct disklabel *, const char *);
void editor_add(struct disklabel *, const char *);
void editor_change(struct disklabel *, const char *);
int has_overlap(struct disklabel *);
int partition_cmp(const void *, const void *);
const struct partition **sort_partitions(const struct disklabel *, int);
-void getdisktype(struct disklabel *, const char *, char *);
void find_bounds(const struct disklabel *);
void set_bounds(struct disklabel *);
void set_duid(struct disklabel *);
!(tmpmountpoints = calloc(MAXPARTITIONS, sizeof(char *))))
errx(4, "out of memory");
- /* Don't allow disk type of "unknown" */
- getdisktype(&newlab, "You need to specify a type for this disk.",
- specname);
-
/* How big is the OpenBSD portion of the disk? */
find_bounds(&newlab);
break;
case 'e':
- edit_parms(&newlab);
+ edit_packname(&newlab);
break;
case 'i':
}
void
-edit_parms(struct disklabel *lp)
+edit_packname(struct disklabel *lp)
{
char *p;
- u_int64_t ui;
struct disklabel oldlabel = *lp;
- printf("Changing disk type and label description for %s:\n", specname);
-
- /* disk type */
- for (;;) {
- p = getstring("disk type",
- "What kind of disk is this? Usually SCSI, ESDI, ST506, or "
- "floppy (use ESDI for IDE).", dktypenames[lp->d_type]);
- if (p == NULL)
- return;
- if (strcasecmp(p, "IDE") == 0)
- ui = DTYPE_ESDI;
- else
- for (ui = 1; ui < DKMAXTYPES && strcasecmp(p,
- dktypenames[ui]); ui++)
- ;
- if (ui < DKMAXTYPES) {
- break;
- } else {
- printf("\"%s\" is not a valid disk type.\n", p);
- fputs("Valid types are: ", stdout);
- for (ui = 1; ui < DKMAXTYPES; ui++) {
- printf("\"%s\"", dktypenames[ui]);
- if (ui < DKMAXTYPES - 1)
- fputs(", ", stdout);
- }
- putchar('\n');
- }
- }
- lp->d_type = ui;
+ printf("Changing label description for %s:\n", specname);
/* pack/label id */
p = getstring("label name",
return (spp);
}
-/*
- * Get a valid disk type if necessary.
- */
-void
-getdisktype(struct disklabel *lp, const char *banner, char *dev)
-{
- int i;
- char *s;
- const char *def = "SCSI";
- const struct dtypes {
- const char *dev;
- const char *type;
- } dtypes[] = {
- { "sd", "SCSI" },
- { "wd", "IDE" },
- { "fd", "FLOPPY" },
- { "vnd", "VND" },
- };
-
- if ((s = basename(dev)) != NULL) {
- if (*s == 'r')
- s++;
- i = strcspn(s, "0123456789");
- s[i] = '\0';
- dev = s;
- for (i = 0; i < nitems(dtypes); i++) {
- if (strcmp(dev, dtypes[i].dev) == 0) {
- def = dtypes[i].type;
- break;
- }
- }
- }
-
- if (lp->d_type > DKMAXTYPES || lp->d_type == 0) {
- puts(banner);
- puts("Possible values are:");
- printf("\"IDE\", ");
- for (i = 1; i < DKMAXTYPES; i++) {
- printf("\"%s\"", dktypenames[i]);
- if (i < DKMAXTYPES - 1)
- fputs(", ", stdout);
- }
- putchar('\n');
-
- for (;;) {
- s = getstring("Disk type",
- "What kind of disk is this? Usually SCSI, IDE, "
- "ESDI, ST506, or floppy.", def);
- if (s == NULL)
- continue;
- if (strcasecmp(s, "IDE") == 0) {
- lp->d_type = DTYPE_ESDI;
- return;
- }
- for (i = 1; i < DKMAXTYPES; i++)
- if (strcasecmp(s, dktypenames[i]) == 0) {
- lp->d_type = i;
- return;
- }
- printf("\"%s\" is not a valid disk type.\n", s);
- fputs("Valid types are: ", stdout);
- for (i = 1; i < DKMAXTYPES; i++) {
- printf("\"%s\"", dktypenames[i]);
- if (i < DKMAXTYPES - 1)
- fputs(", ", stdout);
- }
- putchar('\n');
- }
- }
-}
-
/*
* Get beginning and ending sectors of the OpenBSD portion of the disk
* from the user.
" c [part] - change partition size r - display free space\n"
" D - reset label to default s [path] - save label to file\n"
" d [part] - delete partition U - undo all changes\n"
-" e - edit type and label name u - undo last change\n"
+" e - edit label description u - undo last change\n"
" i - modify disklabel UID w - write label to disk\n"
" l [unit] - print disk label header x - exit & lose changes\n"
" M - disklabel(8) man page z - delete all partitions\n"